From: Sebastian Dröge Date: Sun, 9 Aug 2009 10:13:16 +0000 (+0200) Subject: subparse: Allow . instead of , as millisecond delimiter in srt subtitles X-Git-Tag: 1.19.3~511^2~9346 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=88a55e6daec414916b74ba8cf688e914e2c6dfef;p=platform%2Fupstream%2Fgstreamer.git subparse: Allow . instead of , as millisecond delimiter in srt subtitles Fixes bug #591207. --- diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index b319f70..eb6c904 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -831,11 +831,13 @@ parse_subrip_time (const gchar * ts_string, GstClockTime * t) * hh:mm:ss, 5 = 50ms * hh:mm:ss, 50 = 50ms * hh:mm:ss,5 = 500ms - * and sscanf() doesn't differentiate between ' 5' and '5' so munge + * and the same with . instead of ,. + * sscanf() doesn't differentiate between ' 5' and '5' so munge * the white spaces within the timestamp to '0' (I'm sure there's a * way to make sscanf() do this for us, but how?) */ g_strdelimit (s, " ", '0'); + g_strdelimit (s, ".", ','); /* make sure we have exactly three digits after he comma */ p = strchr (s, ','); @@ -1125,8 +1127,8 @@ 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]", + "[ 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]", 0, 0, &gerr); if (result == NULL) { g_warning ("Compilation of subrip regex failed: %s", gerr->message);