From: Scott Date: Thu, 24 Sep 2015 19:44:55 +0000 (+0100) Subject: WinGui: Enable support for H.265 QuickSync support X-Git-Tag: 1.0.0~928 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7912cc00a8aa031e494bb6f0554939059da89d3;p=handbrake WinGui: Enable support for H.265 QuickSync support --- diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs index 80f9e33be..0bcbc18cf 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs @@ -45,6 +45,10 @@ namespace HandBrake.ApplicationServices.Interop.HbLib public const uint HB_ACODEC_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG); public const uint HB_ACODEC_TRUEHD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD); + // VideoEncoders + public const uint HB_VCODEC_QSV_H264 = 0x0000100; + public const uint HB_VCODEC_QSV_H265 = 0x0000200; + public const uint HB_VCODEC_QSV_MASK = 0x0000F00; // Encode state public const int HB_STATE_IDLE = 1; diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs index 17ed82aef..4f30b5df3 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs @@ -26,6 +26,10 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding [ShortName("qsv_h264")] QuickSync, + [Display(Name = "H.265 (Intel QSV)")] + [ShortName("qsv_h265")] + QuickSyncH265, + [Display(Name = "MPEG-4")] [ShortName("mpeg4")] FFMpeg, diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs index 2055fab90..ab11d71a9 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs @@ -1,4 +1,4 @@ -// -------------------------------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // @@ -81,6 +81,44 @@ namespace HandBrake.ApplicationServices.Utilities } } + /// + /// Gets a value indicating whether is qsv available. + /// + public static bool IsQsvAvailableH264 + { + get + { + try + { + return HBFunctions.hb_qsv_available() == NativeConstants.HB_VCODEC_QSV_H264; + } + catch (Exception) + { + // Silent failure. Typically this means the dll hasn't been built with --enable-qsv + return false; + } + } + } + + /// + /// Gets a value indicating whether is qsv available. + /// + public static bool IsQsvAvailableH265 + { + get + { + try + { + return HBFunctions.hb_qsv_available() == NativeConstants.HB_VCODEC_QSV_H265; + } + catch (Exception) + { + // Silent failure. Typically this means the dll hasn't been built with --enable-qsv + return false; + } + } + } + /// /// Gets the get gpu driver version. /// diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs index ffe11ffef..d0ef60775 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs @@ -57,11 +57,17 @@ namespace HandBrakeWPF.Converters.Video encoders.Remove(VideoEncoder.VP8); } - if (!SystemInfo.IsQsvAvailable) + if (!SystemInfo.IsQsvAvailableH264) { encoders.Remove(VideoEncoder.QuickSync); } + if (!SystemInfo.IsQsvAvailableH265) + { + encoders.Remove(VideoEncoder.QuickSyncH265); + } + + return EnumHelper.GetEnumDisplayValuesSubset(encoders); }