ext/ogg/: Extract language tags from ogm subtitle streams, so that the subtitle menu choices are labelled correctly in

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).
This commit is contained in:
Tim-Philipp Müller 2006-06-14 14:34:28 +00:00
parent cc8455bce2
commit c253cabc86
3 changed files with 30 additions and 3 deletions

View file

@ -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> 2006-06-14 Wim Taymans <wim@fluendo.com>
Patch by: Alessandro Decina <alessandro at nnva dot org> Patch by: Alessandro Decina <alessandro at nnva dot org>

View file

@ -10,6 +10,7 @@ libgstogg_la_SOURCES = \
libgstogg_la_CFLAGS = $(GST_CFLAGS) $(OGG_CFLAGS) libgstogg_la_CFLAGS = $(GST_CFLAGS) $(OGG_CFLAGS)
libgstogg_la_LIBADD = \ libgstogg_la_LIBADD = \
$(top_builddir)/gst-libs/gst/riff/libgstriff-$(GST_MAJORMINOR).la \ $(top_builddir)/gst-libs/gst/riff/libgstriff-$(GST_MAJORMINOR).la \
$(top_builddir)/gst-libs/gst/tag/libgsttag-$(GST_MAJORMINOR).la \
$(GST_BASE_LIBS) \ $(GST_BASE_LIBS) \
$(OGG_LIBS) $(OGG_LIBS)
libgstogg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstogg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -26,6 +26,7 @@
#include <string.h> #include <string.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/tag/tag.h>
#include <gst/riff/riff-media.h> #include <gst/riff/riff-media.h>
GST_DEBUG_CATEGORY_STATIC (gst_ogm_parse_debug); GST_DEBUG_CATEGORY_STATIC (gst_ogm_parse_debug);
@ -633,9 +634,25 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer)
} }
break; break;
} }
case 0x03: case 0x03:{
/* comment - unused */ /* 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; break;
}
default: default:
if ((data[0] & 0x01) == 0) { if ((data[0] & 0x01) == 0) {
/* data - push on */ /* data - push on */
@ -653,9 +670,10 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer)
xsize = (xsize << 8) | data[n]; xsize = (xsize << 8) | data[n];
} }
GST_DEBUG_OBJECT (ogm, GST_LOG_OBJECT (ogm,
"[0x%02x] samples: %d, hdrbytes: %d, datasize: %d", "[0x%02x] samples: %d, hdrbytes: %d, datasize: %d",
data[0], xsize, len, size - len - 1); data[0], xsize, len, size - len - 1);
sbuf = gst_buffer_create_sub (buf, len + 1, size - len - 1); sbuf = gst_buffer_create_sub (buf, len + 1, size - len - 1);
if (GST_BUFFER_OFFSET_END_IS_VALID (buf)) { if (GST_BUFFER_OFFSET_END_IS_VALID (buf)) {
ogm->next_granulepos = GST_BUFFER_OFFSET_END (buf); ogm->next_granulepos = GST_BUFFER_OFFSET_END (buf);