obs-StreamFX/source/encoders/handlers/handler.cpp
2023-05-14 03:25:07 +02:00

41 lines
1.1 KiB
C++

// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "handler.hpp"
#include "../encoder-ffmpeg.hpp"
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)
{
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;
}