summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/CS/.editorconfig3
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs21
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs33
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs4
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs5
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/LibScan.cs8
6 files changed, 33 insertions, 41 deletions
diff --git a/win/CS/.editorconfig b/win/CS/.editorconfig
new file mode 100644
index 000000000..e842aa8e4
--- /dev/null
+++ b/win/CS/.editorconfig
@@ -0,0 +1,3 @@
+[*.{cs,xaml}]
+indent_style = space
+indent_size = 4 \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs
index 0da2fd178..c43ac42d9 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs
@@ -40,13 +40,10 @@ namespace HandBrake.ApplicationServices.Interop.EventArgs
/// <param name="passCount">
/// The pass count.
/// </param>
- /// <param name="isMuxing">
- /// A flag to indicate we are muxing.
+ /// <param name="stateCode">
+ /// The code for the state the encode process is in.
/// </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)
+ public EncodeProgressEventArgs(double fractionComplete, double currentFrameRate, double averageFrameRate, TimeSpan estimatedTimeLeft, int passId, int pass, int passCount, string stateCode)
{
this.FractionComplete = fractionComplete;
this.CurrentFrameRate = currentFrameRate;
@@ -55,8 +52,7 @@ namespace HandBrake.ApplicationServices.Interop.EventArgs
this.PassId = passId;
this.Pass = pass;
this.PassCount = passCount;
- this.IsMuxing = isMuxing;
- this.IsSearching = isSearching;
+ this.StateCode = stateCode;
}
/// <summary>
@@ -101,14 +97,9 @@ namespace HandBrake.ApplicationServices.Interop.EventArgs
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.
+ /// Gets the state code of the encode process.
/// </summary>
- public bool IsSearching { get; }
+ public string StateCode { get; }
/// <summary>
/// Gets a value indicating that we are doing a subtitle scan pass.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
index b44dd385c..3081faf24 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
@@ -262,7 +262,7 @@ namespace HandBrake.ApplicationServices.Interop
/// <summary>
/// Stops an ongoing scan.
/// </summary>
- [HandleProcessCorruptedStateExceptions]
+ [HandleProcessCorruptedStateExceptions]
public void StopScan()
{
HBFunctions.hb_scan_stop(this.hbHandle);
@@ -280,28 +280,31 @@ namespace HandBrake.ApplicationServices.Interop
/// <param name="previewNumber">
/// The index of the preview to get (0-based).
/// </param>
+ /// <param name="deinterlace">
+ /// True to enable basic deinterlace of preview images.
+ /// </param>
/// <returns>
/// An image with the requested preview.
/// </returns>
[HandleProcessCorruptedStateExceptions]
- public Bitmap GetPreview(PreviewSettings settings, int previewNumber, int deinterlace)
+ public Bitmap GetPreview(PreviewSettings settings, int previewNumber, bool deinterlace)
{
SourceTitle title = this.Titles.TitleList.FirstOrDefault(t => t.Index == settings.TitleNumber);
// Create the Expected Output Geometry details for libhb.
hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s
{
- crop = new[] { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right },
+ crop = new[] { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right },
itu_par = 0,
keep = (int)AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH + (settings.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width?
- maxWidth = settings.MaxWidth,
- maxHeight = settings.MaxHeight,
- mode = (int)(hb_anamorphic_mode_t)settings.Anamorphic,
- modulus = settings.Modulus ?? 16,
+ maxWidth = settings.MaxWidth,
+ maxHeight = settings.MaxHeight,
+ mode = (int)(hb_anamorphic_mode_t)settings.Anamorphic,
+ modulus = settings.Modulus ?? 16,
geometry = new hb_geometry_s
{
- height = settings.Height,
- width = settings.Width,
+ height = settings.Height,
+ width = settings.Width,
par = settings.Anamorphic != Anamorphic.Custom
? new hb_rational_t { den = title.Geometry.PAR.Den, num = title.Geometry.PAR.Num }
: new hb_rational_t { den = settings.PixelAspectY, num = settings.PixelAspectX }
@@ -309,7 +312,7 @@ namespace HandBrake.ApplicationServices.Interop
};
// Fetch the image data from LibHb
- IntPtr resultingImageStuct = HBFunctions.hb_get_preview2(this.hbHandle, settings.TitleNumber, previewNumber, ref uiGeometry, deinterlace);
+ IntPtr resultingImageStuct = HBFunctions.hb_get_preview2(this.hbHandle, settings.TitleNumber, previewNumber, ref uiGeometry, deinterlace ? 1 : 0);
hb_image_s image = InteropUtilities.ToStructureFromPtr<hb_image_s>(resultingImageStuct);
// Copy the filled image buffer to a managed array.
@@ -409,7 +412,7 @@ namespace HandBrake.ApplicationServices.Interop
/// <summary>
/// Pauses the current encode.
/// </summary>
- [HandleProcessCorruptedStateExceptions]
+ [HandleProcessCorruptedStateExceptions]
public void PauseEncode()
{
HBFunctions.hb_pause(this.hbHandle);
@@ -418,7 +421,7 @@ namespace HandBrake.ApplicationServices.Interop
/// <summary>
/// Resumes a paused encode.
/// </summary>
- [HandleProcessCorruptedStateExceptions]
+ [HandleProcessCorruptedStateExceptions]
public void ResumeEncode()
{
HBFunctions.hb_resume(this.hbHandle);
@@ -427,7 +430,7 @@ namespace HandBrake.ApplicationServices.Interop
/// <summary>
/// Stops the current encode.
/// </summary>
- [HandleProcessCorruptedStateExceptions]
+ [HandleProcessCorruptedStateExceptions]
public void StopEncode()
{
HBFunctions.hb_stop(this.hbHandle);
@@ -526,7 +529,7 @@ namespace HandBrake.ApplicationServices.Interop
this.titlesJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg);
this.log.LogMessage(this.titlesJson, LogMessageType.Progress, LogLevel.Trace);
- if (string.IsNullOrEmpty(scanJson))
+ if (string.IsNullOrEmpty(this.titlesJson))
{
this.log.LogMessage("Scan Error: No Scan Data Returned.", LogMessageType.API, LogLevel.Error);
}
@@ -566,7 +569,7 @@ namespace HandBrake.ApplicationServices.Interop
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, taskState == TaskState.Muxing, taskState == TaskState.Searching);
+ state.Working.PassID, state.Working.Pass, state.Working.PassCount, taskState.Code);
this.EncodeProgress(this, progressEventArgs);
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs
index acc182205..5080c20c2 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs
@@ -98,12 +98,12 @@ namespace HandBrake.ApplicationServices.Interop.Interfaces
/// The index of the preview to get (0-based).
/// </param>
/// <param name="deinterlace">
- /// Enable basic deinterlace of preview images. 1 = on. 0 = off.
+ /// True to enable basic deinterlace of preview images.
/// </param>
/// <returns>
/// An image with the requested preview.
/// </returns>
- Bitmap GetPreview(PreviewSettings job, int previewNumber, int deinterlace);
+ Bitmap GetPreview(PreviewSettings job, int previewNumber, bool deinterlace);
/// <summary>
/// Pauses the current encode.
diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
index f8bd78fb7..b6b811454 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
@@ -16,6 +16,7 @@ namespace HandBrakeWPF.Services.Encode
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.EventArgs;
using HandBrake.ApplicationServices.Interop.Interfaces;
+ using HandBrake.ApplicationServices.Interop.Json.State;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Logging;
using HandBrake.ApplicationServices.Services.Logging.Interfaces;
@@ -183,8 +184,8 @@ namespace HandBrakeWPF.Services.Encode
TaskCount = e.PassCount,
ElapsedTime = DateTime.Now - this.startTime,
PassId = e.PassId,
- IsMuxing = e.IsMuxing,
- IsSearching = e.IsSearching
+ IsMuxing = e.StateCode == TaskState.Muxing.Code,
+ IsSearching = e.StateCode == TaskState.Searching.Code
};
this.InvokeEncodeStatusChanged(args);
diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
index 287732224..beceb9361 100644
--- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
+++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
@@ -207,13 +207,7 @@ namespace HandBrakeWPF.Services.Scan
PixelAspectY = job.PixelAspectY
};
- int deinterlaceOn = 0;
- if (job.DeinterlaceFilter != DeinterlaceFilter.Off)
- {
- deinterlaceOn = 1;
- }
-
- bitmapImage = BitmapUtilities.ConvertToBitmapImage(this.instance.GetPreview(settings, preview, deinterlaceOn));
+ bitmapImage = BitmapUtilities.ConvertToBitmapImage(this.instance.GetPreview(settings, preview, job.DeinterlaceFilter != DeinterlaceFilter.Off));
}
catch (AccessViolationException e)
{