Commit d9adf02a authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

gst-discoverer: don't use GstStructure API on tag lists

parent 59d8d73a
......@@ -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, " ");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment