mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
encoders/ffmpeg: Support for FFmpeg versions older than 58.x
This commit is contained in:
parent
012027578a
commit
c445865111
1 changed files with 17 additions and 0 deletions
|
@ -1115,6 +1115,7 @@ ffmpeg_manager::~ffmpeg_manager()
|
||||||
void ffmpeg_manager::register_encoders()
|
void ffmpeg_manager::register_encoders()
|
||||||
{
|
{
|
||||||
// Encoders
|
// Encoders
|
||||||
|
#if FF_API_NEXT
|
||||||
void* iterator = nullptr;
|
void* iterator = nullptr;
|
||||||
for (const AVCodec* codec = av_codec_iterate(&iterator); codec != nullptr; codec = av_codec_iterate(&iterator)) {
|
for (const AVCodec* codec = av_codec_iterate(&iterator); codec != nullptr; codec = av_codec_iterate(&iterator)) {
|
||||||
// Only register encoders.
|
// Only register encoders.
|
||||||
|
@ -1129,6 +1130,22 @@ 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->id, ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffmpeg_manager::register_handler(std::string codec, std::shared_ptr<handler::handler> handler)
|
void ffmpeg_manager::register_handler(std::string codec, std::shared_ptr<handler::handler> handler)
|
||||||
|
|
Loading…
Reference in a new issue