ext/ogg/: Extract language tags from ogm subtitle streams, so that the subtitle menu...
authorTim-Philipp Müller <tim@centricular.net>
Wed, 14 Jun 2006 14:34:28 +0000 (14:34 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Wed, 14 Jun 2006 14:34:28 +0000 (14:34 +0000)
Original commit message from CVS:
* ext/ogg/Makefile.am:
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
Extract language tags from ogm subtitle streams, so that
the subtitle menu choices are labelled correctly in
Totem (fixes #344708).

ChangeLog
ext/ogg/Makefile.am
ext/ogg/gstogmparse.c

index 711c02a..fa3775d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-06-14  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * ext/ogg/Makefile.am:
+       * ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
+         Extract language tags from ogm subtitle streams, so that
+         the subtitle menu choices are labelled correctly in
+         Totem (fixes #344708).
+
 2006-06-14  Wim Taymans  <wim@fluendo.com>
 
        Patch by: Alessandro Decina <alessandro at nnva dot org>
index c289301..174712c 100644 (file)
@@ -10,6 +10,7 @@ libgstogg_la_SOURCES = \
 libgstogg_la_CFLAGS = $(GST_CFLAGS) $(OGG_CFLAGS) 
 libgstogg_la_LIBADD = \
        $(top_builddir)/gst-libs/gst/riff/libgstriff-$(GST_MAJORMINOR).la \
+       $(top_builddir)/gst-libs/gst/tag/libgsttag-$(GST_MAJORMINOR).la \
        $(GST_BASE_LIBS) \
        $(OGG_LIBS)
 libgstogg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
index d903838..0fd207f 100644 (file)
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include <gst/gst.h>
+#include <gst/tag/tag.h>
 #include <gst/riff/riff-media.h>
 
 GST_DEBUG_CATEGORY_STATIC (gst_ogm_parse_debug);
@@ -633,9 +634,25 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer)
       }
       break;
     }
-    case 0x03:
-      /* comment - unused */
+    case 0x03:{
+      /* vorbis comment - need to extract the tags ourself for subtitle
+       * streams since we want to know the language and there won't be a
+       * decoder to do this for us like with vorbis */
+      if (ogm->hdr.streamtype[0] == 't') {
+        GstTagList *tags;
+
+        tags = gst_tag_list_from_vorbiscomment_buffer (buffer,
+            (guint8 *) "\003vorbis", 7, NULL);
+
+        if (tags) {
+          GST_DEBUG_OBJECT (ogm, "tags = %" GST_PTR_FORMAT, tags);
+          gst_element_found_tags_for_pad (GST_ELEMENT (ogm), ogm->srcpad, tags);
+        } else {
+          GST_DEBUG_OBJECT (ogm, "failed to extract tags from vorbis comment");
+        }
+      }
       break;
+    }
     default:
       if ((data[0] & 0x01) == 0) {
         /* data - push on */
@@ -653,9 +670,10 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer)
           xsize = (xsize << 8) | data[n];
         }
 
-        GST_DEBUG_OBJECT (ogm,
+        GST_LOG_OBJECT (ogm,
             "[0x%02x] samples: %d, hdrbytes: %d, datasize: %d",
             data[0], xsize, len, size - len - 1);
+
         sbuf = gst_buffer_create_sub (buf, len + 1, size - len - 1);
         if (GST_BUFFER_OFFSET_END_IS_VALID (buf)) {
           ogm->next_granulepos = GST_BUFFER_OFFSET_END (buf);