1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibVideo: Give Matroska duration an absolute value getter

Previously, the duration had to be multiplied by timestamp_scale and
converted to a Time object, now SegmentInformation::duration() does it
itself.
This commit is contained in:
Zaggy1024 2022-11-13 19:13:50 -06:00 committed by Andreas Kling
parent a58bf7c3d1
commit 2a9fb8b439
3 changed files with 13 additions and 9 deletions

View file

@ -82,10 +82,8 @@ DecoderErrorOr<NonnullOwnPtr<Sample>> MatroskaDemuxer::get_next_sample_for_track
DecoderErrorOr<Time> MatroskaDemuxer::duration()
{
auto segment_information = TRY(m_reader.segment_information());
if (!segment_information.duration().has_value())
return Time::zero();
return Time::from_nanoseconds(static_cast<i64>(segment_information.duration().value() * segment_information.timestamp_scale()));
auto duration = TRY(m_reader.segment_information()).duration();
return duration.value_or(Time::zero());
}
}