diff --git a/Tests/LibVideo/CMakeLists.txt b/Tests/LibVideo/CMakeLists.txt index bd0ba699460..3e154292fa9 100644 --- a/Tests/LibVideo/CMakeLists.txt +++ b/Tests/LibVideo/CMakeLists.txt @@ -1,4 +1,5 @@ set(TEST_SOURCES + TestParseMatroska.cpp TestVP9Decode.cpp ) @@ -10,3 +11,4 @@ install(FILES vp9_in_webm.webm DESTINATION usr/Tests/LibVideo) install(FILES vp9_4k.webm DESTINATION usr/Tests/LibVideo) install(FILES vp9_clamp_reference_mvs.webm DESTINATION usr/Tests/LibVideo) install(FILES vp9_oob_blocks.webm DESTINATION usr/Tests/LibVideo) +install(FILES master_elements_containing_crc32.mkv DESTINATION usr/Tests/LibVideo) diff --git a/Tests/LibVideo/FILE_LICENSES.md b/Tests/LibVideo/FILE_LICENSES.md index c698995f1de..f44fea64115 100644 --- a/Tests/LibVideo/FILE_LICENSES.md +++ b/Tests/LibVideo/FILE_LICENSES.md @@ -1,4 +1,4 @@ -## vp9_clamp_reference_mvs.webm +## vp9_clamp_reference_mvs.webm & master_elements_containing_crc32.mkv Licensed under [Creative Commons Attribution 3.0](http://creativecommons.org/licenses/by/3.0/)\ (c) copyright 2008, Blender Foundation / [www.bigbuckbunny.org](https://www.bigbuckbunny.org) diff --git a/Tests/LibVideo/TestParseMatroska.cpp b/Tests/LibVideo/TestParseMatroska.cpp new file mode 100644 index 00000000000..bce5b6760d7 --- /dev/null +++ b/Tests/LibVideo/TestParseMatroska.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023, Gregory Bertilson + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +#include + +TEST_CASE(master_elements_containing_crc32) +{ + auto matroska_reader = MUST(Video::Matroska::Reader::from_file("master_elements_containing_crc32.mkv"sv)); + u64 video_track = 0; + MUST(matroska_reader.for_each_track_of_type(Video::Matroska::TrackEntry::TrackType::Video, [&](Video::Matroska::TrackEntry const& track_entry) -> Video::DecoderErrorOr { + 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()); +} diff --git a/Tests/LibVideo/master_elements_containing_crc32.mkv b/Tests/LibVideo/master_elements_containing_crc32.mkv new file mode 100644 index 00000000000..259b4cf38d8 Binary files /dev/null and b/Tests/LibVideo/master_elements_containing_crc32.mkv differ