From: sr55 Date: Sun, 15 Jan 2017 14:31:40 +0000 (+0000) Subject: WinGui: Use new hb_opencl_set_enable function. #496 X-Git-Tag: 1.0.2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79a6b92efced222cf504ac32571a87643ea9268f;p=handbrake WinGui: Use new hb_opencl_set_enable function. #496 --- diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs index 633c4e1fb..c39ad1534 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs @@ -217,11 +217,12 @@ namespace HandBrake.ApplicationServices.Interop /// /// The title index to scan (1-based, 0 for all titles). /// - public void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex) + public void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex, bool clEnabled = false) { this.previewCount = previewCount; IntPtr pathPtr = InteropUtilities.ToUtf8PtrFromString(path); + HBFunctions.hb_opencl_set_enable(this.hbHandle, clEnabled ? 1 : 0); HBFunctions.hb_scan(this.hbHandle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000)); Marshal.FreeHGlobal(pathPtr); @@ -388,6 +389,7 @@ namespace HandBrake.ApplicationServices.Interop NullValueHandling = NullValueHandling.Ignore, }; + HBFunctions.hb_opencl_set_enable(this.hbHandle, encodeObject.Video.OpenCL ? 1 : 0); string encode = JsonConvert.SerializeObject(encodeObject, Formatting.Indented, settings); HBFunctions.hb_add_json(this.hbHandle, InteropUtilities.ToUtf8PtrFromString(encode)); HBFunctions.hb_start(this.hbHandle); diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs index d844217b0..cc3baa119 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs @@ -71,6 +71,9 @@ namespace HandBrake.ApplicationServices.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_dvd_set_dvdnav", CallingConvention = CallingConvention.Cdecl)] public static extern void hb_dvd_set_dvdnav(int enable); + // void hb_opencl_set_enable(hb_handle_t* h, int enable_opencl); + [DllImport("hb.dll", EntryPoint = "hb_dvd_set_dvdnav", CallingConvention = CallingConvention.Cdecl)] + public static extern void hb_opencl_set_enable(IntPtr hbHandle, int enable); /// Return Type: void ///param0: hb_handle_t* diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs index 4b540a770..3e756d228 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs @@ -135,7 +135,7 @@ namespace HandBrake.ApplicationServices.Interop.Interfaces /// /// The title index to scan (1-based, 0 for all titles). /// - void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex); + void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex, bool clEnabled = false); /// /// Stops the current encode. diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index bd1f4cf12..2d875ca0c 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -245,7 +245,7 @@ namespace HandBrakeWPF.Services.Scan HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled); this.ServiceLogMessage("Starting Scan ..."); - this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0); + this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0, configuraiton.ScalingMode == VideoScaler.BicubicCl); if (this.ScanStarted != null) this.ScanStarted(this, System.EventArgs.Empty);