mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibMedia: Demux videos with FFmpeg
This gives us access to container types other than Matroska, the biggest one being MP4.
This commit is contained in:
parent
3412935a62
commit
b789ba5e5f
Notes:
github-actions[bot]
2025-03-13 18:34:55 +00:00
Author: https://github.com/Lubrsi
Commit: b789ba5e5f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3892
Reviewed-by: https://github.com/ADKaster
12 changed files with 358 additions and 29 deletions
|
@ -49,7 +49,7 @@ DecoderErrorOr<Vector<Track>> MatroskaDemuxer::get_tracks_for_type(TrackType typ
|
|||
switch (type) {
|
||||
case TrackType::Video:
|
||||
if (auto video_track = track_entry.video_track(); video_track.has_value())
|
||||
track.set_video_data({ TRY(duration()), video_track->pixel_width, video_track->pixel_height });
|
||||
track.set_video_data({ TRY(duration(track)), video_track->pixel_width, video_track->pixel_height });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -148,10 +148,11 @@ DecoderErrorOr<Sample> MatroskaDemuxer::get_next_sample_for_track(Track track)
|
|||
status.frame_index = 0;
|
||||
}
|
||||
auto cicp = TRY(m_reader.track_for_track_number(track.identifier()))->video_track()->color_format.to_cicp();
|
||||
return Sample(status.block->timestamp(), status.block->frame(status.frame_index++), VideoSampleData(cicp));
|
||||
auto sample_data = DECODER_TRY_ALLOC(ByteBuffer::copy(status.block->frame(status.frame_index++)));
|
||||
return Sample(status.block->timestamp(), move(sample_data), VideoSampleData(cicp));
|
||||
}
|
||||
|
||||
DecoderErrorOr<AK::Duration> MatroskaDemuxer::duration()
|
||||
DecoderErrorOr<AK::Duration> MatroskaDemuxer::duration(Track)
|
||||
{
|
||||
auto duration = TRY(m_reader.segment_information()).duration();
|
||||
return duration.value_or(AK::Duration::zero());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue