From 0d4751185160ab46a2caf57e2eca4b06d98c62ef Mon Sep 17 00:00:00 2001 From: Epoch Release Automation Date: Sat, 21 Nov 2026 01:31:41 -0500 Subject: [PATCH] Correct fractional-rate frame seeks in 0.1.2 --- CMakeLists.txt | 2 +- README.md | 4 +++- VERSION | 2 +- modules/media.timeline_preview.ixx | 13 ++++++++++++- tests/media.timeline_preview_contract.cpp | 17 +++++++++++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fba74b9..a5116f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.28) -project(EpochMediaEngine VERSION 0.1.1 LANGUAGES CXX) +project(EpochMediaEngine VERSION 0.1.2 LANGUAGES CXX) add_library(epoch_media_engine STATIC ) add_library(Epoch::MediaEngine ALIAS epoch_media_engine) diff --git a/README.md b/README.md index 4f36e2a..2d9adfa 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ rectangle of an equal-sized, row-major frame atlas. The renderer supplies the atlas pixels. The CPU contract checks layout rejection, last-frame clamping, and large loop advances. +Seeking to an exact frame timestamp selects that frame, including 30000/1001 fps material. + ## Source distribution EpochGui accompanies the Media demonstration as a separate public dependency; @@ -35,7 +37,7 @@ composition, not a packaged release or runtime-acceptance claim. The original repository history is retained. First-party source, including the owner-authorized migrated implementation, is MPL-2.0. Historical release licenses -remain unchanged. Current source version is 0.1.1. Native playback acceptance is separate. +remain unchanged. Current source version is 0.1.2. Native playback acceptance is separate. Use EpochGui 0.90.4 (`7761f146b55fa4f78d15c53db5c33385f80f58f9`) and the companion EpochGui Demo atlas source (`0bb44dc85de873f6d5d39948b80f6f4cf6eba74d`). The core contracts diff --git a/VERSION b/VERSION index 17e51c3..d917d3e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.1 +0.1.2 diff --git a/modules/media.timeline_preview.ixx b/modules/media.timeline_preview.ixx index 370fb80..d4ee354 100644 --- a/modules/media.timeline_preview.ixx +++ b/modules/media.timeline_preview.ixx @@ -499,7 +499,18 @@ export namespace epochengine::media::timeline_preview return last; if (!(frame > 0.0)) return 0u; - return (std::min)(static_cast(frame), last); + auto index = (std::min)(static_cast(frame), last); + const auto rate = state.source->frame_rate; + const auto frame_start = [rate](std::uint64_t frame_index) noexcept { + return static_cast(frame_index) * rate.denominator / rate.numerator; + }; + // The rounded FPS product can land on either side of an exact seek + // timestamp. Compare adjacent frame starts in the playhead's units. + if (index > 0u && state.playhead_seconds < frame_start(index)) + --index; + else if (index < last && state.playhead_seconds >= frame_start(index + 1u)) + ++index; + return index; } struct AtlasLayout final diff --git a/tests/media.timeline_preview_contract.cpp b/tests/media.timeline_preview_contract.cpp index 8f6ee58..dae6c60 100644 --- a/tests/media.timeline_preview_contract.cpp +++ b/tests/media.timeline_preview_contract.cpp @@ -1,7 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 +#include #include #include +#include import media.timeline_preview; @@ -46,6 +48,21 @@ int main() || !media::seek(preview, source.duration_seconds) || media::current_frame_index(preview) != source.frame_count - 1) return 8; + + source = media::contract_source(); + source.frame_rate = {30'000, 1'001}; + source.duration_seconds = static_cast(source.frame_count) * 1'001 / 30'000; + if (!media::admit(preview, source, {1, 4})) + return 9; + for (std::uint64_t index = 1; index < source.frame_count; ++index) + { + const double boundary = static_cast(index) * 1'001 / 30'000; + if (!media::seek(preview, std::nextafter(boundary, 0.0)) + || media::current_frame_index(preview) != index - 1u + || !media::seek(preview, boundary) + || media::current_frame_index(preview) != index) + return 9; + } return 0; } #endif