From 02a41f29b77e838ca614f0f40ae4f51c05b697d6 Mon Sep 17 00:00:00 2001 From: Chris Pence <6cpence@gmail.com> Date: Thu, 24 Feb 2022 12:12:37 -0800 Subject: [PATCH] encoder/ffmpeg: Remove legacy API usage (#783) The build breaks if compiling against a newer version of ffmpeg which does not define the FF_API_NEXT macro and has fully removed the av_codec_next() API. --- source/encoders/encoder-ffmpeg.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/source/encoders/encoder-ffmpeg.cpp b/source/encoders/encoder-ffmpeg.cpp index a913cb0ac0..737ff96569 100644 --- a/source/encoders/encoder-ffmpeg.cpp +++ b/source/encoders/encoder-ffmpeg.cpp @@ -1180,7 +1180,6 @@ ffmpeg_manager::~ffmpeg_manager() void ffmpeg_manager::register_encoders() { // Encoders -#if FF_API_NEXT void* iterator = nullptr; for (const AVCodec* codec = av_codec_iterate(&iterator); codec != nullptr; codec = av_codec_iterate(&iterator)) { // Only register encoders. @@ -1195,22 +1194,6 @@ void ffmpeg_manager::register_encoders() } } } -#else - AVCodec* codec = nullptr; - for (codec = av_codec_next(codec); codec != nullptr; codec = av_codec_next(codec)) { - // Only register encoders. - if (!av_codec_is_encoder(codec)) - continue; - - if ((codec->type == AVMediaType::AVMEDIA_TYPE_AUDIO) || (codec->type == AVMediaType::AVMEDIA_TYPE_VIDEO)) { - try { - _factories.emplace(codec, std::make_shared(codec)); - } catch (const std::exception& ex) { - DLOG_ERROR("Failed to register encoder '%s': %s", codec->name, ex.what()); - } - } - } -#endif } void ffmpeg_manager::register_handler(std::string codec, std::shared_ptr handler)