From af71c29bcf019b8c5e5cfd1703744e15897b918d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 24 Apr 2012 10:13:08 +0200 Subject: [PATCH] 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. --- gst/subparse/gstsubparse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 9c31b549fd..0b5df1f237 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -1244,7 +1244,8 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype) } break; case GST_SUB_PARSE_REGEX_SUBRIP: - result = (gpointer) g_regex_new ("^ {0,3}[ 0-9]{1,4}\\s*(\x0d)?\x0a" + result = (gpointer) + g_regex_new ("^[\\s\\n]*[\\n]? {0,3}[ 0-9]{1,4}\\s*(\x0d)?\x0a" " ?[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,3}" " +--> +[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,2}", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);