From: Nicolas Dufresne Date: Thu, 1 Sep 2011 00:51:17 +0000 (-0400) Subject: subparse: Improve subrip type check regex X-Git-Tag: 1.19.3~511^2~6555^2~500 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25939e02183e9a9420d02c3f2c3ddcd3fe83cd65;p=platform%2Fupstream%2Fgstreamer.git subparse: Improve subrip type check regex This patch prevents timestamp like "1 1:00:00", which would have been seen as hour 101 by our parser, and allow single digit hour, minute and seconds as it's already supported by the parser, and also by other implementation like in mplayer. This fixes bug 657872. https://bugzilla.gnome.org/show_bug.cgi?id=657872 --- diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 8d495f0..240ef58 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -1246,9 +1246,9 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype) } break; case GST_SUB_PARSE_REGEX_SUBRIP: - result = (gpointer) g_regex_new ("^([ 0-9]){0,3}[0-9]\\s*(\x0d)?\x0a" - "[ 0-9][0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]" - " +--> +([ 0-9])?[0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]", + result = (gpointer) g_regex_new ("^ {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); if (result == NULL) { g_warning ("Compilation of subrip regex failed: %s", gerr->message);