From 598894211ffbeadd3823cb94d53c972e7d75ab96 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Mar 2023 20:29:53 +0100 Subject: [PATCH] decoder/ffmpeg: require FFmpeg 4.0 or later --- NEWS | 1 + src/decoder/plugins/FfmpegDecoderPlugin.cxx | 11 ----------- src/lib/ffmpeg/IOContext.hxx | 5 ----- src/lib/ffmpeg/Init.cxx | 7 +------ src/lib/ffmpeg/meson.build | 6 +++--- 5 files changed, 5 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index 18ac57f8f..ac0a68887 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ ver 0.24 (not yet released) - curl: add "connect_timeout" configuration - curl: fix busy loop after connection failed * decoder + - ffmpeg: require FFmpeg 4.0 or later - hybrid_dsd: remove - opus: implement bitrate calculation - wavpack: require libwavpack version 5 diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 989f0a0ba..b0142806c 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -452,12 +452,7 @@ FfmpegCheckTag(DecoderClient &client, InputStream *is, static bool IsSeekable(const AVFormatContext &format_context) noexcept { -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 6, 100) return (format_context.ctx_flags & AVFMTCTX_UNSEEKABLE) == 0; -#else - (void)format_context; - return false; -#endif } static void @@ -660,8 +655,6 @@ ffmpeg_scan_stream(InputStream &is, TagHandler &handler) return FfmpegScanStream(*f, handler); } -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 9, 100) - static void ffmpeg_uri_decode(DecoderClient &client, const char *uri) { @@ -697,8 +690,6 @@ ffmpeg_protocols() noexcept return protocols; } -#endif - /** * A list of extensions found for the formats supported by ffmpeg. * This list is current as of 02-23-09; To find out if there are more @@ -822,8 +813,6 @@ static const char *const ffmpeg_mime_types[] = { constexpr DecoderPlugin ffmpeg_decoder_plugin = DecoderPlugin("ffmpeg", ffmpeg_decode, ffmpeg_scan_stream) .WithInit(ffmpeg_init, ffmpeg_finish) -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 9, 100) .WithProtocols(ffmpeg_protocols, ffmpeg_uri_decode) -#endif .WithSuffixes(ffmpeg_suffixes) .WithMimeTypes(ffmpeg_mime_types); diff --git a/src/lib/ffmpeg/IOContext.hxx b/src/lib/ffmpeg/IOContext.hxx index 4f2f0ca42..c5fbe5856 100644 --- a/src/lib/ffmpeg/IOContext.hxx +++ b/src/lib/ffmpeg/IOContext.hxx @@ -59,13 +59,8 @@ public: } size_t Read(void *buffer, size_t size) { -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 81, 100) int result = avio_read_partial(io_context, (unsigned char *)buffer, size); -#else - int result = avio_read(io_context, - (unsigned char *)buffer, size); -#endif if (result < 0) throw MakeFfmpegError(result, "avio_read() failed"); diff --git a/src/lib/ffmpeg/Init.cxx b/src/lib/ffmpeg/Init.cxx index f3c5804ec..a0b3c3426 100644 --- a/src/lib/ffmpeg/Init.cxx +++ b/src/lib/ffmpeg/Init.cxx @@ -8,16 +8,11 @@ #include "LogCallback.hxx" extern "C" { -#include +#include } void FfmpegInit() { av_log_set_callback(FfmpegLogCallback); - -#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100) - /* deprecated as of FFmpeg 4.0 */ - av_register_all(); -#endif } diff --git a/src/lib/ffmpeg/meson.build b/src/lib/ffmpeg/meson.build index 43ceef505..4cac26867 100644 --- a/src/lib/ffmpeg/meson.build +++ b/src/lib/ffmpeg/meson.build @@ -1,6 +1,6 @@ -libavformat_dep = dependency('libavformat', version: '>= 57.40', required: get_option('ffmpeg')) -libavcodec_dep = dependency('libavcodec', version: '>= 57.48', required: get_option('ffmpeg')) -libavutil_dep = dependency('libavutil', version: '>= 55.27', required: get_option('ffmpeg')) +libavformat_dep = dependency('libavformat', version: '>= 58.12', required: get_option('ffmpeg')) +libavcodec_dep = dependency('libavcodec', version: '>= 58.18', required: get_option('ffmpeg')) +libavutil_dep = dependency('libavutil', version: '>= 56.14', required: get_option('ffmpeg')) conf.set('HAVE_LIBAVUTIL', libavutil_dep.found()) enable_ffmpeg = libavformat_dep.found() and libavcodec_dep.found() and libavutil_dep.found()