Skip to content

Commit

Permalink
Add additional ttml timestamp format
Browse files Browse the repository at this point in the history
  • Loading branch information
mantas-done committed Jan 16, 2024
1 parent 8c3e906 commit 66ece9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Code/Converters/TtmlConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public static function ttmlTimeToInternal($ttml_time, $frame_rate)

if (substr($ttml_time, -1) === 't') { // 340400000t
return substr($ttml_time, 0, -1) / 10000000;
} elseif (substr($ttml_time, -2) === 'ms') { // 1500ms
return rtrim($ttml_time, 'ms') / 1000;
} elseif (substr($ttml_time, -1) === 's') { // 1234s
return rtrim($ttml_time, 's');
} elseif (substr($ttml_time, -1) === 'f' && $frame_rate) { // 24f
Expand Down
1 change: 1 addition & 0 deletions tests/formats/TtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public static function timeFormatProvider()
['55s', 55, null],
['8500', 8.5, null],
['03:45.702', 225.702, null],
['1500ms', 1.5, null],
];
}

Expand Down

0 comments on commit 66ece9b

Please sign in to comment.