diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2014-05-07 21:36:30 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2014-05-07 23:08:26 -0400 |
commit | 76374a1844b33da20f70b5b2a17f6414d6109482 (patch) | |
tree | d21069dd449f5879789ab6d6852a11bdd09febd3 /tests | |
parent | a15b66e23dd29ace82b9de218ea243b88d343890 (diff) | |
download | farstream-76374a1844b33da20f70b5b2a17f6414d6109482.tar.gz |
rtpcodecdisco: Improve debug printing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/rtp/codec-discovery.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/tests/rtp/codec-discovery.c b/tests/rtp/codec-discovery.c index ef6ed96a..41da457c 100644 --- a/tests/rtp/codec-discovery.c +++ b/tests/rtp/codec-discovery.c @@ -27,19 +27,37 @@ static void -debug_pipeline (GList *pipeline) +debug_pipeline (const gchar *prefix, GList *pipeline) { GList *walk; + GString *str; + gboolean first = FALSE; + + str = g_string_new (prefix); for (walk = pipeline; walk; walk = g_list_next (walk)) { GList *walk2; + gboolean first_alt = TRUE; + + if (!first) + g_string_append (str, " ->"); + first = FALSE; + for (walk2 = g_list_first (walk->data); walk2; walk2 = g_list_next (walk2)) - g_message ("%p:%d:%s ", walk2->data, - GST_OBJECT_REFCOUNT_VALUE(GST_OBJECT (walk2->data)), - gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (walk2->data))); - g_message ("--"); + { + if (first_alt) + g_string_append_printf (str, " %s", + gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (walk2->data))); + else + g_string_append_printf (str, " | %s", + gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (walk2->data))); + + first_alt = FALSE; + } } + g_print ("%s\n", str->str); + g_string_free (str, TRUE); } static void @@ -48,24 +66,22 @@ debug_blueprint (CodecBlueprint *blueprint) gchar *str; str = fs_codec_to_string (blueprint->codec); - g_message ("Codec: %s", str); + g_print ("Codec: %s\n", str); g_free (str); str = gst_caps_to_string (blueprint->media_caps); - g_message ("media_caps: %s", str); + g_print ("media_caps: %s\n", str); g_free (str); str = gst_caps_to_string (blueprint->rtp_caps); - g_message ("rtp_caps: %s", str); + g_print ("rtp_caps: %s\n", str); g_free (str); - g_message ("send pipeline:"); - debug_pipeline (blueprint->send_pipeline_factory); + debug_pipeline ("send pipeline:", blueprint->send_pipeline_factory); - g_message ("recv pipeline:"); - debug_pipeline (blueprint->receive_pipeline_factory); + debug_pipeline ("recv pipeline:", blueprint->receive_pipeline_factory); - g_message ("================================"); + g_print ("================================\n"); } int main (int argc, char **argv) @@ -84,12 +100,12 @@ int main (int argc, char **argv) gst_debug_set_default_threshold (GST_LEVEL_WARNING); - g_message ("AUDIO STARTING!!"); + g_print ("AUDIO STARTING!!\n"); elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_AUDIO, &error); if (error) - g_message ("Error: %s", error->message); + g_printerr ("Error: %s\n", error->message); else g_list_foreach (elements, (GFunc) debug_blueprint, NULL); @@ -97,15 +113,15 @@ int main (int argc, char **argv) fs_rtp_blueprints_unref (FS_MEDIA_TYPE_AUDIO); - g_message ("AUDIO FINISHED!!"); + g_print ("AUDIO FINISHED!!\n"); - g_message ("VIDEO STARTING!!"); + g_print ("VIDEO STARTING!!\n"); elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_VIDEO, &error); if (error) - g_message ("Error: %s", error->message); + g_printerr ("Error: %s\n", error->message); else g_list_foreach (elements, (GFunc) debug_blueprint, NULL); @@ -113,7 +129,7 @@ int main (int argc, char **argv) fs_rtp_blueprints_unref (FS_MEDIA_TYPE_VIDEO); - g_message ("VIDEO FINISHED!!"); + g_print ("VIDEO FINISHED!!\n"); return 0; } |