obs-StreamFX/source/encoders/handlers/handler.cpp

42 lines
1.1 KiB
C++
Raw Normal View History

// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
2020-01-13 00:52:30 +00:00
#include "handler.hpp"
#include "../encoder-ffmpeg.hpp"
2020-01-13 00:52:30 +00:00
using namespace streamfx::encoder::ffmpeg;
2020-01-13 00:52:30 +00:00
bool handler::handler::has_keyframe_support(ffmpeg_factory* instance)
2020-01-13 00:52:30 +00:00
{
#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
2020-01-13 00:52:30 +00:00
return (instance->get_avcodec()->capabilities & AV_CODEC_CAP_INTRA_ONLY) == 0;
#endif
2020-01-13 00:52:30 +00:00
}
bool handler::handler::is_hardware_encoder(ffmpeg_factory* instance)
{
return false;
}
bool handler::handler::has_threading_support(ffmpeg_factory* instance)
{
return (instance->get_avcodec()->capabilities & (AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS));
}
bool handler::handler::has_pixel_format_support(ffmpeg_factory* instance)
{
return (instance->get_avcodec()->pix_fmts != nullptr);
}
bool handler::handler::supports_reconfigure(ffmpeg_factory* instance, bool& threads, bool& gpu, bool& keyframes)
{
return false;
}