mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
encoders/handlers/nvenc: Fix incorrect values being logged
Fixes the issue where "high444p" shows as "high", and "high" shows as "main", caused by the internal option mapping never being correct across version changes. Instead of keeping our own copy of things that has to be adjusted for each FFmpeg version, it's easier to just use the FFmpeg values and names.
This commit is contained in:
parent
f7da7283fb
commit
6185de2170
3 changed files with 16 additions and 59 deletions
|
@ -133,20 +133,10 @@ void nvenc_h264_handler::log_options(obs_data_t* settings, const AVCodec* codec,
|
|||
nvenc::log_options(settings, codec, context);
|
||||
|
||||
DLOG_INFO("[%s] H.264/AVC:", codec->name);
|
||||
::ffmpeg::tools::print_av_option_string(context, "profile", " Profile", [](int64_t v) {
|
||||
profile val = static_cast<profile>(v);
|
||||
auto index = profiles.find(val);
|
||||
if (index != profiles.end())
|
||||
return index->second;
|
||||
return std::string("<Unknown>");
|
||||
});
|
||||
::ffmpeg::tools::print_av_option_string(context, "level", " Level", [](int64_t v) {
|
||||
level val = static_cast<level>(v);
|
||||
auto index = levels.find(val);
|
||||
if (index != levels.end())
|
||||
return index->second;
|
||||
return std::string("<Unknown>");
|
||||
});
|
||||
::ffmpeg::tools::print_av_option_string2(context, context->priv_data, "profile", " Profile",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
::ffmpeg::tools::print_av_option_string2(context, context->priv_data, "level", " Level",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
}
|
||||
|
||||
void nvenc_h264_handler::get_encoder_properties(obs_properties_t* props, const AVCodec* codec)
|
||||
|
|
|
@ -139,27 +139,12 @@ void nvenc_hevc_handler::log_options(obs_data_t* settings, const AVCodec* codec,
|
|||
nvenc::log_options(settings, codec, context);
|
||||
|
||||
DLOG_INFO("[%s] H.265/HEVC:", codec->name);
|
||||
::ffmpeg::tools::print_av_option_string(context, "profile", " Profile", [](int64_t v) {
|
||||
profile val = static_cast<profile>(v);
|
||||
auto index = profiles.find(val);
|
||||
if (index != profiles.end())
|
||||
return index->second;
|
||||
return std::string("<Unknown>");
|
||||
});
|
||||
::ffmpeg::tools::print_av_option_string(context, "level", " Level", [](int64_t v) {
|
||||
level val = static_cast<level>(v);
|
||||
auto index = levels.find(val);
|
||||
if (index != levels.end())
|
||||
return index->second;
|
||||
return std::string("<Unknown>");
|
||||
});
|
||||
::ffmpeg::tools::print_av_option_string(context, "tier", " Tier", [](int64_t v) {
|
||||
tier val = static_cast<tier>(v);
|
||||
auto index = tiers.find(val);
|
||||
if (index != tiers.end())
|
||||
return index->second;
|
||||
return std::string("<Unknown>");
|
||||
});
|
||||
::ffmpeg::tools::print_av_option_string2(context, "profile", " Profile",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
::ffmpeg::tools::print_av_option_string2(context, "level", " Level",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
::ffmpeg::tools::print_av_option_string2(context, "tier", " Tier",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
}
|
||||
|
||||
void nvenc_hevc_handler::get_encoder_properties(obs_properties_t* props, const AVCodec* codec)
|
||||
|
|
|
@ -701,22 +701,10 @@ void nvenc::log_options(obs_data_t*, const AVCodec* codec, AVCodecContext* conte
|
|||
using namespace ::ffmpeg;
|
||||
|
||||
DLOG_INFO("[%s] Nvidia NVENC:", codec->name);
|
||||
tools::print_av_option_string(context, "preset", " Preset", [](int64_t v) {
|
||||
preset val = static_cast<preset>(v);
|
||||
std::string name = "<Default>";
|
||||
auto index = preset_to_opt.find(val);
|
||||
if (index != preset_to_opt.end())
|
||||
name = index->second;
|
||||
return name;
|
||||
});
|
||||
tools::print_av_option_string(context, "rc", " Rate Control", [](int64_t v) {
|
||||
ratecontrolmode val = static_cast<ratecontrolmode>(v);
|
||||
std::string name = "<Default>";
|
||||
auto index = ratecontrolmode_to_opt.find(val);
|
||||
if (index != ratecontrolmode_to_opt.end())
|
||||
name = index->second;
|
||||
return name;
|
||||
});
|
||||
tools::print_av_option_string2(context, "preset", " Preset",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
tools::print_av_option_string2(context, "rc", " Rate Control",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
tools::print_av_option_bool(context, "2pass", " Two Pass");
|
||||
tools::print_av_option_int(context, "rc-lookahead", " Look-Ahead", "Frames");
|
||||
tools::print_av_option_bool(context, "no-scenecut", " Adaptive I-Frames", true);
|
||||
|
@ -738,14 +726,8 @@ void nvenc::log_options(obs_data_t*, const AVCodec* codec, AVCodecContext* conte
|
|||
tools::print_av_option_int(context, "init_qpB", " B-Frame", "");
|
||||
|
||||
tools::print_av_option_int(context, "bf", " B-Frames", "Frames");
|
||||
tools::print_av_option_string(context, "b_ref_mode", " Reference Mode", [](int64_t v) {
|
||||
b_ref_mode val = static_cast<b_ref_mode>(v);
|
||||
std::string name = "<Default>";
|
||||
auto index = b_ref_mode_to_opt.find(val);
|
||||
if (index != b_ref_mode_to_opt.end())
|
||||
name = index->second;
|
||||
return name;
|
||||
});
|
||||
tools::print_av_option_string2(context, "b_ref_mode", " Reference Mode",
|
||||
[](int64_t v, std::string_view o) { return std::string(o); });
|
||||
|
||||
DLOG_INFO("[%s] Adaptive Quantization:", codec->name);
|
||||
if (strcmp(codec->name, "h264_nvenc") == 0) {
|
||||
|
|
Loading…
Reference in a new issue