From 070fc41918127cb9c945bf197e5147c197be10d6 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 10 Aug 2020 16:44:00 +0200 Subject: [PATCH] encoders/handlers/nvenc: Make code C++ standard compliant again --- source/encoders/handlers/nvenc_h264_handler.cpp | 4 ++-- source/encoders/handlers/nvenc_hevc_handler.cpp | 6 +++--- source/encoders/handlers/nvenc_shared.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/encoders/handlers/nvenc_h264_handler.cpp b/source/encoders/handlers/nvenc_h264_handler.cpp index 12fbf547..6cb8d50d 100644 --- a/source/encoders/handlers/nvenc_h264_handler.cpp +++ b/source/encoders/handlers/nvenc_h264_handler.cpp @@ -45,14 +45,14 @@ extern "C" { using namespace streamfx::encoder::ffmpeg::handler; using namespace streamfx::encoder::codec::h264; -std::map profiles{ +static std::map profiles{ {profile::BASELINE, "baseline"}, {profile::MAIN, "main"}, {profile::HIGH, "high"}, {profile::HIGH444_PREDICTIVE, "high444p"}, }; -std::map levels{ +static std::map levels{ {level::L1_0, "1.0"}, {level::L1_0b, "1.0b"}, {level::L1_1, "1.1"}, {level::L1_2, "1.2"}, {level::L1_3, "1.3"}, {level::L2_0, "2.0"}, {level::L2_1, "2.1"}, {level::L2_2, "2.2"}, {level::L3_0, "3.0"}, {level::L3_1, "3.1"}, {level::L3_2, "3.2"}, {level::L4_0, "4.0"}, diff --git a/source/encoders/handlers/nvenc_hevc_handler.cpp b/source/encoders/handlers/nvenc_hevc_handler.cpp index 44060278..07b25d98 100644 --- a/source/encoders/handlers/nvenc_hevc_handler.cpp +++ b/source/encoders/handlers/nvenc_hevc_handler.cpp @@ -42,18 +42,18 @@ extern "C" { using namespace streamfx::encoder::ffmpeg::handler; using namespace streamfx::encoder::codec::hevc; -std::map profiles{ +static std::map profiles{ {profile::MAIN, "main"}, {profile::MAIN10, "main10"}, {profile::RANGE_EXTENDED, "rext"}, }; -std::map tiers{ +static std::map tiers{ {tier::MAIN, "main"}, {tier::HIGH, "high"}, }; -std::map levels{ +static std::map levels{ {level::L1_0, "1.0"}, {level::L2_0, "2.0"}, {level::L2_1, "2.1"}, {level::L3_0, "3.0"}, {level::L3_1, "3.1"}, {level::L4_0, "4.0"}, {level::L4_1, "4.1"}, {level::L5_0, "5.0"}, {level::L5_1, "5.1"}, {level::L5_2, "5.2"}, {level::L6_0, "6.0"}, {level::L6_1, "6.1"}, {level::L6_2, "6.2"}, diff --git a/source/encoders/handlers/nvenc_shared.cpp b/source/encoders/handlers/nvenc_shared.cpp index 91bb24e2..ae9e24c5 100644 --- a/source/encoders/handlers/nvenc_shared.cpp +++ b/source/encoders/handlers/nvenc_shared.cpp @@ -169,11 +169,11 @@ void nvenc::override_update(ffmpeg_instance* instance, obs_data_t*) // Calculate and set the number of surfaces to allocate (if not user overridden). if (surfaces == 0) { - surfaces = std::max(4ll, (context->max_b_frames + 1ll) * 4ll); + surfaces = std::max(4ll, (context->max_b_frames + 1ll) * 4ll); if (rclookahead > 0) { - surfaces = std::max(1ll, std::max(surfaces, rclookahead + (context->max_b_frames + 5ll))); + surfaces = std::max(1ll, std::max(surfaces, rclookahead + (context->max_b_frames + 5ll))); } else if (context->max_b_frames > 0) { - surfaces = std::max(4ll, (context->max_b_frames + 1ll) * 4ll); + surfaces = std::max(4ll, (context->max_b_frames + 1ll) * 4ll); } else { surfaces = 4; } @@ -182,7 +182,7 @@ void nvenc::override_update(ffmpeg_instance* instance, obs_data_t*) } // Set delay - context->delay = static_cast(std::min(std::max(async_depth, 3ll), surfaces - 1)); + context->delay = std::min(std::max(async_depth, 3ll), surfaces - 1); } void nvenc::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*) @@ -440,7 +440,7 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec) obs_properties_add_list(grp, KEY_OTHER_BFRAMEREFERENCEMODE, D_TRANSLATE(ST_OTHER_BFRAMEREFERENCEMODE), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); for (auto kv : b_ref_modes) { - if (kv.first == nvenc::b_ref_mode::EACH && (static std::string_view("h264_nvenc") == codec->name)) { + if (kv.first == nvenc::b_ref_mode::EACH && (std::string_view("h264_nvenc") == codec->name)) { // H.264 does not support using all B-Frames as reference. continue; }