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.
This commit is contained in:
Tim-Philipp Müller 2008-05-03 15:39:04 +00:00
parent 6de5983831
commit ee90cf1969
2 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2008-05-03 Tim-Philipp Müller <tim.muller at collabora co uk>
* 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 <tim.muller at collabora co uk>
* gst/typefind/gsttypefindfunctions.c: (mpeg_video_stream_type_find):

View file

@ -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,