From 54742d00a169b5e5469b00eb9ad66685bb4d2e42 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 14 Jul 2014 22:14:01 +0530 Subject: debug: Remove extra newlines, and use g_critical everywhere --- src/encode.c | 14 +++++++------- src/lib.c | 8 ++++---- src/main.c | 50 +++++++++++++++++++++++++------------------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/encode.c b/src/encode.c index 3862aa6..4054c89 100644 --- a/src/encode.c +++ b/src/encode.c @@ -38,9 +38,9 @@ on_autoplug_continue (GstElement *decodebin, g_signal_emit_by_name (encodebin, "request-pad", caps, &sinkpad); if (sinkpad != NULL) - ret = FALSE, g_debug ("encodebin can passthrough %s\n", name); + ret = FALSE, g_debug ("encodebin can passthrough %s", name); else - ret = TRUE, g_debug ("encodebin cannot passthrough %s\n", name); + ret = TRUE, g_debug ("encodebin cannot passthrough %s", name); if (sinkpad) gst_object_unref (sinkpad); @@ -76,16 +76,16 @@ on_decodebin_pad_added (GstElement *decodebin, /* We request a sink pad for the decoded stream */ g_signal_emit_by_name (encodebin, "request-pad", caps, &sinkpad); if (!sinkpad) { - g_printerr ("Failed to request a new sink pad for %s\n", name); + g_critical ("Failed to request a new sink pad for %s", name); goto out; } - g_debug ("Requested a new sink pad for %s\n", name); + g_debug ("Requested a new sink pad for %s", name); } else { - g_debug ("Found an existing sink pad for %s\n", name); + g_debug ("Found an existing sink pad for %s", name); } if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK) - g_printerr ("Couldn't link pads for %s\n", name); + g_critical ("Couldn't link pads for %s", name); out: g_free (name); @@ -170,7 +170,7 @@ stp_encode_from_msg (TranscodeServerCtx *ctx) GstElement *tee, *q1, *fakesink; GstEncodingProfile *profile; - g_debug ("Constructing pipeline\n"); + g_debug ("Constructing pipeline"); src = gst_element_factory_make ("appsrc", "src"); g_object_set (src, "is-live", TRUE, diff --git a/src/lib.c b/src/lib.c index fa23256..5816b4e 100644 --- a/src/lib.c +++ b/src/lib.c @@ -35,9 +35,9 @@ stp_on_gst_bus_message (GstBus *bus, switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_ERROR: gst_message_parse_error (msg, &error, &tmp); - g_printerr ("ERROR from element %s: %s\n", + g_critical ("ERROR from element %s: %s", GST_OBJECT_NAME (msg->src), error->message); - g_printerr ("Debug info: %s\n", tmp); + g_critical ("Debug info: %s", tmp); g_error_free (error); g_free (tmp); /* Setting the server response will only work if the request @@ -48,7 +48,7 @@ stp_on_gst_bus_message (GstBus *bus, g_hash_table_remove (ctx->parent_ctx_table, ctx->path); break; case GST_MESSAGE_EOS: - g_debug ("End of file\n"); + g_debug ("End of file"); g_hash_table_remove (ctx->parent_ctx_table, ctx->path); break; default: @@ -74,7 +74,7 @@ gboolean stp_unref_gst_buffer (GstBuffer **buffer, void stp_cleanup_transcode_server_ctx (TranscodeServerCtx *ctx) { - g_debug (">>> Doing server cleanup\n"); + g_debug (">>> Doing server cleanup"); /* Disconnect and free the context for each client */ g_list_foreach (ctx->clients, (GFunc)stp_disconnect_cleanup_client, NULL); diff --git a/src/main.c b/src/main.c index c0dbd7a..2beca56 100644 --- a/src/main.c +++ b/src/main.c @@ -96,7 +96,7 @@ static void client_eos_cb (GstElement *appsink, TranscodeClientCtx *ctx) { - g_debug ("Received EOS for client\n"); + g_debug ("Received EOS for client"); soup_message_set_status (ctx->msg, SOUP_STATUS_OK); soup_message_body_complete (ctx->msg->response_body); } @@ -121,7 +121,7 @@ invoke_write_client_chunk (TranscodeClientCtx *ctx) stp_print_status ("*"); g_signal_emit_by_name (ctx->appsink, "pull-sample", &sample); if (!sample) { - g_debug ("Null sample, ending stream\n"); + g_debug ("Null sample, ending stream"); g_object_get (ctx->appsink, "eos", &eos, NULL); if (eos) soup_message_set_status (ctx->msg, SOUP_STATUS_OK); @@ -178,7 +178,7 @@ stream_finished_cb (SoupMessage *msg, /* Incoming stream has ended */ g_signal_emit_by_name (ctx->appsrc, "end-of-stream", &ret); if (ret != GST_FLOW_OK) - g_printerr ("\nUnable to emit end-of-stream after an aborted stream\n"); + g_critical ("\nUnable to emit end-of-stream after an aborted stream"); else stp_print_status ("Done.\n"); } @@ -197,7 +197,7 @@ handle_request_cb (SoupServer *server, if (!msg) return; - g_debug ("Handling %s request on path %s\n", msg->method, path); + g_debug ("Handling %s request on path %s", msg->method, path); if (msg->method == SOUP_METHOD_PUT || msg->method == SOUP_METHOD_POST) @@ -297,7 +297,7 @@ GET: goto err; } - g_debug ("appsink bin state synced successfully\n"); + g_debug ("appsink bin state synced successfully"); /* t. ! queue ! appsink */ gst_pad_link (srcpad, client_ctx->ghostsinkpad); @@ -308,13 +308,13 @@ GET: /* TODO: cache keyframes */ buffer = stp_get_streamheader_from_caps (caps); if (!buffer) { - g_printerr ("Unable to get streamheader from caps\n"); + g_critical ("Unable to get streamheader from caps"); goto push_keyframe; } ret = gst_pad_push (srcpad, buffer); if (ret != GST_FLOW_OK) { - g_printerr ("Unable to push streamheader: %s\n", + g_critical ("Unable to push streamheader: %s", gst_flow_get_name (ret)); goto err; } @@ -323,14 +323,14 @@ push_keyframe: ret = gst_pad_push_list (srcpad, gst_buffer_list_copy (server_ctx->keyframe)); if (ret != GST_FLOW_OK) { - g_printerr ("Unable to push keyframe data: %s\n", + g_critical ("Unable to push keyframe data: %s", gst_flow_get_name (ret)); goto err; } state_change = gst_element_get_state (server_ctx->pipeline, &state, NULL, 1); - g_debug ("Pushed buffer. State was %s:%s.\n", + g_debug ("Pushed buffer. State was %s:%s.", gst_element_state_change_return_get_name (state_change), gst_element_state_get_name (state)); @@ -404,7 +404,7 @@ static void request_ended_no_body_cb (SoupMessage *msg, TranscodeServerCtx *ctx) { - g_printerr ("Request ended without a body!\n"); + g_critical ("Request ended without a body!"); g_hash_table_remove (ctx->parent_ctx_table, ctx->path); g_free (ctx); } @@ -447,7 +447,7 @@ got_first_request_body_chunk (SoupMessage *msg, soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); g_hash_table_remove (ctx->parent_ctx_table, ctx->path); } else { - g_debug ("Set pipeline to PLAYING\n"); + g_debug ("Set pipeline to PLAYING"); } /* Connect a different method for all further chunks */ @@ -475,11 +475,11 @@ got_request_headers (SoupMessage *msg, const char *name, *value; soup_message_headers_iter_init (&iter, msg->request_headers); while (soup_message_headers_iter_next (&iter, &name, &value)) - g_debug ("%s: %s\n", name, value); + g_debug ("%s: %s", name, value); #endif g_object_get (msg, "uri", &uri, NULL); - g_debug ("%s on uri %s\n", msg->method, soup_uri_get_path (uri)); + g_debug ("%s on uri %s", msg->method, soup_uri_get_path (uri)); if (msg->method == SOUP_METHOD_PUT || msg->method == SOUP_METHOD_POST) @@ -508,17 +508,17 @@ PUT: { encoding = soup_message_headers_get_encoding (msg->request_headers); switch (encoding) { case SOUP_ENCODING_CHUNKED: - g_debug ("Chunked encoding detected!\n"); + g_debug ("Chunked encoding detected!"); if (connection_exists) { /* There's already a chunked request streaming on this path */ - g_printerr ("Recv duplicate request on the same URI: %s\n", - soup_uri_get_path (uri)); + g_critical ("Recv duplicate request on the same URI: %s", + soup_uri_get_path (uri)); soup_message_set_status (msg, SOUP_STATUS_CONFLICT); goto out; } break; case SOUP_ENCODING_CONTENT_LENGTH: - g_debug ("Content-Length encoding detected!\n"); + g_debug ("Content-Length encoding detected!"); content_range = soup_message_headers_get_one (msg->request_headers, "Content-Range"); /* TODO: Right now, we don't check if the Content-Range is valid, @@ -526,7 +526,7 @@ PUT: { if (connection_exists && !content_range) { /* A connection already exists, and this one isn't a continuation * of the previous one, so it's a conflict */ - g_printerr ("Recv Content-Length PUT on '%s' without Content-Range\n", + g_critical ("Recv Content-Length PUT on '%s' without Content-Range", soup_uri_get_path (uri)); soup_message_set_status (msg, SOUP_STATUS_CONFLICT); goto out; @@ -548,10 +548,10 @@ PUT: { soup_message_body_set_accumulate (msg->request_body, FALSE); if (connection_exists) { - g_debug ("Stream already exists, connecting everything to that...\n"); + g_debug ("Stream already exists, connecting everything to that..."); ctx = get_server_ctx_from_msg (msg, ctx_table); if (ctx->stream_finished) { - g_printerr ("Recv more data on '%s' after timeout\n", + g_critical ("Recv more data on '%s' after timeout", soup_uri_get_path (uri)); soup_message_set_status (msg, SOUP_STATUS_REQUEST_TIMEOUT); goto out; @@ -588,7 +588,7 @@ GET: { if (!g_hash_table_contains (ctx_table, soup_uri_get_path (uri))) { - g_printerr ("No stream on URI: %s\n", soup_uri_get_path (uri)); + g_critical ("No stream on URI: %s", soup_uri_get_path (uri)); soup_message_set_status (msg, SOUP_STATUS_NOT_FOUND); goto out; } @@ -627,7 +627,7 @@ request_started_cb (SoupServer *server, SoupClientContext *client, GHashTable *ctx_table) { - g_debug ("New %s request started\n", msg->method); + g_debug ("New %s request started", msg->method); /* SoupMessage is useful only once we have headers, * so we do all initialization there */ @@ -661,7 +661,7 @@ GET: /* Nothing to do */ } - g_debug ("%s request read successfully\n", msg->method); + g_debug ("%s request read successfully", msg->method); } static void @@ -670,7 +670,7 @@ request_finished_cb (SoupServer *server, SoupClientContext *client, GHashTable *ctx_table) { - g_debug ("%s request ended\n", msg->method); + g_debug ("%s request ended", msg->method); } static void @@ -679,7 +679,7 @@ request_aborted_cb (SoupServer *server, SoupClientContext *client, GHashTable *ctx_table) { - g_debug ("%s request aborted!\n", msg->method); + g_debug ("%s request aborted!", msg->method); if (msg->method == SOUP_METHOD_PUT || msg->method == SOUP_METHOD_POST) goto PUT; -- cgit v0.11.2-2-gd1dd