diff --git a/ChangeLog b/ChangeLog index 82fdb21f78..f32f5a2e06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +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): diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 064ab0ff73..5379e8ca44 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,