LibMedia: Use build-time rather than configure-time check for avcodec

Rather than checking the avcodec version in CMake, check it using the
avcodec version macros in the only source file that needs to know about
the AVFrame API/ABI change in version 59.24.100. This is friendlier to
other build systems that would rather avoid configure time checks.
This commit is contained in:
Andrew Kaster 2024-09-26 16:23:58 -06:00 committed by Tim Flynn
parent 157d41bb0d
commit 994457d7af
Notes: github-actions[bot] 2024-09-27 10:46:24 +00:00
2 changed files with 4 additions and 3 deletions

View file

@ -7,7 +7,4 @@ pkg_check_modules(AVFORMAT IMPORTED_TARGET libavformat)
if (AVCODEC_FOUND AND AVFORMAT_FOUND) if (AVCODEC_FOUND AND AVFORMAT_FOUND)
set(HAS_FFMPEG ON CACHE BOOL "" FORCE) set(HAS_FFMPEG ON CACHE BOOL "" FORCE)
add_compile_definitions(USE_FFMPEG=1) add_compile_definitions(USE_FFMPEG=1)
if (AVCODEC_VERSION VERSION_GREATER_EQUAL "59.24.100")
add_compile_definitions(USE_FFMPEG_CH_LAYOUT=1)
endif()
endif() endif()

View file

@ -9,6 +9,10 @@
#include <AK/ScopeGuard.h> #include <AK/ScopeGuard.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)
# define USE_FFMPEG_CH_LAYOUT
#endif
namespace Audio { namespace Audio {
OggLoaderPlugin::OggLoaderPlugin(NonnullOwnPtr<SeekableStream> stream) OggLoaderPlugin::OggLoaderPlugin(NonnullOwnPtr<SeekableStream> stream)