mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
subparse: Allow . instead of , as millisecond delimiter in srt subtitles
Fixes bug #591207.
This commit is contained in:
parent
0021e6b765
commit
88a55e6dae
1 changed files with 5 additions and 3 deletions
|
@ -831,11 +831,13 @@ parse_subrip_time (const gchar * ts_string, GstClockTime * t)
|
||||||
* hh:mm:ss, 5 = 50ms
|
* hh:mm:ss, 5 = 50ms
|
||||||
* hh:mm:ss, 50 = 50ms
|
* hh:mm:ss, 50 = 50ms
|
||||||
* hh:mm:ss,5 = 500ms
|
* 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
|
* the white spaces within the timestamp to '0' (I'm sure there's a
|
||||||
* way to make sscanf() do this for us, but how?)
|
* way to make sscanf() do this for us, but how?)
|
||||||
*/
|
*/
|
||||||
g_strdelimit (s, " ", '0');
|
g_strdelimit (s, " ", '0');
|
||||||
|
g_strdelimit (s, ".", ',');
|
||||||
|
|
||||||
/* make sure we have exactly three digits after he comma */
|
/* make sure we have exactly three digits after he comma */
|
||||||
p = strchr (s, ',');
|
p = strchr (s, ',');
|
||||||
|
@ -1125,8 +1127,8 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
||||||
break;
|
break;
|
||||||
case GST_SUB_PARSE_REGEX_SUBRIP:
|
case GST_SUB_PARSE_REGEX_SUBRIP:
|
||||||
result = (gpointer) g_regex_new ("^([ 0-9]){0,3}[0-9]\\s*(\x0d)?\x0a"
|
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);
|
0, 0, &gerr);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
||||||
|
|
Loading…
Reference in a new issue