encoders/handlers/amf: Apply coding guidelines

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-08 04:03:09 +02:00
parent 13d80dbfbe
commit 0d13d43dd8
2 changed files with 20 additions and 20 deletions

View file

@ -35,8 +35,8 @@ extern "C" {
}
// Settings
#define KEY_PROFILE "H264.Profile"
#define KEY_LEVEL "H264.Level"
#define ST_KEY_PROFILE "H264.Profile"
#define ST_KEY_LEVEL "H264.Level"
using namespace streamfx::encoder::ffmpeg::handler;
using namespace streamfx::encoder::codec::h264;
@ -66,8 +66,8 @@ void amf_h264_handler::get_defaults(obs_data_t* settings, const AVCodec* codec,
{
amf::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, KEY_LEVEL, static_cast<int64_t>(level::UNKNOWN));
obs_data_set_default_int(settings, ST_KEY_PROFILE, static_cast<int64_t>(profile::HIGH));
obs_data_set_default_int(settings, ST_KEY_LEVEL, static_cast<int64_t>(level::UNKNOWN));
}
bool amf_h264_handler::has_keyframe_support(ffmpeg_factory* instance)
@ -105,14 +105,14 @@ void amf_h264_handler::update(obs_data_t* settings, const AVCodec* codec, AVCode
amf::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()) {
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()) {
av_opt_set(context->priv_data, "level", found->second.c_str(), 0);
} else {
@ -146,7 +146,7 @@ void amf_h264_handler::get_encoder_properties(obs_properties_t* props, const AVC
obs_properties_add_group(props, P_H264, D_TRANSLATE(P_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(P_H264_PROFILE), 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));
for (auto const kv : profiles) {
@ -155,7 +155,7 @@ void amf_h264_handler::get_encoder_properties(obs_properties_t* props, const AVC
}
}
{
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(P_H264_LEVEL), OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
for (auto const kv : levels) {

View file

@ -34,9 +34,9 @@ extern "C" {
}
// Settings
#define KEY_PROFILE "H265.Profile"
#define KEY_TIER "H265.Tier"
#define KEY_LEVEL "H265.Level"
#define ST_KEY_PROFILE "H265.Profile"
#define ST_KEY_TIER "H265.Tier"
#define ST_KEY_LEVEL "H265.Level"
using namespace streamfx::encoder::ffmpeg::handler;
using namespace streamfx::encoder::codec::hevc;
@ -68,9 +68,9 @@ void amf_hevc_handler::get_defaults(obs_data_t* settings, const AVCodec* codec,
{
amf::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, 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_PROFILE, 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, ST_KEY_LEVEL, static_cast<int64_t>(level::UNKNOWN));
}
bool amf_hevc_handler::has_keyframe_support(ffmpeg_factory*)
@ -107,19 +107,19 @@ void amf_hevc_handler::update(obs_data_t* settings, const AVCodec* codec, AVCode
amf::update(settings, codec, context);
{ // 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()) {
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()) {
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()) {
av_opt_set(context->priv_data, "level", found->second.c_str(), 0);
} else {
@ -155,7 +155,7 @@ void amf_hevc_handler::get_encoder_properties(obs_properties_t* props, const AVC
obs_properties_add_group(props, P_HEVC, D_TRANSLATE(P_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(P_HEVC_PROFILE), 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));
for (auto const kv : profiles) {
@ -164,7 +164,7 @@ void amf_hevc_handler::get_encoder_properties(obs_properties_t* props, const AVC
}
}
{
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(P_HEVC_TIER), OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), static_cast<int64_t>(tier::UNKNOWN));
for (auto const kv : tiers) {
@ -173,7 +173,7 @@ void amf_hevc_handler::get_encoder_properties(obs_properties_t* props, const AVC
}
}
{
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(P_HEVC_LEVEL), OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(level::UNKNOWN));
for (auto const kv : levels) {