subparse: fix off by one offset calculation

Do not use the buffer start offset when it is invalid, otherwise a
discontinuity is detected on the next buffer, and the subtitle parser
reset and some subtitle lines are not shown.

Also remove unused next_offset field.

https://bugzilla.gnome.org/show_bug.cgi?id=693981
This commit is contained in:
Arnaud Vrac 2013-02-14 01:35:45 +01:00 committed by Tim-Philipp Müller
parent e53f1d3f40
commit 4816885ce3
2 changed files with 1 additions and 6 deletions

View file

@ -302,8 +302,6 @@ gst_sub_parse_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT, GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
&self->segment); &self->segment);
self->next_offset = 0;
self->need_segment = TRUE; self->need_segment = TRUE;
} else { } else {
GST_WARNING_OBJECT (self, "seek to 0 bytes failed"); GST_WARNING_OBJECT (self, "seek to 0 bytes failed");
@ -1420,8 +1418,7 @@ feed_textbuf (GstSubParse * self, GstBuffer * buf)
* subtitles which are discontinuous by nature. */ * subtitles which are discontinuous by nature. */
} }
self->offset = GST_BUFFER_OFFSET (buf) + gst_buffer_get_size (buf); self->offset += gst_buffer_get_size (buf);
self->next_offset = self->offset;
gst_adapter_push (self->adapter, buf); gst_adapter_push (self->adapter, buf);
@ -1644,7 +1641,6 @@ gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
/* format detection will init the parser state */ /* format detection will init the parser state */
self->offset = 0; self->offset = 0;
self->next_offset = 0;
self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN; self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
self->valid_utf8 = TRUE; self->valid_utf8 = TRUE;
self->first_buffer = TRUE; self->first_buffer = TRUE;

View file

@ -91,7 +91,6 @@ struct _GstSubParse {
/* seek */ /* seek */
guint64 offset; guint64 offset;
guint64 next_offset;
/* Segment */ /* Segment */
GstSegment segment; GstSegment segment;