From 66ece9b25e9d34ff3f2c60f81bfa6e7ec9760cf2 Mon Sep 17 00:00:00 2001 From: Mantas Date: Tue, 16 Jan 2024 15:27:05 +0200 Subject: [PATCH] Add additional ttml timestamp format --- src/Code/Converters/TtmlConverter.php | 2 ++ tests/formats/TtmlTest.php | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Code/Converters/TtmlConverter.php b/src/Code/Converters/TtmlConverter.php index ea784ea..4925f38 100644 --- a/src/Code/Converters/TtmlConverter.php +++ b/src/Code/Converters/TtmlConverter.php @@ -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 diff --git a/tests/formats/TtmlTest.php b/tests/formats/TtmlTest.php index 228ff3a..61d4c97 100644 --- a/tests/formats/TtmlTest.php +++ b/tests/formats/TtmlTest.php @@ -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], ]; }