summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-01-25 18:39:11 +0000
committerTim-Philipp Müller <tim@centricular.com>2018-01-26 11:13:36 +0000
commitfc4187977b26b80127ce07a36bf838a97b228284 (patch)
tree3aac11a51eb1b8995099684fc7c9eff28744fe78
parentd00968b05102059c900f79b03b57ed3d54b621af (diff)
downloadgstreamer-plugins-base-fc4187977b26b80127ce07a36bf838a97b228284.tar.gz
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. https://bugzilla.gnome.org/show_bug.cgi?id=771853
-rw-r--r--gst/subparse/gstsubparse.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c
index f61c6d4e6..4cd947831 100644
--- a/gst/subparse/gstsubparse.c
+++ b/gst/subparse/gstsubparse.c
@@ -1839,9 +1839,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)) {
+ case GST_EVENT_STREAM_GROUP_DONE:
case GST_EVENT_EOS:{
/* Make sure the last subrip chunk is pushed out even
* if the file does not have an empty line at the end */
@@ -1852,7 +1853,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_EVENT_TYPE_NAME (event));
+
gst_buffer_fill (buf, 0, term_chars, 3);
gst_buffer_set_size (buf, 2);