From f40358afcf1cd4f3aa3301389b86db191c5cee2e Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 10 Jun 2018 13:38:13 +0100 Subject: [PATCH] WinGui: Split out the encode portion of IHandBrakeInstance into IEncodeInstance. API remains compatible. --- .../HandBrake.Interop.csproj | 1 + .../Interop/Interfaces/IEncodeInstance.cs | 52 +++++++++++++++++++ .../Interop/Interfaces/IHandBrakeInstance.cs | 39 ++------------ .../HandBrakeWPF/Services/Encode/LibEncode.cs | 2 +- 4 files changed, 58 insertions(+), 36 deletions(-) create mode 100644 win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs diff --git a/win/CS/HandBrake.Interop/HandBrake.Interop.csproj b/win/CS/HandBrake.Interop/HandBrake.Interop.csproj index 815a94be0..f7e9aa9b6 100644 --- a/win/CS/HandBrake.Interop/HandBrake.Interop.csproj +++ b/win/CS/HandBrake.Interop/HandBrake.Interop.csproj @@ -80,6 +80,7 @@ + diff --git a/win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs b/win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs new file mode 100644 index 000000000..68fd266f0 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs @@ -0,0 +1,52 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// Defines the encode portions of the IHandBrakeInstance +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop.Interfaces +{ + using System; + + using HandBrake.Interop.Interop.EventArgs; + using HandBrake.Interop.Interop.Json.Encode; + + public interface IEncodeInstance + { + /// + /// Fires when an encode has completed. + /// + event EventHandler EncodeCompleted; + + /// + /// Fires for progress updates when encoding. + /// + event EventHandler EncodeProgress; + + /// + /// Pauses the current encode. + /// + void PauseEncode(); + + /// + /// Resumes a paused encode. + /// + void ResumeEncode(); + + /// + /// Starts an encode with the given job. + /// + /// + /// The job to start. + /// + void StartEncode(JsonEncodeObject jobToStart); + + /// + /// Stops the current encode. + /// + void StopEncode(); + } +} \ No newline at end of file diff --git a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs index 7714e5222..b6d46c80c 100644 --- a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs @@ -12,27 +12,16 @@ namespace HandBrake.Interop.Interop.Interfaces using System; using HandBrake.Interop.Interop.EventArgs; - using HandBrake.Interop.Interop.Json.Encode; using HandBrake.Interop.Interop.Json.Scan; using HandBrake.Interop.Interop.Model.Preview; /// /// The Interface for HandBrakeInstance /// - public interface IHandBrakeInstance + public interface IHandBrakeInstance : IEncodeInstance { #region Events - /// - /// Fires when an encode has completed. - /// - event EventHandler EncodeCompleted; - - /// - /// Fires for progress updates when encoding. - /// - event EventHandler EncodeProgress; - /// /// Fires when a scan has completed. /// @@ -104,24 +93,6 @@ namespace HandBrake.Interop.Interop.Interfaces /// RawPreviewData GetPreview(PreviewSettings job, int previewNumber, bool deinterlace); - /// - /// Pauses the current encode. - /// - void PauseEncode(); - - /// - /// Resumes a paused encode. - /// - void ResumeEncode(); - - /// - /// Starts an encode with the given job. - /// - /// - /// The job to start. - /// - void StartEncode(JsonEncodeObject jobToStart); - /// /// Starts a scan of the given path. /// @@ -134,13 +105,11 @@ namespace HandBrake.Interop.Interop.Interfaces /// /// The min Duration. /// + /// + /// The title Index. + /// void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex); - /// - /// Stops the current encode. - /// - void StopEncode(); - /// /// Stop any running scans /// diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index 3d8e6c290..85c5a42b1 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -38,7 +38,7 @@ namespace HandBrakeWPF.Services.Encode #region Private Variables private ILog log = LogService.GetLogger(); - private IHandBrakeInstance instance; + private IEncodeInstance instance; private DateTime startTime; private EncodeTask currentTask; private HBConfiguration currentConfiguration; -- 2.40.0