mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
gst/subparse/gstsubparse.c: Some .srt files start with chunk number 0 and not chunk number 1, recognise and accept th...
Original commit message from CVS: Patch by: Robin Stocker <robin dot stocker at gmx dot ch> * gst/subparse/gstsubparse.c: (gst_sub_parse_data_format_autodetect): Some .srt files start with chunk number 0 and not chunk number 1, recognise and accept those as well (fixes #502497). * tests/check/elements/subparse.c: (srt_input), (srt_input0), (test_src): Add unit test for the above.
This commit is contained in:
parent
356971158c
commit
7bbbf15ad8
3 changed files with 27 additions and 1 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2007-12-08 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Patch by: Robin Stocker <robin dot stocker at gmx dot ch>
|
||||
|
||||
* gst/subparse/gstsubparse.c: (gst_sub_parse_data_format_autodetect):
|
||||
Some .srt files start with chunk number 0 and not chunk number 1,
|
||||
recognise and accept those as well (fixes #502497).
|
||||
|
||||
* tests/check/elements/subparse.c: (srt_input), (srt_input0),
|
||||
(test_src):
|
||||
Add unit test for the above.
|
||||
|
||||
2007-12-06 Wim Taymans <wim.taymans@gmail.com>
|
||||
|
||||
* gst/playback/gstplay-enum.c:
|
||||
|
|
|
@ -895,7 +895,7 @@ gst_sub_parse_data_format_autodetect (gchar * match_str)
|
|||
need_init_regexps = FALSE;
|
||||
if ((err = regcomp (&mdvd_rx, "^\\{[0-9]+\\}\\{[0-9]+\\}",
|
||||
REG_EXTENDED | REG_NEWLINE | REG_NOSUB) != 0) ||
|
||||
(err = regcomp (&subrip_rx, "^[1-9]([0-9]){0,3}(\x0d)?\x0a"
|
||||
(err = regcomp (&subrip_rx, "^[0-9]([0-9]){0,3}(\x0d)?\x0a"
|
||||
"[0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9]{3}"
|
||||
" --> [0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9]{3}",
|
||||
REG_EXTENDED | REG_NEWLINE | REG_NOSUB)) != 0) {
|
||||
|
|
|
@ -106,6 +106,17 @@ static SubParseInputChunk srt_input[] = {
|
|||
600 * GST_SECOND, 660 * GST_SECOND, "This is in blue but <5"}
|
||||
};
|
||||
|
||||
/* starts with chunk number 0 (not exactly according to spec) */
|
||||
static SubParseInputChunk srt_input0[] = {
|
||||
{
|
||||
"0\n00:00:01,000 --> 00:00:02,000\nOne\n\n",
|
||||
1 * GST_SECOND, 2 * GST_SECOND, "One"}, {
|
||||
"1\n00:00:02,000 --> 00:00:03,000\nTwo\n\n",
|
||||
2 * GST_SECOND, 3 * GST_SECOND, "Two"}, {
|
||||
"2\n00:00:03,000 --> 00:00:04,000\nThree\n\n",
|
||||
3 * GST_SECOND, 4 * GST_SECOND, "Three"}
|
||||
};
|
||||
|
||||
static void
|
||||
setup_subparse (void)
|
||||
{
|
||||
|
@ -205,6 +216,9 @@ GST_START_TEST (test_srt)
|
|||
|
||||
/* try with empty input, immediate EOS */
|
||||
test_srt_do_test (srt_input, 5, G_N_ELEMENTS (srt_input) - 5);
|
||||
|
||||
/* try with chunk number 0 (which is not exactly according to spec) */
|
||||
test_srt_do_test (srt_input0, 0, G_N_ELEMENTS (srt_input0));
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
Loading…
Reference in a new issue