diff options
Diffstat (limited to 'win/CS/HandBrake.Interop')
3 files changed, 65 insertions, 1 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs index 65b81c509..8e36dc6c6 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs @@ -415,6 +415,12 @@ namespace HandBrake.Interop.Interop.HbLib [DllImport("hb", EntryPoint = "hb_vce_h265_available", CallingConvention = CallingConvention.Cdecl)] public static extern int hb_vce_h265_available(); + [DllImport("hb", EntryPoint = "hb_nvenc_h264_available", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_nvenc_h264_available(); + + [DllImport("hb", EntryPoint = "hb_nvenc_h265_available", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_nvenc_h265_available(); + // hb_image_t* hb_get_preview2(hb_handle_t* h, int title_idx, int picture, hb_geometry_settings_t* geo, int deinterlace); [DllImport("hb", EntryPoint = "hb_get_preview2", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr hb_get_preview2(IntPtr hbHandle, int title_idx, int preview_idx, ref hb_geometry_settings_s geo, int deinterlace); diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs index a5aded796..e8a2ed485 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs @@ -30,8 +30,12 @@ namespace HandBrake.Interop.Interop.Model.Encoding [DisplayName("H.264 (AMD VCE)")] [ShortName("vce_h264")] - VceH264, + VceH264, + [DisplayName("H.264 (Nvidia NVEnc)")] + [ShortName("nvenc_h264")] + NvencH264, + [DisplayName("MPEG-4")] [ShortName("mpeg4")] FFMpeg, @@ -68,6 +72,10 @@ namespace HandBrake.Interop.Interop.Model.Encoding [ShortName("vce_h265")] VceH265, + [DisplayName("H.265 (Nvidia NVEnc)")] + [ShortName("nvenc_h265")] + NvencH265, + [DisplayName("VP8")] [ShortName("VP8")] VP8, 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; + } + } + } } } |