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

82 lines
2.8 KiB
C++
Raw Normal View History

// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 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
streamfx::encoder::ffmpeg::handler::handler_map_t& streamfx::encoder::ffmpeg::handler::handlers()
{
static handler_map_t handlers;
return handlers;
}
streamfx::encoder::ffmpeg::handler::handler(std::string codec)
{
handlers().emplace(codec, this);
}
2020-01-13 00:52:30 +00:00
bool streamfx::encoder::ffmpeg::handler::has_keyframes(ffmpeg_factory* factory)
2020-01-13 00:52:30 +00:00
{
#if defined(AV_CODEC_PROP_INTRA_ONLY) // TODO: Determine if we need to check for an exact version.
if (auto* desc = avcodec_descriptor_get(factory->get_avcodec()->id); desc) {
return (desc->props & AV_CODEC_PROP_INTRA_ONLY) == 0;
}
#endif
#ifdef AV_CODEC_CAP_INTRA_ONLY
return (factory->get_avcodec()->capabilities & AV_CODEC_CAP_INTRA_ONLY) == 0;
#else
return false;
#endif
2020-01-13 00:52:30 +00:00
}
bool streamfx::encoder::ffmpeg::handler::has_threading(ffmpeg_factory* factory)
{
return (factory->get_avcodec()->capabilities
& (AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS
#if defined(AV_CODEC_CAP_OTHER_THREADS) // TODO: Determine if we need to check for an exact version.
| AV_CODEC_CAP_OTHER_THREADS
#else
| AV_CODEC_CAP_AUTO_THREADS
#endif
));
}
bool streamfx::encoder::ffmpeg::handler::is_hardware(ffmpeg_factory* factory)
{
if (factory->get_avcodec()->capabilities & AV_CODEC_CAP_HARDWARE) {
return true;
}
return false;
}
bool streamfx::encoder::ffmpeg::handler::is_reconfigurable(ffmpeg_factory* factory, bool& threads, bool& gpu, bool& keyframes)
{
if (factory->get_avcodec()->capabilities & AV_CODEC_CAP_PARAM_CHANGE) {
return true;
}
return false;
}
void streamfx::encoder::ffmpeg::handler::adjust_info(ffmpeg_factory* factory, std::string& id, std::string& name, std::string& codec) {}
std::string streamfx::encoder::ffmpeg::handler::help(ffmpeg_factory* factory)
{
return "about:blank";
}
void streamfx::encoder::ffmpeg::handler::defaults(ffmpeg_factory* factory, obs_data_t* settings) {}
void streamfx::encoder::ffmpeg::handler::properties(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_properties_t* props) {}
void streamfx::encoder::ffmpeg::handler::migrate(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings, uint64_t version) {}
void streamfx::encoder::ffmpeg::handler::update(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings) {}
void streamfx::encoder::ffmpeg::handler::override_update(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings) {}
void streamfx::encoder::ffmpeg::handler::log(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings) {}
void streamfx::encoder::ffmpeg::handler::override_colorformat(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings, AVPixelFormat& target_format) {}