summaryrefslogtreecommitdiff
path: root/tools/gst-discoverer.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2012-05-26 19:50:46 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2012-05-26 19:50:46 +0100
commitd9adf02a5a7cf4b7193d48acf500177e3dded5a3 (patch)
treeff6a5447c52608141bb0613d6bd2d10f3c9352be /tools/gst-discoverer.c
parent59d8d73aa206ab01f6e85de3570ede7815eab840 (diff)
downloadgstreamer-plugins-base-d9adf02a5a7cf4b7193d48acf500177e3dded5a3.tar.gz
gst-discoverer: don't use GstStructure API on tag lists
Diffstat (limited to 'tools/gst-discoverer.c')
-rw-r--r--tools/gst-discoverer.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/tools/gst-discoverer.c b/tools/gst-discoverer.c
index ee07b4241..04792b693 100644
--- a/tools/gst-discoverer.c
+++ b/tools/gst-discoverer.c
@@ -103,7 +103,7 @@ gst_stream_audio_information_to_string (GstDiscovererStreamInfo * info,
my_g_string_append_printf (s, depth, "Tags:\n");
tags = gst_discoverer_stream_info_get_tags (info);
if (tags) {
- tmp = gst_structure_to_string ((GstStructure *) tags);
+ tmp = gst_tag_list_to_string (tags);
my_g_string_append_printf (s, depth, " %s\n", tmp);
g_free (tmp);
} else {
@@ -175,7 +175,7 @@ gst_stream_video_information_to_string (GstDiscovererStreamInfo * info,
my_g_string_append_printf (s, depth, "Tags:\n");
tags = gst_discoverer_stream_info_get_tags (info);
if (tags) {
- tmp = gst_structure_to_string ((GstStructure *) tags);
+ tmp = gst_tag_list_to_string (tags);
my_g_string_append_printf (s, depth, " %s\n", tmp);
g_free (tmp);
} else {
@@ -227,7 +227,7 @@ gst_stream_subtitle_information_to_string (GstDiscovererStreamInfo * info,
my_g_string_append_printf (s, depth, "Tags:\n");
tags = gst_discoverer_stream_info_get_tags (info);
if (tags) {
- tmp = gst_structure_to_string ((GstStructure *) tags);
+ tmp = gst_tag_list_to_string (tags);
my_g_string_append_printf (s, depth, " %s\n", tmp);
g_free (tmp);
} else {
@@ -311,10 +311,9 @@ print_topology (GstDiscovererStreamInfo * info, gint depth)
}
}
-static gboolean
-print_tag_each (GQuark field_id, const GValue * value, gpointer user_data)
+static void
+print_tag (const gchar * tag_name, const GValue * value, gint tab)
{
- gint tab = GPOINTER_TO_INT (user_data);
gchar *ser;
if (G_VALUE_HOLDS_STRING (value))
@@ -333,13 +332,11 @@ print_tag_each (GQuark field_id, const GValue * value, gpointer user_data)
} else
ser = gst_value_serialize (value);
- g_print ("%*s%s: %s\n", tab, " ",
- gst_tag_get_nick (g_quark_to_string (field_id)), ser);
+ g_print ("%*s%s: %s\n", tab, " ", gst_tag_get_nick (tag_name), ser);
g_free (ser);
-
- return TRUE;
}
+/* FIXME: this function is almost identical to print_tag() */
static void
print_tag_foreach (const GstTagList * tags, const gchar * tag,
gpointer user_data)
@@ -399,9 +396,19 @@ print_properties (GstDiscovererInfo * info, gint tab)
g_print ("%*sSeekable: %s\n", tab + 1, " ",
(gst_discoverer_info_get_seekable (info) ? "yes" : "no"));
if ((tags = gst_discoverer_info_get_tags (info))) {
+ guint num_tags, i;
+
g_print ("%*sTags: \n", tab + 1, " ");
- gst_structure_foreach ((const GstStructure *) tags, print_tag_each,
- GINT_TO_POINTER (tab + 5));
+ num_tags = gst_tag_list_n_tags (tags);
+ for (i = 0; i < num_tags; ++i) {
+ const GValue *val;
+ const gchar *tag_name;
+
+ tag_name = gst_tag_list_nth_tag_name (tags, i);
+ /* FIXME: print all entries for a tag if there are multiple ones */
+ val = gst_tag_list_get_value_index (tags, tag_name, 0);
+ print_tag (tag_name, val, tab + 5);
+ }
}
if (show_toc && (toc = gst_discoverer_info_get_toc (info))) {
g_print ("%*sTOC: \n", tab + 1, " ");