summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2014-07-14 09:54:21 (GMT)
committerNirbheek Chauhan <nirbheek@centricular.com>2014-07-14 10:05:31 (GMT)
commitde7a28eeddb893c32f6e8ac9f46e43e3cd1be524 (patch)
treef4b36738a88ec7050b871a46b81673e6aae10c30
parent29e05ecac49fe6b3c4c8d46adf54056f843ec553 (diff)
downloadsoup-transcoding-proxy-de7a28eeddb893c32f6e8ac9f46e43e3cd1be524.zip
soup-transcoding-proxy-de7a28eeddb893c32f6e8ac9f46e43e3cd1be524.tar.gz
debug: Use a macro for buffer read/write status printing
-rw-r--r--src/main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 22168bd..8067b52 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,6 +27,12 @@
#include "debug/local-play.h"
#endif
+#ifdef ENCODE_DEBUG
+#define stp_print_status(...) g_print(__VA_ARGS__)
+#else
+#define stp_print_status(...) do {} while (0)
+#endif
+
static int port = 8000;
static int client_timeout = 10;
static int server_timeout = 5;
@@ -106,7 +112,7 @@ can_write_next_client_chunk_cb (SoupMessage *msg,
g_mutex_unlock (&ctx->can_write_chunk);
ctx->seconds_since_write = 0;
ctx->msg = msg;
- g_print ("_");
+ stp_print_status ("_");
}
static GstFlowReturn
@@ -120,7 +126,7 @@ write_client_chunk_cb (GstElement *appsink,
gboolean eos;
if (!g_mutex_trylock (&ctx->can_write_chunk)) {
- g_print ("!");
+ stp_print_status ("!");
/* We cannot safely append to the message body till
* the previous chunk is written out, otherwise we get
* a segfault. This is likely because SoupMessageBody
@@ -128,7 +134,7 @@ write_client_chunk_cb (GstElement *appsink,
return GST_FLOW_OK;
}
- g_print ("*");
+ stp_print_status ("*");
g_signal_emit_by_name (ctx->appsink, "pull-sample", &sample);
if (!sample) {
g_print ("Null sample, ending stream\n");
@@ -153,7 +159,7 @@ write_client_chunk_cb (GstElement *appsink,
gst_sample_unref (sample);
soup_server_unpause_message (server, ctx->msg);
- g_print (".");
+ stp_print_status (".");
return GST_FLOW_OK;
}