Tests/LibMedia: Add a test for H.264 decoding through FFmpeg

This commit is contained in:
Zaggy1024 2024-06-19 23:06:40 -05:00 committed by Andrew Kaster
parent 48a21d5d6a
commit 084cf68dd5
Notes: sideshowbarker 2024-07-16 22:22:13 +09:00
4 changed files with 22 additions and 0 deletions

View file

@ -1,4 +1,5 @@
set(TEST_SOURCES
TestH264Decode.cpp
TestParseMatroska.cpp
TestVP9Decode.cpp
)
@ -7,6 +8,7 @@ foreach(source IN LISTS TEST_SOURCES)
serenity_test("${source}" LibMedia LIBS LibMedia)
endforeach()
install(FILES avc_in_matroska.mkv DESTINATION usr/Tests/LibMedia)
install(FILES vp9_in_webm.webm DESTINATION usr/Tests/LibMedia)
install(FILES vp9_4k.webm DESTINATION usr/Tests/LibMedia)
install(FILES vp9_clamp_reference_mvs.webm DESTINATION usr/Tests/LibMedia)

View file

@ -0,0 +1,19 @@
/*
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibMedia/FFmpeg/FFmpegVideoDecoder.h>
#include "TestMediaCommon.h"
static NonnullOwnPtr<Media::VideoDecoder> make_decoder(Media::Matroska::SampleIterator const& iterator)
{
return MUST(Media::FFmpeg::FFmpegVideoDecoder::try_create(Media::CodecID::H264, iterator.track().codec_private_data()));
}
TEST_CASE(avc_in_matroska)
{
decode_video("./avc_in_matroska.mkv"sv, 50, make_decoder);
}

Binary file not shown.

View file

@ -85,6 +85,7 @@ public:
DecoderErrorOr<Block> next_block();
Cluster const& current_cluster() const { return *m_current_cluster; }
Optional<Duration> const& last_timestamp() const { return m_last_timestamp; }
TrackEntry const& track() const { return *m_track; }
private:
friend class Reader;