+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:
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) {
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)
{
/* 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;