From c253cabc861a0db7ae2fc55c612e9d224310c939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 14 Jun 2006 14:34:28 +0000 Subject: [PATCH] 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). --- ChangeLog | 8 ++++++++ ext/ogg/Makefile.am | 1 + ext/ogg/gstogmparse.c | 24 +++++++++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 711c02af8e..fa3775dd99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-06-14 Tim-Philipp Müller + + * 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 Patch by: Alessandro Decina diff --git a/ext/ogg/Makefile.am b/ext/ogg/Makefile.am index c28930148c..174712c696 100644 --- a/ext/ogg/Makefile.am +++ b/ext/ogg/Makefile.am @@ -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) diff --git a/ext/ogg/gstogmparse.c b/ext/ogg/gstogmparse.c index d903838e9d..0fd207f9aa 100644 --- a/ext/ogg/gstogmparse.c +++ b/ext/ogg/gstogmparse.c @@ -26,6 +26,7 @@ #include #include +#include #include 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);