Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1
0.1.2
13 changes: 12 additions & 1 deletion modules/media.timeline_preview.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,18 @@ export namespace epochengine::media::timeline_preview
return last;
if (!(frame > 0.0))
return 0u;
return (std::min)(static_cast<std::uint64_t>(frame), last);
auto index = (std::min)(static_cast<std::uint64_t>(frame), last);
const auto rate = state.source->frame_rate;
const auto frame_start = [rate](std::uint64_t frame_index) noexcept {
return static_cast<double>(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
Expand Down
17 changes: 17 additions & 0 deletions tests/media.timeline_preview_contract.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: MPL-2.0

#include <cmath>
#include <cstdint>
#include <limits>
#include <optional>

import media.timeline_preview;

Expand Down Expand Up @@ -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<double>(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<double>(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
Loading