Commit graph

151 commits

Author SHA1 Message Date
Hosang Lee
5726a66fdb subparse: lower text buffer threshold
It is possible for subtitle files to have a string length less than 30.
WebVTT for example may contain only the 'WEBVTT' string in the file
without any cues.
As an example in hls streams, since WEBVTT files can be segmented
like video/audio, some subtitle segments may only contain just the
header string.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/708>
2020-06-22 05:46:13 +00:00
Mathieu Duponchelle
caca46e0e6 subparse: convert from pango-markup to utf8 ..
when downstream requires it
2020-03-27 15:27:06 +00:00
Mathieu Duponchelle
0739fafd62 subparse: accept WebVTT timestamps without an hour component
https://www.w3.org/TR/webvtt1/#webvtt-timestamp

mm:ss,000 is a valid WebVTT timestamp
2020-03-11 05:44:23 +00:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Antonio Ospite
1c454fdafc 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.
2019-05-06 13:28:02 +02:00
Jordan Petridis
5396ef6e45 subparse: do not assert when failing to parse subrip timestamp
If a badly formatted was passed into `parse_subrip_time` it would
assert instead of exiting gracefully. This is problematic since
the input is provided by the user, and will trigger a crash.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/532
2019-01-14 11:43:57 +00:00
Edward Hervey
3ac37bbe67 subparse: Don't read beyond array
If num_open_tags is 0, we shouldn't try to get the "last" open tag
since there isn't any.
2018-05-30 11:39:40 +02:00
Philippe Normand
b7e8d1657d subparse: follow-up build fix after d871b1205 2018-05-12 17:21:01 +01:00
Philippe Normand
8cfd85ec61 subparse: support for more than 32 unclosed markup tags
https://bugzilla.gnome.org/show_bug.cgi?id=796043
2018-05-12 17:05:06 +01:00
Tim-Philipp Müller
3219b704fd 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
2018-01-25 18:42:08 +00:00
Mark Nauwelaerts
dac113a867 subparse: ensure serialized sending of segment event at proper time 2017-06-25 22:25:40 +02:00
Tim-Philipp Müller
92786741df subparse: fix some leaks
Fixes check-valgrind for subparse test.
2016-07-19 13:26:06 +01:00
Víctor Manuel Jáquez Leal
c646c62a02 subparse: don't reset allowed tags
When a discont buffer is processed, the state is re-initialized, which
nullifies the allowed_tags.

The problem is when a subrip string with tags is processed and allowed_tags is
NULL. The function subrip_unescape_formatting() calls g_strjoinv with a
str_array as NULL, leading to a GLib-CRITICAL.

This patch removes the allowed_tags resetting, in parser_state_init(), but
move it into gst_sub_parse_format_autodetect().

https://bugzilla.gnome.org/show_bug.cgi?id=768525
2016-07-07 19:38:07 +02:00
Vincent Penquerc'h
d1ecd3cfa7 subparse: fix build with GCC 4.6.3
gstsubparse.c: In function ‘parse_subrip’:
gstsubparse.c:988:7: error: ignoring return value of ‘strtol’, declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors

https://bugzilla.gnome.org/show_bug.cgi?id=765042
2016-04-15 13:33:41 +01:00
Jan Schmidt
c27df799bf subparse: WebVTT Cue identifiers are optional
Don't require a cue identifier preceding the time range line
when parsing WebVTT. We could also store the CueID, but it's
not using anywhere, so just ignore it for now.
2016-04-06 21:00:10 +10:00
Jan Schmidt
1851777b94 subparse: Add more parsing guards
Insert extra checks for the validity of the incoming
data when parsing subrip/webvtt content and debug log
output for invalid content.

Should fix Coverity warnings.
2016-03-29 22:19:47 +11:00
Luis de Bethencourt
01778c5ac9 subparse: add missing break between formats
A break is missing at the end of case GST_SUB_PARSE_FORMAT_LRC or it will
fallthrough to WebVTT. This fixes commit fd2a14144a.
2016-03-29 11:27:40 +02:00
Jan Schmidt
fd2a14144a subparse: WebVTT parsing support
WebVTT is a new subtitle format for HTML5 video. In this first
version of the parser the cue settings are parsed but only stored in
the internal parser state structure. Later on these settings could be
part of the GstBuffer metadata.

https://bugzilla.gnome.org/show_bug.cgi?id=629764
2016-03-25 00:58:42 +11:00
Vineeth TM
44b70ca3a1 base: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763075
2016-03-24 14:25:41 +02:00
Tim-Philipp Müller
7fb9cd453b subparse: detect closing tags even if there's a space after the slash
</ i> should be handled like </i>

https://bugzilla.gnome.org/show_bug.cgi?id=755875
2015-09-30 18:17:13 +01:00
Eunhae Choi
b1f78b5d23 subparse: use g_clear_error instead of g_error_free
To avoid invalid pointer accees the err pointer should be set to NULL.
By using g_clear_error() it calls free and clear the pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=753817
2015-08-19 16:21:25 +03:00
Tim-Philipp Müller
6020b0cf2b Update mailing list address from sourceforge to freedesktop 2015-07-16 17:17:16 +01:00
Sebastian Dröge
90eb93c2ef Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.
2014-12-01 09:51:12 +01:00
Sebastian Dröge
218d0702c9 subparse: Add support for parsing LRC subtitles
https://bugzilla.gnome.org/show_bug.cgi?id=678590
2013-12-18 15:52:53 +01:00
Sebastian Dröge
bc2342e4ad subparse: Add typefinder for LRC subtitles 2013-12-18 15:52:53 +01:00
Tim-Philipp Müller
5d7125413e subparse: g_memmove() is deprecated
Just use plain memmove(), g_memmove() is deprecated in
recent GLib versions.

https://bugzilla.gnome.org/show_bug.cgi?id=712811
2013-11-21 15:19:47 +00:00
Tim-Philipp Müller
3eea81e4a2 subparse: don't leak parse context for sami and qttext
In gst_sub_parse_dispose() parser_type will be UNKNOWN,
so these deinit calls were never executed. And we should
clean up the parser state in the downwards state change
anyway.
2013-07-16 18:31:46 +01:00
Young-Ho Cha
f597efe24b subparse: remove libxml dependency for sami parser and re-enable sami parser
To celebrate 2013.gnome.asia, updated sami parser for gstreamer 1.x. :D

Remove conditional block for check libxml usage and
implement a simple html markup parser for the sami
parser.

https://bugzilla.gnome.org/show_bug.cgi?id=693056
2013-07-16 18:04:02 +01:00
Sebastian Dröge
b19d64d785 subparse/ssaparse: Fix event handling and order 2013-05-10 12:21:31 +02:00
Arnaud Vrac
4816885ce3 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
2013-03-22 11:09:11 +00:00
Tim-Philipp Müller
6549db36cd subparse: fix GError leak 2012-12-16 12:34:14 +00:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Edward Hervey
5f4bd0a4e8 subparse: Call default query handler 2012-09-11 16:29:21 +02:00
Tim-Philipp Müller
7c2e7b1a4f text/plain + text/x-pango-markup -> text/x-raw 2012-09-02 02:45:41 +01:00
Sebastian Dröge
99d73c94e9 tag: Update for taglist/tag event API changes 2012-07-28 00:35:02 +02:00
Wim Taymans
a2172bdb4b update for tag event change 2012-06-06 13:05:47 +02:00
Sebastian Dröge
ecb7156822 subparse: Allow newlines/whitespace at the beginning of subrip files
For example the Sintel subtitles have this and without this change
they're detected as text/plain and not usable as subtitles. The
parser itself already handles this just fine.
2012-04-24 10:16:45 +02:00
Tim-Philipp Müller
3c6a3ad629 Use new gst_element_class_set_static_metadata() 2012-04-10 00:45:16 +01:00
Sebastian Dröge
ad42b16375 gst: Update for GST_PLUGIN_DEFINE() API change 2012-04-05 15:11:05 +02:00
Tim-Philipp Müller
c61f794fc2 typefindfunctions, subparse: fix for gst_type_find_register() API change 2012-02-02 01:35:21 +00:00
Vincent Penquerc'h
2de0a62381 subparse: factor memory freeing 2012-01-25 11:45:24 +00:00
Vincent Penquerc'h
17ea0308cf subparse: fix parsing by not misusing non time segments
A simple filesrc ! subparse ! fakesink type pipeline now works again.
2012-01-25 11:45:24 +00:00
Wim Taymans
fcdc385aa1 port to new map API 2012-01-25 12:30:53 +01:00
Wim Taymans
e302833e65 add parent to pad functions 2011-11-17 12:48:25 +01:00
Wim Taymans
2202511e77 add parent to query function 2011-11-16 17:25:17 +01:00
Wim Taymans
e338792ab0 update for adapter api changes 2011-11-10 18:32:39 +01:00
Wim Taymans
a5fa136c0b update for tag API removal 2011-11-02 12:11:16 +01:00
Tim-Philipp Müller
5ee51e47a1 ext, gst, gst-libs, tests: update for tag list API changes 2011-10-31 14:22:39 +00:00
Wim Taymans
06311362e9 fix compilation 2011-10-27 17:26:58 +02:00
Wim Taymans
f1088ed647 update for UNEXPECTED -> EOS flowreturn 2011-10-10 11:39:52 +02:00