diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gst-discoverer.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/gst-discoverer.c b/tools/gst-discoverer.c index 00d2d0f41..19aef907f 100644 --- a/tools/gst-discoverer.c +++ b/tools/gst-discoverer.c @@ -171,6 +171,57 @@ gst_stream_video_information_to_string (GstDiscovererStreamInfo * info, return g_string_free (s, FALSE); } +static gchar * +gst_stream_subtitle_information_to_string (GstDiscovererStreamInfo * info, + gint depth) +{ + GstDiscovererSubtitleInfo *subtitle_info; + GString *s; + gchar *tmp; + const gchar *ctmp; + int len = 400; + const GstTagList *tags; + GstCaps *caps; + + g_return_val_if_fail (info != NULL, NULL); + + s = g_string_sized_new (len); + + my_g_string_append_printf (s, "Codec:\n"); + caps = gst_discoverer_stream_info_get_caps (info); + tmp = gst_caps_to_string (caps); + gst_caps_unref (caps); + my_g_string_append_printf (s, " %s\n", tmp); + g_free (tmp); + + my_g_string_append_printf (s, "Additional info:\n"); + if (gst_discoverer_stream_info_get_misc (info)) { + tmp = gst_structure_to_string (gst_discoverer_stream_info_get_misc (info)); + my_g_string_append_printf (s, " %s\n", tmp); + g_free (tmp); + } else { + my_g_string_append_printf (s, " None\n"); + } + + subtitle_info = (GstDiscovererSubtitleInfo *) info; + ctmp = gst_discoverer_subtitle_info_get_language (subtitle_info); + my_g_string_append_printf (s, "Language: %s\n", ctmp ? ctmp : "<unknown>"); + + my_g_string_append_printf (s, "Tags:\n"); + tags = gst_discoverer_stream_info_get_tags (info); + if (tags) { + tmp = gst_structure_to_string ((GstStructure *) tags); + my_g_string_append_printf (s, " %s\n", tmp); + g_free (tmp); + } else { + my_g_string_append_printf (s, " None\n"); + } + if (verbose) + my_g_string_append_printf (s, "\n"); + + return g_string_free (s, FALSE); +} + static void print_stream_info (GstDiscovererStreamInfo * info, void *depth) { @@ -204,6 +255,10 @@ print_stream_info (GstDiscovererStreamInfo * info, void *depth) desc = gst_stream_video_information_to_string (info, GPOINTER_TO_INT (depth) + 1); + else if (GST_IS_DISCOVERER_SUBTITLE_INFO (info)) + desc = + gst_stream_subtitle_information_to_string (info, + GPOINTER_TO_INT (depth) + 1); if (desc) { g_print ("%s", desc); g_free (desc); |