From de7a28eeddb893c32f6e8ac9f46e43e3cd1be524 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 14 Jul 2014 15:24:21 +0530 Subject: debug: Use a macro for buffer read/write status printing --- src/main.c | 14 ++++++++++---- 1 file 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; } -- cgit v0.11.2-2-gd1dd