Skip to content

v0.2.1 — Frame-accurate timing + polish

Choose a tag to compare

@SteliyanH SteliyanH released this 26 Apr 17:22
· 241 commits to main since this release
a7e3294

Polish patch in response to community feedback on v0.2.0. Same v0.2.0 feature surface (transitions, speed, ducking), with frame-accurate timing throughout the API and full DocC documentation.

Highlights

  • Frame-accurate timing. Every time-related API now accepts CMTime for frame-precise edits, with TimeInterval retained as ergonomic overloads. Engine arithmetic operates in CMTime end-to-end (fade halving via CMTimeMultiplyByRatio, validation via CMTimeCompare).
  • DocC across the public surface. New FrameAccuracy catalog article explains when to reach for CMTime vs TimeInterval, the wall-clock vs media-time distinction, and the engine's precision guarantees.
  • API consistency. VideoClip.trimmed argument labels unified across overloads (both forms now use to:).
  • Better diagnostics. Transition validation emits a specific error when an adjacent clip is an untrimmed VideoClip, pointing the user at .trimmed(to:).
  • Tests: 80 → 103 (new CMTimeAPITests and EdgeCasesTests suites — precision round-trips, mixed-timescale CMTime, speed × reverse, speed × dissolve, boundary clip durations, multi-track ducking).

Frame-accurate now possible

// Before v0.2.1: 1.0/30.0 = 0.03333… (binary fraction, never exactly 1 frame)
// Now: exact 1 frame at 30fps, no float drift
Transition.fade(duration: CMTime(value: 1, timescale: 30))

// Trim by frame count
clip.trimmed(to: CMTimeRange(
    start:    CMTime(value: 30, timescale: 30),     // exactly second 1
    duration: CMTime(value: 90, timescale: 30)      // exactly 3 seconds
))

Existing TimeInterval call sites continue to work unchanged via static factory overloads:

clip.trimmed(to: 0...10)
Transition.fade(duration: 0.5)

Breaking changes (pre-1.0)

  • Pattern-matching Transition cases (case .fade(let d)) now binds d: CMTime instead of d: TimeInterval. All non-pattern-matching call sites continue to work unchanged.

Component PRs

Theme PR
CMTime API surface (community feedback) #11
trimmed(to:) argument label consistency #12
DocC docs + FrameAccuracy article #13
Edge-case bug bash + improved validation error #14

See CHANGELOG.md for the full entry.