mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17: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:
parent
a58bf7c3d1
commit
2a9fb8b439
3 changed files with 13 additions and 9 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue