diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2017-03-07 00:25:03 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2017-03-07 00:25:03 +0000 |
commit | a1085c3b1fb0c12816b9b293d28e2ecbda901741 (patch) | |
tree | 656db61e0afb33a180ac1d87f1218a35c33e670c /tools | |
parent | 052d34478f5223310de004895b6e19e618cbc708 (diff) | |
download | gstreamer-plugins-base-a1085c3b1fb0c12816b9b293d28e2ecbda901741.tar.gz |
tools: gst-play: improve verbose output of property notifications
Use new message notify API and print caps and taglists in a nicer
to read way, just like gst-launch-1.0 does nowadays, without
escaping everything three times.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gst-play.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tools/gst-play.c b/tools/gst-play.c index 189e8f707..88c51f940 100644 --- a/tools/gst-play.c +++ b/tools/gst-play.c @@ -194,8 +194,8 @@ play_new (gchar ** uris, const gchar * audio_sink, const gchar * video_sink, } if (verbose) { - play->deep_notify_id = g_signal_connect (play->playbin, "deep-notify", - G_CALLBACK (gst_object_default_deep_notify), NULL); + play->deep_notify_id = + gst_element_add_property_deep_notify_watch (play->playbin, NULL, TRUE); } play->loop = g_main_loop_new (NULL, FALSE); @@ -470,6 +470,34 @@ play_bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data) } break; } + case GST_MESSAGE_PROPERTY_NOTIFY:{ + const GValue *val; + const gchar *name; + GstObject *obj; + gchar *val_str = NULL; + gchar *obj_name; + + gst_message_parse_property_notify (msg, &obj, &name, &val); + + obj_name = gst_object_get_path_string (GST_OBJECT (obj)); + if (val != NULL) { + if (G_VALUE_HOLDS_STRING (val)) + val_str = g_value_dup_string (val); + else if (G_VALUE_TYPE (val) == GST_TYPE_CAPS) + val_str = gst_caps_to_string (g_value_get_boxed (val)); + else if (G_VALUE_TYPE (val) == GST_TYPE_TAG_LIST) + val_str = gst_tag_list_to_string (g_value_get_boxed (val)); + else + val_str = gst_value_serialize (val); + } else { + val_str = g_strdup ("(no value)"); + } + + gst_play_printf ("%s: %s = %s\n", obj_name, name, val_str); + g_free (obj_name); + g_free (val_str); + break; + } default: if (gst_is_missing_plugin_message (msg)) { gchar *desc; |