summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Interop
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-04-15 12:26:59 +0100
committersr55 <[email protected]>2017-04-15 12:27:19 +0100
commit52d4c21b22cfc91b63a680aa7e475cc0ca6012cb (patch)
treed742c17b8ddff744d10ec5ee79344355aa17a907 /win/CS/HandBrake.ApplicationServices/Interop
parenta0fefdaf374c7e7b0bbf58482b86bac03d673a7c (diff)
WinGui: Handle HB_STATE_MUXING and HB_STATE_SEARCHING for better progress indication in the UI. #676
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Interop')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs36
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs6
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs1
3 files changed, 39 insertions, 4 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs
index 5fad3248c..0da2fd178 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs
@@ -40,7 +40,13 @@ namespace HandBrake.ApplicationServices.Interop.EventArgs
/// <param name="passCount">
/// The pass count.
/// </param>
- public EncodeProgressEventArgs(double fractionComplete, double currentFrameRate, double averageFrameRate, TimeSpan estimatedTimeLeft, int passId, int pass, int passCount)
+ /// <param name="isMuxing">
+ /// A flag to indicate we are muxing.
+ /// </param>
+ /// <param name="isSearching">
+ /// Gets a value indicating that we are in the searching process.
+ /// </param>
+ public EncodeProgressEventArgs(double fractionComplete, double currentFrameRate, double averageFrameRate, TimeSpan estimatedTimeLeft, int passId, int pass, int passCount, bool isMuxing, bool isSearching)
{
this.FractionComplete = fractionComplete;
this.CurrentFrameRate = currentFrameRate;
@@ -49,6 +55,8 @@ namespace HandBrake.ApplicationServices.Interop.EventArgs
this.PassId = passId;
this.Pass = pass;
this.PassCount = passCount;
+ this.IsMuxing = isMuxing;
+ this.IsSearching = isSearching;
}
/// <summary>
@@ -91,5 +99,31 @@ namespace HandBrake.ApplicationServices.Interop.EventArgs
/// Gets the pass count.
/// </summary>
public int PassCount { get; private set; }
+
+ /// <summary>
+ /// Gets a value indicating that we are in the muxing process.
+ /// </summary>
+ public bool IsMuxing { get; private set; }
+
+ /// <summary>
+ /// Gets a value indicating that we are in the searching process.
+ /// </summary>
+ public bool IsSearching { get; }
+
+ /// <summary>
+ /// Gets a value indicating that we are doing a subtitle scan pass.
+ /// </summary>
+ public bool IsSubtitleScan
+ {
+ get
+ {
+ if (this.PassId == -1)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
index de0f0b2bc..861a5edaf 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
@@ -492,7 +492,7 @@ namespace HandBrake.ApplicationServices.Interop
this.log.LogMessage(statusJson, LogMessageType.Progress, LogLevel.Trace);
JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
- if (state != null && state.State == NativeConstants.HB_STATE_SCANNING)
+ if (state != null && (state.State == NativeConstants.HB_STATE_SCANNING || state.State == NativeConstants.HB_STATE_SEARCHING))
{
if (this.ScanProgress != null)
{
@@ -529,12 +529,12 @@ namespace HandBrake.ApplicationServices.Interop
JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
- if (state != null && state.State == NativeConstants.HB_STATE_WORKING)
+ if (state != null && (state.State == NativeConstants.HB_STATE_WORKING || state.State == NativeConstants.HB_STATE_MUXING || state.State == NativeConstants.HB_STATE_SEARCHING))
{
if (this.EncodeProgress != null)
{
var progressEventArgs = new EncodeProgressEventArgs(state.Working.Progress, state.Working.Rate, state.Working.RateAvg, new TimeSpan(state.Working.Hours, state.Working.Minutes, state.Working.Seconds),
- state.Working.PassID, state.Working.Pass, state.Working.PassCount);
+ state.Working.PassID, state.Working.Pass, state.Working.PassCount, state.State == NativeConstants.HB_STATE_MUXING, state.State == NativeConstants.HB_STATE_SEARCHING);
this.EncodeProgress(this, progressEventArgs);
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs
index bc593539f..9f4615bbf 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs
@@ -59,6 +59,7 @@ namespace HandBrake.ApplicationServices.Interop.HbLib
public const int HB_STATE_PAUSED = 16;
public const int HB_STATE_WORKDONE = 32;
public const int HB_STATE_MUXING = 64;
+ public const int HB_STATE_SEARCHING = 128;
// Keep aspect ratio values
public const int HB_KEEP_WIDTH = 0x01;