From efa5ffcc7d1af8ecc8b1f25c91c9faca3235c96b Mon Sep 17 00:00:00 2001 From: Jerome Martinez Date: Fri, 15 Nov 2024 10:45:51 +0100 Subject: [PATCH] Add GPU acceleration option --- Source/CLI/Global.cpp | 12 ++++++++++++ Source/Lib/License/License.h | 1 + Source/Lib/License/License_Internal.h | 1 + 3 files changed, 14 insertions(+) diff --git a/Source/CLI/Global.cpp b/Source/CLI/Global.cpp index a4d60913..6db73062 100644 --- a/Source/CLI/Global.cpp +++ b/Source/CLI/Global.cpp @@ -321,6 +321,18 @@ int global::SetOption(const char* argv[], int& i, int argc) License.Encoder(encoder::FFV1); return 0; } + if (!strncmp(argv[i], "ffv1_vulkan", 11) && (!argv[i][11] || (argv[i][11] == ':' && argv[i][12] >= '0' && argv[i][12] <= '9' && !argv[i][13]))) + { + OutputOptions["c:v"] = "ffv1_vulkan"; + if (argv[i][11]) + OutputOptions["init_hw_device"] = "\"vulkan=vk" + string(argv[i] + 11) + '\"'; + else + OutputOptions["init_hw_device"] = "\"vulkan=vk:0\""; + OutputOptions["vf"] = "hwupload"; + License.Encoder(encoder::FFV1); + License.Feature(feature::HwAccel); + return 0; + } return Error_NotTested(argv[i - 1], argv[i]); } if (!strcmp(argv[i], "-coder")) diff --git a/Source/Lib/License/License.h b/Source/Lib/License/License.h index cdf625a6..d8f0d69f 100644 --- a/Source/Lib/License/License.h +++ b/Source/Lib/License/License.h @@ -24,6 +24,7 @@ ENUM_BEGIN(feature) EncodingOptions, MultipleTracks, SubLicense, + HwAccel, ENUM_END(feature) //--------------------------------------------------------------------------- diff --git a/Source/Lib/License/License_Internal.h b/Source/Lib/License/License_Internal.h index 0f57f7f1..806341fd 100644 --- a/Source/Lib/License/License_Internal.h +++ b/Source/Lib/License/License_Internal.h @@ -51,6 +51,7 @@ const feature_info FeatureInfos[] = { "Encoding options" }, { "More than 2 tracks" }, { "Sub-licensing" }, + { "Hardware acceleration" }, }; static_assert(sizeof(FeatureInfos) / sizeof(feature_info) == feature_Max, "feature_info issue");