summaryrefslogtreecommitdiff
path: root/tools/gst-discoverer.c
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2011-08-24 15:04:50 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2011-08-26 10:05:50 +0200
commit4b5bfb1fd4955b33675fcdbaa0182922c9bc3b89 (patch)
tree2960e0ca59ae07cca6e807712d2a55e72c718081 /tools/gst-discoverer.c
parenta91237434271ed17d59bf95e0762dc9161c09864 (diff)
downloadgstreamer-plugins-base-4b5bfb1fd4955b33675fcdbaa0182922c9bc3b89.tar.gz
discoverer: add subtitles API
https://bugzilla.gnome.org/show_bug.cgi?id=639055
Diffstat (limited to 'tools/gst-discoverer.c')
-rw-r--r--tools/gst-discoverer.c55
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);