From d90706da2eed392b6d5c26171bdde0e5425be9c0 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 15 Jan 2017 14:31:40 +0000 Subject: WinGui: Use new hb_opencl_set_enable function. #496 --- win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs | 4 +++- win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs | 3 +++ .../Interop/Interfaces/IHandBrakeInstance.cs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'win/CS/HandBrake.ApplicationServices') 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. -- cgit v1.2.3