FF-171 - added ability to disable hardware encoders/decoders

This commit is contained in:
John Andrews
2022-07-07 19:59:57 +12:00
parent 26d4a7252c
commit 8757bd1d6f
16 changed files with 71 additions and 28 deletions

View File

@@ -5,8 +5,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>

View File

@@ -5,8 +5,8 @@
<Nullable>enable</Nullable>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>

View File

@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -5,8 +5,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -9,8 +9,8 @@
<PublishTrimmed>true</PublishTrimmed>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>

View File

@@ -5,8 +5,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -5,8 +5,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -5,8 +5,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -5,8 +5,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>

View File

@@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>

View File

@@ -108,6 +108,9 @@ namespace FileFlows.VideoNodes.FfmpegBuilderNodes
foreach(var hw in decoders)
{
if (CanUseHardwareEncoding.DisabledByVariables(Args, string.Join(" ", hw)))
continue;
try
{
var arguments = new List<string>()

View File

@@ -139,8 +139,48 @@ public class CanUseHardwareEncoding:Node
/// <returns>true if can use it, otherwise false</returns>
internal static bool CanProcess_Vaapi_H264(NodeParameters args) => CanProcess(args, "h264_vaapi");
/// <summary>
/// Gets if a encoder/decoder has been disabled by a variable
/// </summary>
/// <param name="args">the node parameters</param>
/// <param name="parameters">the parameters to check</param>
/// <returns>if a encoder/decoder has been disabled by a variable</returns>
internal static bool DisabledByVariables(NodeParameters args, string parameters)
{
if (parameters.ToLower().Contains("nvenc"))
{
if (args.GetVariable("NoNvidia") as bool? == true)
return true;
if (args.GetVariable("NoNVIDIA") as bool? == true)
return true;
}
else if (parameters.ToLower().Contains("qsv"))
{
if (args.GetVariable("NoQSV") as bool? == true)
return true;
}
else if (parameters.ToLower().Contains("vaapi"))
{
if (args.GetVariable("NoVAAPI") as bool? == true)
return true;
}
else if (parameters.ToLower().Contains("amf"))
{
if (args.GetVariable("NoAMF") as bool? == true)
return true;
if (args.GetVariable("NoAMD") as bool? == true)
return true;
}
return false;
}
private static bool CanProcess(NodeParameters args, string encodingParams)
{
if (DisabledByVariables(args, encodingParams))
return false;
string ffmpeg = args.GetToolPath("FFMpeg");
if (string.IsNullOrEmpty(ffmpeg))
{

View File

@@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>0.8.5.94</FileVersion>
<ProductVersion>0.8.5.94</ProductVersion>
<FileVersion>0.8.4.101</FileVersion>
<ProductVersion>0.8.4.101</ProductVersion>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>