diff options
author | Scott <[email protected]> | 2018-06-29 19:48:26 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2018-06-29 19:48:26 +0100 |
commit | dbf898635dc12608b78c33916137465ce08937bf (patch) | |
tree | 2449891c1f1275e43673b9aa276b8e8905374b55 /win/CS/HandBrake.Interop/Utilities/SystemInfo.cs | |
parent | ac390b630498163ff37bea491202c0872bb679ec (diff) |
Add NVEnc encoder. (Round 3) (#1437)
Adding the Nvidia NVEnc H.264 and H.265 encoders.
Based on Initial work by sgothel
--enable-nvenc is the new compile time configure option to enable for builds.
Diffstat (limited to 'win/CS/HandBrake.Interop/Utilities/SystemInfo.cs')
-rw-r--r-- | win/CS/HandBrake.Interop/Utilities/SystemInfo.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs index a364c50ac..454132b53 100644 --- a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs @@ -18,6 +18,9 @@ namespace HandBrake.Interop.Utilities /// </summary> public class SystemInfo { + private static bool? isNvencH264Available; // Local cache to prevent log spam. + private static bool? isNvencH265Available; + /// <summary> /// Gets a value indicating whether is qsv available. /// </summary> @@ -122,5 +125,52 @@ namespace HandBrake.Interop.Utilities } } } + + public static bool IsNVEncH264Available + { + get + { + try + { + if (isNvencH264Available == null) + { + isNvencH264Available = HBFunctions.hb_nvenc_h264_available() != 0; + } + + return isNvencH264Available.Value; + } + catch (Exception) + { + // Silent failure. Typically this means the dll hasn't been built with --enable-qsv + return false; + } + } + } + + public static bool IsNVEncH265Available + { + get + { + try + { + if (!IsNVEncH264Available) + { + return false; + } + + if (isNvencH265Available == null) + { + isNvencH265Available = HBFunctions.hb_nvenc_h265_available() != 0; + } + + return isNvencH265Available.Value; + } + catch (Exception) + { + // Silent failure. Typically this means the dll hasn't been built with --enable-qsv + return false; + } + } + } } } |