decoder/ffmpeg: require FFmpeg 4.0 or later

This commit is contained in:
Max Kellermann 2023-03-08 20:29:53 +01:00
parent dbfd0a833d
commit 598894211f
5 changed files with 5 additions and 25 deletions

1
NEWS
View File

@ -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

View File

@ -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);

View File

@ -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");

View File

@ -8,16 +8,11 @@
#include "LogCallback.hxx"
extern "C" {
#include <libavformat/avformat.h>
#include <libavutil/log.h>
}
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
}

View File

@ -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()