Skip to content

Commit

Permalink
encoder/ffmpeg: Remove legacy API usage (#783)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pencels authored Feb 24, 2022
1 parent 1b80a14 commit 02a41f2
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions source/encoders/encoder-ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<ffmpeg_factory>(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::handler> handler)
Expand Down

0 comments on commit 02a41f2

Please # to comment.