From 6c1870edc3d224f8a217c0a71d9aac172a1d186c Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 6 Feb 2022 14:24:02 -0800 Subject: [PATCH] Remove deprecated APIs to support ffmpeg5. --- src/plugins/ffmpegdecoder/plugin.cpp | 8 +++----- src/plugins/stockencoders/FfmpegEncoder.cpp | 4 ---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/plugins/ffmpegdecoder/plugin.cpp b/src/plugins/ffmpegdecoder/plugin.cpp index f2507cd39..03a4eea0f 100644 --- a/src/plugins/ffmpegdecoder/plugin.cpp +++ b/src/plugins/ffmpegdecoder/plugin.cpp @@ -85,8 +85,6 @@ class FfmpegDecoderFactory : public musik::core::sdk::IDecoderFactory { CoInitializeEx(nullptr, COINIT_MULTITHREADED); #endif - av_register_all(); - typeToCodecId = { { ".mp3", AV_CODEC_ID_MP3 }, { "audio/mpeg", AV_CODEC_ID_MP3 }, @@ -117,13 +115,13 @@ class FfmpegDecoderFactory : public musik::core::sdk::IDecoderFactory { ".wav", ".wave", ".aif", ".aiff" }; - AVCodec* codec = av_codec_next(nullptr); - while (codec != nullptr) { + void* iterator = nullptr; + const AVCodec* codec = nullptr; + while ((codec = av_codec_iterate(&iterator))) { const AVCodecDescriptor* descriptor = avcodec_descriptor_get(codec->id); if (descriptor != nullptr && descriptor->type == AVMEDIA_TYPE_AUDIO) { supported.insert(descriptor->id); } - codec = av_codec_next(codec); } } diff --git a/src/plugins/stockencoders/FfmpegEncoder.cpp b/src/plugins/stockencoders/FfmpegEncoder.cpp index 2aa251dd2..a406b9f05 100644 --- a/src/plugins/stockencoders/FfmpegEncoder.cpp +++ b/src/plugins/stockencoders/FfmpegEncoder.cpp @@ -361,10 +361,6 @@ bool FfmpegEncoder::OpenOutputContext() { } bool FfmpegEncoder::Initialize(IDataStream* out, size_t rate, size_t channels, size_t bitrate) { -#ifndef WIN32 - av_register_all(); -#endif - this->out = out; if (this->OpenOutputContext()) {