ladybird/Tests/LibMedia/TestParseMatroska.cpp
Zaggy1024 7c10e1a08d LibMedia: Rename LibVideo to LibMedia
This change is in preparation for implementing audio codecs into the
library and using audio as timing for video playback.
2024-06-19 07:51:55 +02:00

25 lines
941 B
C++

/*
* Copyright (c) 2023, Gregory Bertilson <zaggy1024@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTest/TestCase.h>
#include <LibMedia/Containers/Matroska/Reader.h>
TEST_CASE(master_elements_containing_crc32)
{
auto matroska_reader = MUST(Media::Matroska::Reader::from_file("master_elements_containing_crc32.mkv"sv));
u64 video_track = 0;
MUST(matroska_reader.for_each_track_of_type(Media::Matroska::TrackEntry::TrackType::Video, [&](Media::Matroska::TrackEntry const& track_entry) -> Media::DecoderErrorOr<IterationDecision> {
video_track = track_entry.track_number();
return IterationDecision::Break;
}));
VERIFY(video_track == 1);
auto iterator = MUST(matroska_reader.create_sample_iterator(video_track));
MUST(iterator.next_block());
MUST(matroska_reader.seek_to_random_access_point(iterator, Duration::from_seconds(7)));
MUST(iterator.next_block());
}