mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
subparse: fix pushing WebVTT cue when last is not an empty line
If the last WebVTT cue does not have an empty line after it, or if it does not end with a newline at all, it does not get pushed out and it won't be displayed. gst_sub_parse_sink_event() already handles the issue for other subtitle formats, enable handling it for GST_SUB_PARSE_FORMAT_VTT too. While at it also add a test for this case.
This commit is contained in:
parent
f4b054d349
commit
1c454fdafc
2 changed files with 12 additions and 1 deletions
|
@ -1861,7 +1861,8 @@ gst_sub_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
if (self->parser_type == GST_SUB_PARSE_FORMAT_SUBRIP ||
|
||||
self->parser_type == GST_SUB_PARSE_FORMAT_TMPLAYER ||
|
||||
self->parser_type == GST_SUB_PARSE_FORMAT_MPL2 ||
|
||||
self->parser_type == GST_SUB_PARSE_FORMAT_QTTEXT) {
|
||||
self->parser_type == GST_SUB_PARSE_FORMAT_QTTEXT ||
|
||||
self->parser_type == GST_SUB_PARSE_FORMAT_VTT) {
|
||||
gchar term_chars[] = { '\n', '\n', '\0' };
|
||||
GstBuffer *buf = gst_buffer_new_and_alloc (2 + 1);
|
||||
|
||||
|
|
|
@ -476,7 +476,17 @@ GST_START_TEST (test_webvtt)
|
|||
2 * GST_SECOND, 3 * GST_SECOND, "Hello\nWorld"}
|
||||
,
|
||||
};
|
||||
|
||||
/* Test with no newline at the end */
|
||||
SubParseInputChunk webvtt_input2[] = {
|
||||
{
|
||||
"1\n00:00:01,000 --> 00:00:02,000\nLast cue, no newline at the end",
|
||||
1 * GST_SECOND, 2 * GST_SECOND, "Last cue, no newline at the end"}
|
||||
,
|
||||
};
|
||||
|
||||
test_vtt_do_test (webvtt_input, 0, G_N_ELEMENTS (webvtt_input));
|
||||
test_vtt_do_test (webvtt_input2, 0, G_N_ELEMENTS (webvtt_input2));
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
Loading…
Reference in a new issue