orchetect / TimecodeKit

The definitive SMPTE timecode library for Swift.
MIT License
91 stars 8 forks source link

Negative rational values #56

Closed orchetect closed 1 year ago

orchetect commented 1 year ago

In Final Cut Pro XML (FCPXML) it's possible to encounter "negative" time values.

<chapter-marker start="14417/4s" duration="100/2400s" value="Chapter 1" posterOffset="-80163/720000s"/>

In this case, a chapter marker inserted on a clip has a thumbnail location (posterOffset) that is earlier on the timeline than the marker's position. It's expressed as the delta distance (offset) from the marker's position. In this case, with an additional negative "-" sign prior to it.

This would be formed in TimecodeKit by constructing Fraction(-80163, 720000)

Timecode should be able to process negative rational times and return an instance of TimecodeInterval in the event the time is negative.

orchetect commented 1 year ago
orchetect commented 1 year ago

Done. Will be in 1.6.3 release.