2023-05-16 03:31:43 +00:00
|
|
|
// 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"
|
2020-06-14 20:22:44 +00:00
|
|
|
#include "../encoder-ffmpeg.hpp"
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2023-05-14 16:38:28 +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
|
|
|
|
2023-05-14 16:38:28 +00:00
|
|
|
bool streamfx::encoder::ffmpeg::handler::has_keyframes(ffmpeg_factory* factory)
|
2020-01-13 00:52:30 +00:00
|
|
|
{
|
2023-05-16 04:04:27 +00:00
|
|
|
#if defined(AV_CODEC_PROP_INTRA_ONLY) // TODO: Determine if we need to check for an exact version.
|
2023-05-14 16:38:28 +00:00
|
|
|
if (auto* desc = avcodec_descriptor_get(factory->get_avcodec()->id); desc) {
|
2023-05-03 18:31:38 +00:00
|
|
|
return (desc->props & AV_CODEC_PROP_INTRA_ONLY) == 0;
|
|
|
|
}
|
2023-05-16 04:04:27 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AV_CODEC_CAP_INTRA_ONLY
|
2023-05-14 16:38:28 +00:00
|
|
|
return (factory->get_avcodec()->capabilities & AV_CODEC_CAP_INTRA_ONLY) == 0;
|
2023-05-16 04:04:27 +00:00
|
|
|
#else
|
|
|
|
return false;
|
2023-05-03 18:31:38 +00:00
|
|
|
#endif
|
2020-01-13 00:52:30 +00:00
|
|
|
}
|
|
|
|
|
2023-05-14 16:38:28 +00:00
|
|
|
bool streamfx::encoder::ffmpeg::handler::has_threading(ffmpeg_factory* factory)
|
2020-04-17 08:24:13 +00:00
|
|
|
{
|
2023-05-16 04:04:27 +00:00
|
|
|
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
|
|
|
|
));
|
2020-04-17 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
2023-05-14 16:38:28 +00:00
|
|
|
bool streamfx::encoder::ffmpeg::handler::is_hardware(ffmpeg_factory* factory)
|
2020-04-17 08:24:13 +00:00
|
|
|
{
|
2023-05-14 16:38:28 +00:00
|
|
|
if (factory->get_avcodec()->capabilities & AV_CODEC_CAP_HARDWARE) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2020-04-17 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
2023-05-14 16:38:28 +00:00
|
|
|
bool streamfx::encoder::ffmpeg::handler::is_reconfigurable(ffmpeg_factory* factory, bool& threads, bool& gpu, bool& keyframes)
|
2020-04-17 08:24:13 +00:00
|
|
|
{
|
2023-05-14 16:38:28 +00:00
|
|
|
if (factory->get_avcodec()->capabilities & AV_CODEC_CAP_PARAM_CHANGE) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2020-04-17 08:24:13 +00:00
|
|
|
}
|
2021-12-03 06:13:08 +00:00
|
|
|
|
2023-05-14 16:38:28 +00:00
|
|
|
void streamfx::encoder::ffmpeg::handler::adjust_info(ffmpeg_factory* factory, std::string& id, std::string& name, std::string& codec) {}
|
|
|
|
|
2023-05-16 04:04:27 +00:00
|
|
|
std::string streamfx::encoder::ffmpeg::handler::help(ffmpeg_factory* factory)
|
|
|
|
{
|
2023-05-14 16:38:28 +00:00
|
|
|
return "about:blank";
|
2021-12-03 06:13:08 +00:00
|
|
|
}
|
2023-05-14 16:38:28 +00:00
|
|
|
|
|
|
|
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) {}
|
|
|
|
|
2023-05-15 23:11:58 +00:00
|
|
|
void streamfx::encoder::ffmpeg::handler::override_colorformat(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings, AVPixelFormat& target_format) {}
|