gst-plugins-base: subparse: Allow newlines/ whitespace at the beginning of subrip files
Sebastian Dröge
slomo at kemper.freedesktop.org
Tue Apr 24 01:17:03 PDT 2012
Module: gst-plugins-base
Branch: master
Commit: ecb715682271f9e93b751e891f7288357af1a106
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=ecb715682271f9e93b751e891f7288357af1a106
Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date: Tue Apr 24 10:13:08 2012 +0200
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 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c
index 3f4ee18..fa98efd 100644
--- a/gst/subparse/gstsubparse.c
+++ b/gst/subparse/gstsubparse.c
@@ -1211,7 +1211,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);
More information about the gstreamer-commits
mailing list