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.
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);
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;