From a11cf2ec0a951b954857ebfa83abbfa4ac6db77e Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sat, 6 Mar 2004 20:15:17 +0000 Subject: first pass at making this work again needs quite a lot of cleanups Original commit message from CVS: first pass at making this work again needs quite a lot of cleanups --- gst-libs/gst/media-info/media-info-test.c | 53 ++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'gst-libs/gst/media-info/media-info-test.c') diff --git a/gst-libs/gst/media-info/media-info-test.c b/gst-libs/gst/media-info/media-info-test.c index 6c396b38..9a692144 100644 --- a/gst-libs/gst/media-info/media-info-test.c +++ b/gst-libs/gst/media-info/media-info-test.c @@ -4,6 +4,33 @@ #include #include "media-info.h" +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 info_print (GstMediaInfoStream *stream) { @@ -27,9 +54,12 @@ info_print (GstMediaInfoStream *stream) g_print ("- track %d\n", i); track = (GstMediaInfoTrack *) p->data; g_print (" - metadata:\n"); - g_print ("%s\n", gst_caps_to_string (track->metadata)); + if (track->metadata) + gst_tag_list_foreach (track->metadata, print_tag, NULL); + else + g_print (" (none found)\n"); g_print (" - streaminfo:\n"); - g_print ("%s\n", gst_caps_to_string (track->streaminfo)); + gst_tag_list_foreach (track->streaminfo, print_tag, NULL); g_print (" - format:\n"); g_print ("%s\n", gst_caps_to_string (track->format)); p = p->next; @@ -41,14 +71,29 @@ main (int argc, char *argv[]) { GstMediaInfo *info; GstMediaInfoStream *stream = NULL; + GError *error = NULL; gint i; g_assert (argc > 1); - gst_init (&argc, &argv); gst_media_info_init (); + gst_init (&argc, &argv); + + info = gst_media_info_new (&error); + if (error != NULL) + { + g_print ("Error creating media-info object: %s\n", error->message); + g_error_free (error); + return -1; + } + + g_assert (G_IS_OBJECT (info)); + if (!gst_media_info_set_source (info, "gnomevfssrc")) + { + g_print ("Could not set gnomevfssrc as a source\n"); + return -1; + } - info = g_object_new (GST_MEDIA_INFO_TYPE, NULL); g_print ("stream: %p, &stream: %p\n", stream, &stream); for (i = 1; i < argc; ++i) { -- cgit v1.2.1