1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

LibVideo: Calculate Block timestamps for Matroska according to spec

Tracks have a timestamp scale value that should be present which scales
each block's timestamp offset to allow video to be synced with audio.
They should also contain a CodecDelay element and may also contain a
TrackOffset that offsets the block timestamps.
This commit is contained in:
Zaggy1024 2022-11-12 13:09:07 -06:00 committed by Andreas Kling
parent ceb7632862
commit a58bf7c3d1
4 changed files with 49 additions and 12 deletions

View file

@ -80,12 +80,12 @@ public:
private:
friend class Reader;
SampleIterator(RefPtr<Core::MappedFile> file, ReadonlyBytes data, u64 track_id, size_t position, u64 timestamp_scale)
SampleIterator(RefPtr<Core::MappedFile> file, ReadonlyBytes data, TrackEntry track, u64 timestamp_scale, size_t position)
: m_file(move(file))
, m_data(data)
, m_track_id(track_id)
, m_track(move(track))
, m_segment_timestamp_scale(timestamp_scale)
, m_position(position)
, m_timestamp_scale(timestamp_scale)
{
}
@ -93,12 +93,12 @@ private:
RefPtr<Core::MappedFile> m_file;
ReadonlyBytes m_data;
u64 m_track_id;
TrackEntry m_track;
u64 m_segment_timestamp_scale { 0 };
// Must always point to an element ID or the end of the stream.
size_t m_position { 0 };
u64 m_timestamp_scale { 0 };
Time m_last_timestamp { Time::min() };
Optional<Cluster> m_current_cluster;