Commit 3219b704 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

subparse: fix pushing out of last chunk if last line has no newline

With playbin the last subtitle chunk would not get displayed
if the last chunk was missing a newline at the end. This is
because streamsynchronizer will hold back the EOS event until
the audio and video streams are finished too, so subparse
would never forcefully push out the last chunk until the very
end when it is too late.

We get a STREAM_GROUP_DONE event from streamsynchronizer however,
so handle that like EOS and force out any remaining text then.
parent 63a83768
......@@ -1841,9 +1841,10 @@ gst_sub_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
GstSubParse *self = GST_SUBPARSE (parent);
gboolean ret = FALSE;
GST_DEBUG ("Handling %s event", GST_EVENT_TYPE_NAME (event));
GST_LOG_OBJECT (self, "%s event", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) {
/* Make sure the last subrip chunk is pushed out even
* if the file does not have an empty line at the end */
......@@ -1854,7 +1855,9 @@ gst_sub_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
gchar term_chars[] = { '\n', '\n', '\0' };
GstBuffer *buf = gst_buffer_new_and_alloc (2 + 1);
GST_DEBUG ("EOS. Pushing remaining text (if any)");
GST_DEBUG_OBJECT (self, "%s: force pushing of any remaining text",
gst_buffer_fill (buf, 0, term_chars, 3);
gst_buffer_set_size (buf, 2);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment