mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-28 18:41:14 +00:00
code: Fix support for libAVCodec 59.x and beyond
This commit is contained in:
parent
5ce59b4c12
commit
0476185a65
2 changed files with 17 additions and 8 deletions
|
@ -1042,14 +1042,15 @@ const char* ffmpeg_factory::get_name()
|
|||
|
||||
void ffmpeg_factory::get_defaults2(obs_data_t* settings)
|
||||
{
|
||||
if (_handler)
|
||||
if (_handler) {
|
||||
_handler->get_defaults(settings, _avcodec, nullptr, _handler->is_hardware_encoder(this));
|
||||
|
||||
if ((_avcodec->capabilities & AV_CODEC_CAP_INTRA_ONLY) == 0) {
|
||||
if (_handler->has_keyframe_support(this)) {
|
||||
obs_data_set_default_int(settings, ST_KEY_KEYFRAMES_INTERVALTYPE, 0);
|
||||
obs_data_set_default_double(settings, ST_KEY_KEYFRAMES_INTERVAL_SECONDS, 2.0);
|
||||
obs_data_set_default_int(settings, ST_KEY_KEYFRAMES_INTERVAL_FRAMES, 300);
|
||||
}
|
||||
}
|
||||
|
||||
{ // Integrated Options
|
||||
// FFmpeg
|
||||
|
|
|
@ -9,7 +9,15 @@ using namespace streamfx::encoder::ffmpeg;
|
|||
|
||||
bool handler::handler::has_keyframe_support(ffmpeg_factory* instance)
|
||||
{
|
||||
#if LIBAVCODEC_VERSION_MAJOR > 58
|
||||
if (auto* desc = avcodec_descriptor_get(instance->get_avcodec()->id); desc) {
|
||||
return (desc->props & AV_CODEC_PROP_INTRA_ONLY) == 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return (instance->get_avcodec()->capabilities & AV_CODEC_CAP_INTRA_ONLY) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool handler::handler::is_hardware_encoder(ffmpeg_factory* instance)
|
||||
|
|
Loading…
Reference in a new issue