diff options
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; + } + } + } } } |