`Timecode.FrameRate`: Add failable init from rational frame rate (fraction)
orchetect opened this issue · 3 comments
Timecode.FrameRate
provides a fraction
property that returns a numerator and denominator.
These values are used for encoding frame rate into various file formats such as AAF and Final Cut Pro XML.
It would make sense to add a failable init that can accept these values. Since a drop rate cannot be inferred from a fraction alone, it must be specified imperatively as a boolean flag.
extension Timecode.FrameRate {
public init?(numerator: Int, denominator: Int, drop: Bool) { }
}
Added and pushed to main branch. Will be in next release.
Reopening.
Current implementation is limited to the fraction integer literals. The rate should be derived from evaluating the fraction instead, since different file formats (AAF, FCP XML, etc.) may encode these fractions with different powers of 10.
Implemented refactor. Will be in next release.