]> granicus.if.org Git - handbrake/commitdiff
decsrtsub: support timecodes that use '.' for fractions
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 7 Nov 2018 17:31:35 +0000 (09:31 -0800)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 7 Nov 2018 17:31:35 +0000 (09:31 -0800)
The convention is to use ',' for fractions in SRT files.  But
opensubtitles.com is distributing files that use '.'

libhb/decsrtsub.c

index d5c17c27eef92890cecd3de33e23a66cb3eed16a..f6482525cc788ed94fd4c03a1e6e3b5a8a280ebb 100644 (file)
@@ -225,7 +225,13 @@ read_time_from_string( const char* timeString, struct start_and_end *result )
                     &houres2, &minutes2, &seconds2, &milliseconds2);
     if (scanned != 8)
     {
-        return 0;
+        scanned = sscanf(timeString, "%ld:%ld:%ld.%ld --> %ld:%ld:%ld.%ld\n",
+                        &houres1, &minutes1, &seconds1, &milliseconds1,
+                        &houres2, &minutes2, &seconds2, &milliseconds2);
+        if (scanned != 8)
+        {
+            return 0;
+        }
     }
     result->start =
         milliseconds1 + seconds1*1000 + minutes1*60*1000 + houres1*60*60*1000;