From 3127a32c1c734681bfc6fcdcd23e06ff1db8f266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 30 May 2007 14:38:59 +0000 Subject: [PATCH] gst/avi/gstavidemux.*: Parse subtitle text streams instead of erroring out (#442034). Still needs a parser for the su... Original commit message from CVS: * gst/avi/gstavidemux.c: (gst_avi_demux_base_init), (gst_avi_demux_reset), (gst_avi_demux_parse_stream): * gst/avi/gstavidemux.h: Parse subtitle text streams instead of erroring out (#442034). Still needs a parser for the subtitles to actually show up. --- ChangeLog | 8 ++++++++ gst/avi/gstavidemux.c | 23 +++++++++++++++++++++-- gst/avi/gstavidemux.h | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c85b07589..f4720532e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-05-30 Tim-Philipp Müller + + * gst/avi/gstavidemux.c: (gst_avi_demux_base_init), + (gst_avi_demux_reset), (gst_avi_demux_parse_stream): + * gst/avi/gstavidemux.h: + Parse subtitle text streams instead of erroring out (#442034). Still + needs a parser for the subtitles to actually show up. + 2007-05-30 Tim-Philipp Müller * gst/avi/gstavidemux.c: (gst_avi_demux_push_event), diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 54ecb12e76..a40c5a2234 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -142,8 +142,8 @@ gst_avi_demux_base_init (GstAviDemuxClass * klass) "Wim Taymans \n" "Ronald Bultje "); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - GstPadTemplate *videosrctempl, *audiosrctempl; - GstCaps *audcaps, *vidcaps; + GstPadTemplate *videosrctempl, *audiosrctempl, *subsrctempl; + GstCaps *audcaps, *vidcaps, *subcaps; audcaps = gst_riff_create_audio_template_caps (); gst_caps_append (audcaps, gst_caps_new_simple ("audio/x-avi-unknown", NULL)); @@ -156,8 +156,12 @@ gst_avi_demux_base_init (GstAviDemuxClass * klass) videosrctempl = gst_pad_template_new ("video_%02d", GST_PAD_SRC, GST_PAD_SOMETIMES, vidcaps); + subcaps = gst_caps_new_simple ("application/x-subtitle-avi", NULL); + subsrctempl = gst_pad_template_new ("subtitle_%02d", + GST_PAD_SRC, GST_PAD_SOMETIMES, subcaps); gst_element_class_add_pad_template (element_class, audiosrctempl); gst_element_class_add_pad_template (element_class, videosrctempl); + gst_element_class_add_pad_template (element_class, subsrctempl); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_templ)); gst_element_class_set_details (element_class, &gst_avi_demux_details); @@ -235,6 +239,7 @@ gst_avi_demux_reset (GstAviDemux * avi) avi->num_streams = 0; avi->num_v_streams = 0; avi->num_a_streams = 0; + avi->num_t_streams = 0; avi->state = GST_AVI_DEMUX_START; avi->offset = 0; @@ -1210,6 +1215,12 @@ gst_avi_demux_parse_stream (GstAviDemux * avi, GstBuffer * buf) &stream->strf.iavs, &stream->extradata); GST_DEBUG_OBJECT (element, "marking iavs as VBR, res %d", res); break; + case GST_RIFF_FCC_txts: + /* nothing to parse here */ + stream->is_vbr = (stream->strh->samplesize == 0) + && (stream->strh->scale > 1); + res = TRUE; + break; default: GST_ERROR_OBJECT (avi, "Don´t know how to handle stream type %" GST_FOURCC_FORMAT, @@ -1323,6 +1334,14 @@ gst_avi_demux_parse_stream (GstAviDemux * avi, GstBuffer * buf) avi->num_v_streams++; break; } + case GST_RIFF_FCC_txts:{ + padname = g_strdup_printf ("subtitle_%02d", avi->num_t_streams); + templ = gst_element_class_get_pad_template (klass, "subtitle_%02d"); + caps = gst_caps_new_simple ("application/x-subtitle-avi", NULL); + tag_name = NULL; + avi->num_t_streams++; + break; + } default: g_assert_not_reached (); } diff --git a/gst/avi/gstavidemux.h b/gst/avi/gstavidemux.h index 599ef9e4c8..cdaf9b9f88 100644 --- a/gst/avi/gstavidemux.h +++ b/gst/avi/gstavidemux.h @@ -142,6 +142,7 @@ typedef struct _GstAviDemux { guint num_streams; guint num_v_streams; guint num_a_streams; + guint num_t_streams; /* subtitle text streams */ avi_stream_context stream[GST_AVI_DEMUX_MAX_STREAMS];