From ee90cf19697ea5356d544d56ae2bb9b2d3c45395 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 3 May 2008 15:39:04 +0000 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ gst/subparse/gstsubparse.c | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) 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, -- 2.7.4