From 9667e1e75c8187593c3a6115567385720d120b2e Mon Sep 17 00:00:00 2001 From: Anton Belka Date: Tue, 8 May 2012 20:12:42 +0300 Subject: [PATCH] gst-launch: print tags in toc --- tools/gst-launch.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 2113bf431b..9161594f35 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -438,6 +438,27 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused) } } +static void +print_tag_foreach (const GstTagList * tags, const gchar * tag, + gpointer user_data) +{ + GValue val = { 0, }; + gchar *str; + gint depth = GPOINTER_TO_INT (user_data); + + gst_tag_list_copy_value (&val, tags, tag); + + if (G_VALUE_HOLDS_STRING (&val)) + str = g_value_dup_string (&val); + else + str = gst_value_serialize (&val); + + g_print ("%*s%s: %s\n", 2 * depth, " ", gst_tag_get_nick (tag), str); + g_free (str); + + g_value_unset (&val); +} + #define MAX_INDENT 40 static void @@ -461,7 +482,9 @@ print_toc_entry (gpointer data, gpointer user_data) PRINT ("\n"); indent += 2; - /* TODO: print tags */ + /* print tags */ + gst_tag_list_foreach (entry->tags, print_tag_foreach, + GINT_TO_POINTER (indent)); /* loop over sub-toc entries */ g_list_foreach (entry->subentries, print_toc_entry,