From: Tim-Philipp Müller Date: Sat, 3 May 2008 15:39:04 +0000 (+0000) Subject: gst/subparse/gstsubparse.c: Fix detection of discontinuities based on the buffer... X-Git-Tag: 1.19.3~511^2~10524 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee90cf19697ea5356d544d56ae2bb9b2d3c45395;p=platform%2Fupstream%2Fgstreamer.git gst/subparse/gstsubparse.c: Fix detection of discontinuities based on the buffer offset (doesn't work so well if no b... Original commit message from CVS: * gst/subparse/gstsubparse.c: (feed_textbuf): Fix detection of discontinuities based on the buffer offset (doesn't work so well if no buffer offset is set) and also check for the DISCONT buffer flag. This keeps the parser state from being reset after each buffer in the unit test. --- diff --git a/ChangeLog b/ChangeLog index 82fdb21..f32f5a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2008-05-03 Tim-Philipp Müller + * gst/subparse/gstsubparse.c: (feed_textbuf): + Fix detection of discontinuities based on the buffer offset (doesn't work + so well if no buffer offset is set) and also check for the DISCONT buffer + flag. This keeps the parser state from being reset after each buffer in + the unit test. + +2008-05-03 Tim-Philipp Müller + * gst/typefind/gsttypefindfunctions.c: (mpeg_video_stream_type_find): Further fine-tuning: don't absolutely require sequence or GOP headers (as introduced in the previous commit), but adjust the typefind diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 064ab0f..5379e8c 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -1010,11 +1010,25 @@ gst_sub_parse_format_autodetect (GstSubParse * self) static void feed_textbuf (GstSubParse * self, GstBuffer * buf) { - if (GST_BUFFER_OFFSET (buf) != self->offset) { + gboolean discont; + + discont = GST_BUFFER_IS_DISCONT (buf); + + if (GST_BUFFER_OFFSET_IS_VALID (buf) && + GST_BUFFER_OFFSET (buf) != self->offset) { + self->offset = GST_BUFFER_OFFSET (buf); + discont = TRUE; + } + + if (discont) { + GST_INFO ("discontinuity"); /* flush the parser state */ parser_state_init (&self->state); g_string_truncate (self->textbuf, 0); sami_context_reset (&self->state); + /* we could set a flag to make sure that the next buffer we push out also + * has the DISCONT flag set, but there's no point really given that it's + * subtitles which are discontinuous by nature. */ } self->textbuf = g_string_append_len (self->textbuf,