mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
encoders/codecs: Apply coding guidelines
This commit is contained in:
parent
0d13d43dd8
commit
67e122eb65
8 changed files with 66 additions and 66 deletions
|
@ -23,9 +23,9 @@
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
// Codec: H264
|
// Codec: H264
|
||||||
#define P_H264 "Codec.H264"
|
#define S_CODEC_H264 "Codec.H264"
|
||||||
#define P_H264_PROFILE "Codec.H264.Profile"
|
#define S_CODEC_H264_PROFILE "Codec.H264.Profile"
|
||||||
#define P_H264_LEVEL "Codec.H264.Level"
|
#define S_CODEC_H264_LEVEL "Codec.H264.Level"
|
||||||
|
|
||||||
namespace streamfx::encoder::codec::h264 {
|
namespace streamfx::encoder::codec::h264 {
|
||||||
enum class profile {
|
enum class profile {
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
// Codec: HEVC
|
// Codec: HEVC
|
||||||
#define P_HEVC "Codec.HEVC"
|
#define S_CODEC_HEVC "Codec.HEVC"
|
||||||
#define P_HEVC_PROFILE "Codec.HEVC.Profile"
|
#define S_CODEC_HEVC_PROFILE "Codec.HEVC.Profile"
|
||||||
#define P_HEVC_TIER "Codec.HEVC.Tier"
|
#define S_CODEC_HEVC_TIER "Codec.HEVC.Tier"
|
||||||
#define P_HEVC_LEVEL "Codec.HEVC.Level"
|
#define S_CODEC_HEVC_LEVEL "Codec.HEVC.Level"
|
||||||
|
|
||||||
namespace streamfx::encoder::codec::hevc {
|
namespace streamfx::encoder::codec::hevc {
|
||||||
enum class profile {
|
enum class profile {
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
// Codec: ProRes
|
// Codec: ProRes
|
||||||
#define P_PRORES "Codec.ProRes"
|
#define S_CODEC_PRORES "Codec.ProRes"
|
||||||
#define P_PRORES_PROFILE "Codec.ProRes.Profile"
|
#define S_CODEC_PRORES_PROFILE "Codec.ProRes.Profile"
|
||||||
#define P_PRORES_PROFILE_APCS "Codec.ProRes.Profile.APCS"
|
#define S_CODEC_PRORES_PROFILE_APCS "Codec.ProRes.Profile.APCS"
|
||||||
#define P_PRORES_PROFILE_APCO "Codec.ProRes.Profile.APCO"
|
#define S_CODEC_PRORES_PROFILE_APCO "Codec.ProRes.Profile.APCO"
|
||||||
#define P_PRORES_PROFILE_APCN "Codec.ProRes.Profile.APCN"
|
#define S_CODEC_PRORES_PROFILE_APCN "Codec.ProRes.Profile.APCN"
|
||||||
#define P_PRORES_PROFILE_APCH "Codec.ProRes.Profile.APCH"
|
#define S_CODEC_PRORES_PROFILE_APCH "Codec.ProRes.Profile.APCH"
|
||||||
#define P_PRORES_PROFILE_AP4H "Codec.ProRes.Profile.AP4H"
|
#define S_CODEC_PRORES_PROFILE_AP4H "Codec.ProRes.Profile.AP4H"
|
||||||
#define P_PRORES_PROFILE_AP4X "Codec.ProRes.Profile.AP4X"
|
#define S_CODEC_PRORES_PROFILE_AP4X "Codec.ProRes.Profile.AP4X"
|
||||||
|
|
||||||
namespace streamfx::encoder::codec::prores {
|
namespace streamfx::encoder::codec::prores {
|
||||||
enum class profile : int32_t {
|
enum class profile : int32_t {
|
||||||
|
|
|
@ -143,19 +143,19 @@ void amf_h264_handler::get_encoder_properties(obs_properties_t* props, const AVC
|
||||||
|
|
||||||
{
|
{
|
||||||
obs_properties_t* grp = obs_properties_create();
|
obs_properties_t* grp = obs_properties_create();
|
||||||
obs_properties_add_group(props, P_H264, D_TRANSLATE(P_H264), OBS_GROUP_NORMAL, grp);
|
obs_properties_add_group(props, S_CODEC_H264, D_TRANSLATE(S_CODEC_H264), OBS_GROUP_NORMAL, grp);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, ST_KEY_PROFILE, D_TRANSLATE(P_H264_PROFILE), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_PROFILE, D_TRANSLATE(S_CODEC_H264_PROFILE),
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
||||||
for (auto const kv : profiles) {
|
for (auto const kv : profiles) {
|
||||||
std::string trans = std::string(P_H264_PROFILE) + "." + kv.second;
|
std::string trans = std::string(S_CODEC_H264_PROFILE) + "." + kv.second;
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, ST_KEY_LEVEL, D_TRANSLATE(P_H264_LEVEL), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_LEVEL, D_TRANSLATE(S_CODEC_H264_LEVEL), OBS_COMBO_TYPE_LIST,
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
||||||
for (auto const kv : levels) {
|
for (auto const kv : levels) {
|
||||||
|
|
|
@ -152,28 +152,28 @@ void amf_hevc_handler::get_encoder_properties(obs_properties_t* props, const AVC
|
||||||
|
|
||||||
{
|
{
|
||||||
obs_properties_t* grp = obs_properties_create();
|
obs_properties_t* grp = obs_properties_create();
|
||||||
obs_properties_add_group(props, P_HEVC, D_TRANSLATE(P_HEVC), OBS_GROUP_NORMAL, grp);
|
obs_properties_add_group(props, S_CODEC_HEVC, D_TRANSLATE(S_CODEC_HEVC), OBS_GROUP_NORMAL, grp);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, ST_KEY_PROFILE, D_TRANSLATE(P_HEVC_PROFILE), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_PROFILE, D_TRANSLATE(S_CODEC_HEVC_PROFILE),
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
||||||
for (auto const kv : profiles) {
|
for (auto const kv : profiles) {
|
||||||
std::string trans = std::string(P_HEVC_PROFILE) + "." + kv.second;
|
std::string trans = std::string(S_CODEC_HEVC_PROFILE) + "." + kv.second;
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, ST_KEY_TIER, D_TRANSLATE(P_HEVC_TIER), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_TIER, D_TRANSLATE(S_CODEC_HEVC_TIER), OBS_COMBO_TYPE_LIST,
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(tier::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(tier::UNKNOWN));
|
||||||
for (auto const kv : tiers) {
|
for (auto const kv : tiers) {
|
||||||
std::string trans = std::string(P_HEVC_TIER) + "." + kv.second;
|
std::string trans = std::string(S_CODEC_HEVC_TIER) + "." + kv.second;
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, ST_KEY_LEVEL, D_TRANSLATE(P_HEVC_LEVEL), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_LEVEL, D_TRANSLATE(S_CODEC_HEVC_LEVEL), OBS_COMBO_TYPE_LIST,
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
||||||
for (auto const kv : levels) {
|
for (auto const kv : levels) {
|
||||||
|
|
|
@ -39,8 +39,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KEY_PROFILE "H264.Profile"
|
#define ST_KEY_PROFILE "H264.Profile"
|
||||||
#define KEY_LEVEL "H264.Level"
|
#define ST_KEY_LEVEL "H264.Level"
|
||||||
|
|
||||||
using namespace streamfx::encoder::ffmpeg::handler;
|
using namespace streamfx::encoder::ffmpeg::handler;
|
||||||
using namespace streamfx::encoder::codec::h264;
|
using namespace streamfx::encoder::codec::h264;
|
||||||
|
@ -70,8 +70,8 @@ void nvenc_h264_handler::get_defaults(obs_data_t* settings, const AVCodec* codec
|
||||||
{
|
{
|
||||||
nvenc::get_defaults(settings, codec, context);
|
nvenc::get_defaults(settings, codec, context);
|
||||||
|
|
||||||
obs_data_set_default_int(settings, KEY_PROFILE, static_cast<int64_t>(profile::HIGH));
|
obs_data_set_default_int(settings, ST_KEY_PROFILE, static_cast<int64_t>(profile::HIGH));
|
||||||
obs_data_set_default_int(settings, KEY_LEVEL, static_cast<int64_t>(level::UNKNOWN));
|
obs_data_set_default_int(settings, ST_KEY_LEVEL, static_cast<int64_t>(level::UNKNOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nvenc_h264_handler::has_keyframe_support(ffmpeg_factory*)
|
bool nvenc_h264_handler::has_keyframe_support(ffmpeg_factory*)
|
||||||
|
@ -108,14 +108,14 @@ void nvenc_h264_handler::update(obs_data_t* settings, const AVCodec* codec, AVCo
|
||||||
nvenc::update(settings, codec, context);
|
nvenc::update(settings, codec, context);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto found = profiles.find(static_cast<profile>(obs_data_get_int(settings, KEY_PROFILE)));
|
auto found = profiles.find(static_cast<profile>(obs_data_get_int(settings, ST_KEY_PROFILE)));
|
||||||
if (found != profiles.end()) {
|
if (found != profiles.end()) {
|
||||||
av_opt_set(context->priv_data, "profile", found->second.c_str(), 0);
|
av_opt_set(context->priv_data, "profile", found->second.c_str(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto found = levels.find(static_cast<level>(obs_data_get_int(settings, KEY_LEVEL)));
|
auto found = levels.find(static_cast<level>(obs_data_get_int(settings, ST_KEY_LEVEL)));
|
||||||
if (found != levels.end()) {
|
if (found != levels.end()) {
|
||||||
av_opt_set(context->priv_data, "level", found->second.c_str(), 0);
|
av_opt_set(context->priv_data, "level", found->second.c_str(), 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -148,20 +148,20 @@ void nvenc_h264_handler::get_encoder_properties(obs_properties_t* props, const A
|
||||||
obs_properties_t* grp = props;
|
obs_properties_t* grp = props;
|
||||||
if (!util::are_property_groups_broken()) {
|
if (!util::are_property_groups_broken()) {
|
||||||
grp = obs_properties_create();
|
grp = obs_properties_create();
|
||||||
obs_properties_add_group(props, P_H264, D_TRANSLATE(P_H264), OBS_GROUP_NORMAL, grp);
|
obs_properties_add_group(props, S_CODEC_H264, D_TRANSLATE(S_CODEC_H264), OBS_GROUP_NORMAL, grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, KEY_PROFILE, D_TRANSLATE(P_H264_PROFILE), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_PROFILE, D_TRANSLATE(S_CODEC_H264_PROFILE),
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
||||||
for (auto const kv : profiles) {
|
for (auto const kv : profiles) {
|
||||||
std::string trans = std::string(P_H264_PROFILE) + "." + kv.second;
|
std::string trans = std::string(S_CODEC_H264_PROFILE) + "." + kv.second;
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, KEY_LEVEL, D_TRANSLATE(P_H264_LEVEL), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_LEVEL, D_TRANSLATE(S_CODEC_H264_LEVEL), OBS_COMBO_TYPE_LIST,
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
||||||
for (auto const kv : levels) {
|
for (auto const kv : levels) {
|
||||||
|
|
|
@ -35,9 +35,9 @@ extern "C" {
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KEY_PROFILE "H265.Profile"
|
#define ST_KEY_PROFILE "H265.Profile"
|
||||||
#define KEY_TIER "H265.Tier"
|
#define ST_KEY_TIER "H265.Tier"
|
||||||
#define KEY_LEVEL "H265.Level"
|
#define ST_KEY_LEVEL "H265.Level"
|
||||||
|
|
||||||
using namespace streamfx::encoder::ffmpeg::handler;
|
using namespace streamfx::encoder::ffmpeg::handler;
|
||||||
using namespace streamfx::encoder::codec::hevc;
|
using namespace streamfx::encoder::codec::hevc;
|
||||||
|
@ -70,9 +70,9 @@ void nvenc_hevc_handler::get_defaults(obs_data_t* settings, const AVCodec* codec
|
||||||
{
|
{
|
||||||
nvenc::get_defaults(settings, codec, context);
|
nvenc::get_defaults(settings, codec, context);
|
||||||
|
|
||||||
obs_data_set_default_int(settings, KEY_PROFILE, static_cast<int64_t>(profile::MAIN));
|
obs_data_set_default_int(settings, ST_KEY_PROFILE, static_cast<int64_t>(profile::MAIN));
|
||||||
obs_data_set_default_int(settings, KEY_TIER, static_cast<int64_t>(profile::MAIN));
|
obs_data_set_default_int(settings, ST_KEY_TIER, static_cast<int64_t>(profile::MAIN));
|
||||||
obs_data_set_default_int(settings, KEY_LEVEL, static_cast<int64_t>(level::UNKNOWN));
|
obs_data_set_default_int(settings, ST_KEY_LEVEL, static_cast<int64_t>(level::UNKNOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nvenc_hevc_handler::has_keyframe_support(ffmpeg_factory*)
|
bool nvenc_hevc_handler::has_keyframe_support(ffmpeg_factory*)
|
||||||
|
@ -109,19 +109,19 @@ void nvenc_hevc_handler::update(obs_data_t* settings, const AVCodec* codec, AVCo
|
||||||
nvenc::update(settings, codec, context);
|
nvenc::update(settings, codec, context);
|
||||||
|
|
||||||
{ // HEVC Options
|
{ // HEVC Options
|
||||||
auto found = profiles.find(static_cast<profile>(obs_data_get_int(settings, KEY_PROFILE)));
|
auto found = profiles.find(static_cast<profile>(obs_data_get_int(settings, ST_KEY_PROFILE)));
|
||||||
if (found != profiles.end()) {
|
if (found != profiles.end()) {
|
||||||
av_opt_set(context->priv_data, "profile", found->second.c_str(), 0);
|
av_opt_set(context->priv_data, "profile", found->second.c_str(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto found = tiers.find(static_cast<tier>(obs_data_get_int(settings, KEY_TIER)));
|
auto found = tiers.find(static_cast<tier>(obs_data_get_int(settings, ST_KEY_TIER)));
|
||||||
if (found != tiers.end()) {
|
if (found != tiers.end()) {
|
||||||
av_opt_set(context->priv_data, "tier", found->second.c_str(), 0);
|
av_opt_set(context->priv_data, "tier", found->second.c_str(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto found = levels.find(static_cast<level>(obs_data_get_int(settings, KEY_LEVEL)));
|
auto found = levels.find(static_cast<level>(obs_data_get_int(settings, ST_KEY_LEVEL)));
|
||||||
if (found != levels.end()) {
|
if (found != levels.end()) {
|
||||||
av_opt_set(context->priv_data, "level", found->second.c_str(), 0);
|
av_opt_set(context->priv_data, "level", found->second.c_str(), 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -156,29 +156,29 @@ void nvenc_hevc_handler::get_encoder_properties(obs_properties_t* props, const A
|
||||||
obs_properties_t* grp = props;
|
obs_properties_t* grp = props;
|
||||||
if (!util::are_property_groups_broken()) {
|
if (!util::are_property_groups_broken()) {
|
||||||
grp = obs_properties_create();
|
grp = obs_properties_create();
|
||||||
obs_properties_add_group(props, P_HEVC, D_TRANSLATE(P_HEVC), OBS_GROUP_NORMAL, grp);
|
obs_properties_add_group(props, S_CODEC_HEVC, D_TRANSLATE(S_CODEC_HEVC), OBS_GROUP_NORMAL, grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, KEY_PROFILE, D_TRANSLATE(P_HEVC_PROFILE), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_PROFILE, D_TRANSLATE(S_CODEC_HEVC_PROFILE),
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(profile::UNKNOWN));
|
||||||
for (auto const kv : profiles) {
|
for (auto const kv : profiles) {
|
||||||
std::string trans = std::string(P_HEVC_PROFILE) + "." + kv.second;
|
std::string trans = std::string(S_CODEC_HEVC_PROFILE) + "." + kv.second;
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, KEY_TIER, D_TRANSLATE(P_HEVC_TIER), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_TIER, D_TRANSLATE(S_CODEC_HEVC_TIER), OBS_COMBO_TYPE_LIST,
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(tier::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(tier::UNKNOWN));
|
||||||
for (auto const kv : tiers) {
|
for (auto const kv : tiers) {
|
||||||
std::string trans = std::string(P_HEVC_TIER) + "." + kv.second;
|
std::string trans = std::string(S_CODEC_HEVC_TIER) + "." + kv.second;
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
obs_property_list_add_int(p, D_TRANSLATE(trans.c_str()), static_cast<int64_t>(kv.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_list(grp, KEY_LEVEL, D_TRANSLATE(P_HEVC_LEVEL), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_KEY_LEVEL, D_TRANSLATE(S_CODEC_HEVC_LEVEL), OBS_COMBO_TYPE_LIST,
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
|
||||||
for (auto const kv : levels) {
|
for (auto const kv : levels) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ void prores_aw_handler::override_colorformat(AVPixelFormat& target_format, obs_d
|
||||||
std::pair{profile::AP4H, AV_PIX_FMT_YUV444P10}, std::pair{profile::AP4X, AV_PIX_FMT_YUV444P10},
|
std::pair{profile::AP4H, AV_PIX_FMT_YUV444P10}, std::pair{profile::AP4X, AV_PIX_FMT_YUV444P10},
|
||||||
};
|
};
|
||||||
|
|
||||||
const int64_t profile_id = obs_data_get_int(settings, P_PRORES_PROFILE);
|
const int64_t profile_id = obs_data_get_int(settings, S_CODEC_PRORES_PROFILE);
|
||||||
for (auto kv : profile_to_format_map) {
|
for (auto kv : profile_to_format_map) {
|
||||||
if (kv.first == static_cast<profile>(profile_id)) {
|
if (kv.first == static_cast<profile>(profile_id)) {
|
||||||
target_format = kv.second;
|
target_format = kv.second;
|
||||||
|
@ -53,7 +53,7 @@ void prores_aw_handler::override_colorformat(AVPixelFormat& target_format, obs_d
|
||||||
|
|
||||||
void prores_aw_handler::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*, bool)
|
void prores_aw_handler::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*, bool)
|
||||||
{
|
{
|
||||||
obs_data_set_default_int(settings, P_PRORES_PROFILE, 0);
|
obs_data_set_default_int(settings, S_CODEC_PRORES_PROFILE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool prores_aw_handler::has_pixel_format_support(ffmpeg_factory* instance)
|
bool prores_aw_handler::has_pixel_format_support(ffmpeg_factory* instance)
|
||||||
|
@ -65,17 +65,17 @@ inline const char* profile_to_name(const AVProfile* ptr)
|
||||||
{
|
{
|
||||||
switch (static_cast<profile>(ptr->profile)) {
|
switch (static_cast<profile>(ptr->profile)) {
|
||||||
case profile::APCO:
|
case profile::APCO:
|
||||||
return D_TRANSLATE(P_PRORES_PROFILE_APCO);
|
return D_TRANSLATE(S_CODEC_PRORES_PROFILE_APCO);
|
||||||
case profile::APCS:
|
case profile::APCS:
|
||||||
return D_TRANSLATE(P_PRORES_PROFILE_APCS);
|
return D_TRANSLATE(S_CODEC_PRORES_PROFILE_APCS);
|
||||||
case profile::APCN:
|
case profile::APCN:
|
||||||
return D_TRANSLATE(P_PRORES_PROFILE_APCN);
|
return D_TRANSLATE(S_CODEC_PRORES_PROFILE_APCN);
|
||||||
case profile::APCH:
|
case profile::APCH:
|
||||||
return D_TRANSLATE(P_PRORES_PROFILE_APCH);
|
return D_TRANSLATE(S_CODEC_PRORES_PROFILE_APCH);
|
||||||
case profile::AP4H:
|
case profile::AP4H:
|
||||||
return D_TRANSLATE(P_PRORES_PROFILE_AP4H);
|
return D_TRANSLATE(S_CODEC_PRORES_PROFILE_AP4H);
|
||||||
case profile::AP4X:
|
case profile::AP4X:
|
||||||
return D_TRANSLATE(P_PRORES_PROFILE_AP4X);
|
return D_TRANSLATE(S_CODEC_PRORES_PROFILE_AP4X);
|
||||||
default:
|
default:
|
||||||
return ptr->name;
|
return ptr->name;
|
||||||
}
|
}
|
||||||
|
@ -84,19 +84,19 @@ inline const char* profile_to_name(const AVProfile* ptr)
|
||||||
void prores_aw_handler::get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context, bool)
|
void prores_aw_handler::get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context, bool)
|
||||||
{
|
{
|
||||||
if (!context) {
|
if (!context) {
|
||||||
auto p = obs_properties_add_list(props, P_PRORES_PROFILE, D_TRANSLATE(P_PRORES_PROFILE), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(props, S_CODEC_PRORES_PROFILE, D_TRANSLATE(S_CODEC_PRORES_PROFILE),
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||||
for (auto ptr = codec->profiles; ptr->profile != FF_PROFILE_UNKNOWN; ptr++) {
|
for (auto ptr = codec->profiles; ptr->profile != FF_PROFILE_UNKNOWN; ptr++) {
|
||||||
obs_property_list_add_int(p, profile_to_name(ptr), static_cast<int64_t>(ptr->profile));
|
obs_property_list_add_int(p, profile_to_name(ptr), static_cast<int64_t>(ptr->profile));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
obs_property_set_enabled(obs_properties_get(props, P_PRORES_PROFILE), false);
|
obs_property_set_enabled(obs_properties_get(props, S_CODEC_PRORES_PROFILE), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void prores_aw_handler::update(obs_data_t* settings, const AVCodec*, AVCodecContext* context)
|
void prores_aw_handler::update(obs_data_t* settings, const AVCodec*, AVCodecContext* context)
|
||||||
{
|
{
|
||||||
context->profile = static_cast<int>(obs_data_get_int(settings, P_PRORES_PROFILE));
|
context->profile = static_cast<int>(obs_data_get_int(settings, S_CODEC_PRORES_PROFILE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void prores_aw_handler::log_options(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context)
|
void prores_aw_handler::log_options(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context)
|
||||||
|
|
Loading…
Reference in a new issue