diff options
Diffstat (limited to 'win/CS/HandBrake.Interop')
4 files changed, 49 insertions, 12 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs index 742f63aea..c3b99c735 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs @@ -301,5 +301,11 @@ namespace HandBrake.Interop.Interop.HbLib [DllImport("hb", EntryPoint = "hb_filter_get_tunes_json", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr hb_filter_get_tunes_json(int filter_id); + + [DllImport("hb", EntryPoint = "hb_get_cpu_platform", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_get_cpu_platform(); + + [DllImport("hb", EntryPoint = "qsv_hardware_generation", CallingConvention = CallingConvention.Cdecl)] + public static extern int qsv_hardware_generation(int cpu_platform); } } diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/HbFunctionsDirect.cs b/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/HbFunctionsDirect.cs index b98794d5d..7a892dc22 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/HbFunctionsDirect.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/HbFunctionsDirect.cs @@ -497,5 +497,15 @@ namespace HandBrake.Interop.Interop.HbLib.Wrappers { return HBFunctions.hb_filter_get_tunes_json(filter_id); } + + public int hb_get_cpu_platform() + { + return HBFunctions.hb_get_cpu_platform(); + } + + public int qsv_hardware_generation(int cpu_platform) + { + return HBFunctions.qsv_hardware_generation(cpu_platform); + } } } diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/Interfaces/IHbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/Interfaces/IHbFunctions.cs index b876c9f16..01c8e614b 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/Interfaces/IHbFunctions.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/Interfaces/IHbFunctions.cs @@ -211,5 +211,9 @@ namespace HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces IntPtr hb_filter_get_presets_json(int filter_id); IntPtr hb_filter_get_tunes_json(int filter_id); + + int hb_get_cpu_platform(); + + int qsv_hardware_generation(int cpu_platform); } } diff --git a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs index b22e16d6c..6a0c72283 100644 --- a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs @@ -10,6 +10,7 @@ namespace HandBrake.Interop.Utilities { using System; + using System.Diagnostics; using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Providers; @@ -17,9 +18,6 @@ namespace HandBrake.Interop.Utilities using Interop.HbLib; - /// <summary> - /// The System Information. - /// </summary> public class SystemInfo { private static bool? isNvencH264Available; // Local cache to prevent log spam. @@ -33,9 +31,9 @@ namespace HandBrake.Interop.Utilities hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); } - /// <summary> - /// Gets a value indicating whether is qsv available. - /// </summary> + + /* QuickSync Support */ + public static bool IsQsvAvailable { get @@ -52,9 +50,6 @@ namespace HandBrake.Interop.Utilities } } - /// <summary> - /// Gets a value indicating whether is qsv available. - /// </summary> public static bool IsQsvAvailableH264 { get @@ -71,9 +66,6 @@ namespace HandBrake.Interop.Utilities } } - /// <summary> - /// Gets a value indicating whether is qsv available. - /// </summary> public static bool IsQsvAvailableH265 { get @@ -90,6 +82,26 @@ namespace HandBrake.Interop.Utilities } } + public static int QsvHardwareGeneration + { + get + { + try + { + int cpu_platform = hbFunctions.hb_get_cpu_platform(); + int hardware = hbFunctions.qsv_hardware_generation(cpu_platform); + return hardware; + } + catch (Exception exc) + { + // Silent failure. -1 means unsupported. + Debug.WriteLine(exc); + return -1; + } + } + } + + public static bool IsQsvAvailableH26510bit { get @@ -106,6 +118,9 @@ namespace HandBrake.Interop.Utilities } } + + /* AMD VCE Support */ + public static bool IsVceH264Available { get @@ -138,6 +153,8 @@ namespace HandBrake.Interop.Utilities } } + /* Nvidia NVEnc Support */ + public static bool IsNVEncH264Available { get |