From 84ccaf3a8a3afd1a4af7bf716e6b11c37bbf10ca Mon Sep 17 00:00:00 2001 From: Julien Moutte Date: Tue, 16 Dec 2003 14:56:06 +0000 Subject: Adding tag dumping support. Original commit message from CVS: Adding tag dumping support. --- examples/gstplay/player.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/gstplay/player.c b/examples/gstplay/player.c index 09811e630..846d58ac5 100644 --- a/examples/gstplay/player.c +++ b/examples/gstplay/player.c @@ -22,6 +22,39 @@ static GMainLoop *loop = NULL; static gint64 length = 0; +static void +print_tag (const GstTagList *list, const gchar *tag, gpointer unused) +{ + gint i, count; + + count = gst_tag_list_get_tag_size (list, tag); + + for (i = 0; i < count; i++) { + gchar *str; + + if (gst_tag_get_type (tag) == G_TYPE_STRING) { + g_assert (gst_tag_list_get_string_index (list, tag, i, &str)); + } else { + str = g_strdup_value_contents ( + gst_tag_list_get_value_index (list, tag, i)); + } + + if (i == 0) { + g_print ("%15s: %s\n", gst_tag_get_nick (tag), str); + } else { + g_print (" : %s\n", str); + } + + g_free (str); + } +} + +static void +got_found_tag (GstPlay *play,GstElement *source, GstTagList *tag_list) +{ + gst_tag_list_foreach (tag_list, print_tag, NULL); +} + static void got_time_tick (GstPlay *play, gint64 time_nanos) { @@ -82,7 +115,7 @@ main (int argc, char *argv[]) /* Getting default audio and video plugins from GConf */ audio_sink = gst_element_factory_make ("osssink", "audio_sink"); - video_sink = gst_element_factory_make ("ximagesink", "video_sink"); + video_sink = gst_element_factory_make ("xvimagesink", "video_sink"); vis_element = gst_element_factory_make ("goom", "vis_element"); data_src = gst_element_factory_make ("gnomevfssrc", "source"); @@ -103,6 +136,8 @@ main (int argc, char *argv[]) G_CALLBACK (got_stream_length), NULL); g_signal_connect (G_OBJECT (play), "have_video_size", G_CALLBACK (got_video_size), NULL); + g_signal_connect (G_OBJECT (play), "found_tag", + G_CALLBACK (got_found_tag), NULL); g_signal_connect (G_OBJECT (play), "eos", G_CALLBACK (got_eos), NULL); -- cgit v1.2.3