Repository navigation
[Backport][TTML] Fix clock-time fractional seconds parsing - #2126
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CastagnaIT
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes parsing of clock-time expressions with fractional seconds (
hh:mm:ss.fraction) inTTML2SRT::GetTime. The digits after the decimal point were added to the timestamp as a raw integer, without taking their count orm_timescaleinto account. The fraction is now parsed as digits, padded to 9 digits (nanosecond precision, longer fractions are truncated) and scaled bym_timescale. Plainhh:mm:sswithout a fraction is handled by its own branch.backport PR #2125
Motivation and context
The TTML2 clock-time grammar allows
hh:mm:ss.fraction, where the fraction is a fraction of a second with any number of digits. The old code treated the digits as an integer count of timescale units:00:00:01.5gave 1 s + 5 units instead of 1.5 s.05and.5both parsed to 5, so leading zeros were lostThis resulted in wrong cue timings for TTML subtitles with fractional seconds, whenever the fraction did not have exactly 3 digits or the timescale was not 1000.
How has this been tested?
Checked the parsing by hand with
m_timescale = 1000andm_timescale = 90000:00:00:01.500:00:01.0500:00:01.05000:00:01.500:00:01Tested with real TTML Dash in VRT MAX Add-on: https://github.com/add-ons/plugin.video.vrt.nu
Screenshots (if appropriate):
Types of change
Checklist:
Summary by CodeRabbit