diff options
Diffstat (limited to 'win/CS/HandBrake.Interop/Interop')
4 files changed, 42 insertions, 60 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs index 9f5420d3f..a5aef04a6 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs @@ -421,6 +421,22 @@ namespace HandBrake.Interop.Interop } /// <summary> + /// Checks the status of the ongoing encode. + /// </summary> + /// <returns> + /// The <see cref="JsonState"/>. + /// </returns> + [HandleProcessCorruptedStateExceptions] + public JsonState GetEncodeProgress() + { + IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle); + string statusJson = Marshal.PtrToStringAnsi(json); + + JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson); + return state; + } + + /// <summary> /// Frees any resources associated with this object. /// </summary> public void Dispose() diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs index 07ddb8a15..227fa0bd1 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs @@ -12,6 +12,7 @@ namespace HandBrake.Interop.Interop using System; using HandBrake.Interop.Interop.Interfaces; + using HandBrake.Interop.Model; /// <summary> /// The HandBrake Instance manager. @@ -20,7 +21,6 @@ namespace HandBrake.Interop.Interop public static class HandBrakeInstanceManager { private static HandBrakeInstance scanInstance; - private static HandBrakeInstance encodeInstance; private static HandBrakeInstance previewInstance; private static HandBrakeInstance masterInstance; @@ -71,34 +71,13 @@ namespace HandBrake.Interop.Interop /// <param name="verbosity"> /// The verbosity. /// </param> - /// <returns> - /// The <see cref="IHandBrakeInstance"/>. - /// </returns> - public static IHandBrakeInstance GetEncodeInstance(int verbosity) - { - if (encodeInstance != null) - { - encodeInstance.Dispose(); - encodeInstance = null; - } - - HandBrakeInstance newInstance = new HandBrakeInstance(); - newInstance.Initialize(verbosity); - encodeInstance = newInstance; - - return encodeInstance; - } - - /// <summary> - /// The get encode instance. - /// </summary> - /// <param name="verbosity"> - /// The verbosity. + /// <param name="configuration"> + /// The configuration. /// </param> /// <returns> /// The <see cref="IHandBrakeInstance"/>. /// </returns> - public static IHandBrakeInstance GetPreviewInstance(int verbosity) + public static IHandBrakeInstance GetPreviewInstance(int verbosity, HBConfiguration configuration) { if (previewInstance != null) { @@ -110,6 +89,8 @@ namespace HandBrake.Interop.Interop newInstance.Initialize(verbosity); previewInstance = newInstance; + HandBrakeUtils.SetDvdNav(!configuration.IsDvdNavDisabled); + return previewInstance; } @@ -145,27 +126,5 @@ namespace HandBrake.Interop.Interop return scanInstance.Handle; } } - - /// <summary> - /// Gets the last encode scan instance. - /// </summary> - internal static IHandBrakeInstance LastEncodeScanInstance - { - get - { - return encodeInstance; - } - } - - /// <summary> - /// Gets the encode handle. - /// </summary> - internal static IntPtr LastEncodeHandle - { - get - { - return encodeInstance.Handle; - } - } } } diff --git a/win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs b/win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs index 68fd266f0..f0c4a2575 100644 --- a/win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/Interfaces/IEncodeInstance.cs @@ -13,6 +13,7 @@ namespace HandBrake.Interop.Interop.Interfaces using HandBrake.Interop.Interop.EventArgs; using HandBrake.Interop.Interop.Json.Encode; + using HandBrake.Interop.Interop.Json.State; public interface IEncodeInstance { @@ -27,6 +28,19 @@ namespace HandBrake.Interop.Interop.Interfaces event EventHandler<EncodeProgressEventArgs> EncodeProgress; /// <summary> + /// Initializes this instance. + /// </summary> + /// <param name="verbosity"> + /// The code for the logging verbosity to use. + /// </param> + void Initialize(int verbosity); + + /// <summary> + /// Frees any resources associated with this object. + /// </summary> + void Dispose(); + + /// <summary> /// Pauses the current encode. /// </summary> void PauseEncode(); @@ -48,5 +62,11 @@ namespace HandBrake.Interop.Interop.Interfaces /// Stops the current encode. /// </summary> void StopEncode(); + + /// <summary> + /// Get the current Encode State. + /// </summary> + /// <returns>A JsonState object</returns> + JsonState GetEncodeProgress(); } }
\ 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 b6d46c80c..193769090 100644 --- a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs @@ -61,19 +61,6 @@ namespace HandBrake.Interop.Interop.Interfaces #region Public Methods /// <summary> - /// Initializes this instance. - /// </summary> - /// <param name="verbosity"> - /// The code for the logging verbosity to use. - /// </param> - void Initialize(int verbosity); - - /// <summary> - /// Frees any resources associated with this object. - /// </summary> - void Dispose(); - - /// <summary> /// Gets an image for the given job and preview /// </summary> /// <remarks> |