summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-03-07 22:54:38 +0000
committersr55 <[email protected]>2015-03-07 22:54:38 +0000
commit24f6d27cf9d979ab0743665b37e60fd1295776d1 (patch)
tree7181504b621d9dcf6c3e59990c135ec72ed84a3c /win
parent7705413a03a90c16734b40fb7bc492be8b56ab6f (diff)
WinGui: Updating the app to handle the latest JSON API change regarding the Automatic title scan on encode. This Simplifies the API in the services library.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6977 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Source.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/Model/SourceVideoInfo.cs20
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs66
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs44
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode/Interfaces/IEncode.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs178
-rw-r--r--win/CS/HandBrakeWPF/Services/QueueProcessor.cs2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs10
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs24
10 files changed, 75 insertions, 281 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
index 719119cc0..379e461c3 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
@@ -271,7 +271,7 @@ namespace HandBrake.ApplicationServices.Interop
};
// Sanatise the input.
- Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, new SourceVideoInfo(null, null, new Size(title.Geometry.Width, title.Geometry.Height), new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den)), AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH); // TODO this keep isn't right.
+ Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, new SourceVideoInfo(new Size(title.Geometry.Width, title.Geometry.Height), new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den)), AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH); // TODO this keep isn't right.
int width = resultGeometry.Width * resultGeometry.PAR.Num / resultGeometry.PAR.Den;
int height = resultGeometry.Height;
uiGeometry.geometry.height = resultGeometry.Height; // Prased the height now.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Source.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Source.cs
index 7adc228a9..27a746c36 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Source.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Source.cs
@@ -28,5 +28,10 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode
/// Gets or sets the title.
/// </summary>
public int Title { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ public string Path { get; set; }
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceVideoInfo.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceVideoInfo.cs
index 0c6340189..31b94ae10 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceVideoInfo.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceVideoInfo.cs
@@ -17,37 +17,19 @@ namespace HandBrake.ApplicationServices.Interop.Model
/// <summary>
/// Initializes a new instance of the <see cref="SourceVideoInfo"/> class.
/// </summary>
- /// <param name="framerateNumerator">
- /// The framerate numerator.
- /// </param>
- /// <param name="framerateDenominator">
- /// The framerate denominator.
- /// </param>
/// <param name="resolution">
/// The resolution.
/// </param>
/// <param name="parVal">
/// The par val.
/// </param>
- public SourceVideoInfo(int? framerateNumerator, int? framerateDenominator, Size resolution, Size parVal)
+ public SourceVideoInfo(Size resolution, Size parVal)
{
- this.FramerateNumerator = framerateNumerator;
- this.FramerateDenominator = framerateDenominator;
this.Resolution = resolution;
this.ParVal = parVal;
}
/// <summary>
- /// Gets the framerate numerator.
- /// </summary>
- public int? FramerateNumerator { get; private set; }
-
- /// <summary>
- /// Gets the framerate denominator.
- /// </summary>
- public int? FramerateDenominator { get; private set; }
-
- /// <summary>
/// Gets or sets the resolution (width/height) of this Title
/// </summary>
public Size Resolution { get; set; }
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
index 9b817069b..3ba8a847f 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
@@ -235,72 +235,6 @@ namespace HandBrake.ApplicationServices.Services.Encode
}
/// <summary>
- /// Pase the status output (from standard output)
- /// </summary>
- /// <param name="encodeStatus">
- /// The encode Status.
- /// </param>
- /// <param name="startTime">
- /// The start Time.
- /// </param>
- /// <returns>
- /// The <see cref="EncodeProgressEventArgs"/>.
- /// </returns>
- public EncodeProgressEventArgs ReadEncodeStatus(string encodeStatus, DateTime startTime)
- {
- try
- {
- Match m = Regex.Match(
- encodeStatus,
- @"^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\.[0-9]*) %( \(([0-9]*\.[0-9]*) fps, avg ([0-9]*\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\))?");
-
- if (m.Success)
- {
- int currentTask = int.Parse(m.Groups[1].Value);
- int totalTasks = int.Parse(m.Groups[2].Value);
- float percent = float.Parse(m.Groups[3].Value, CultureInfo.InvariantCulture);
- float currentFps = m.Groups[5].Value == string.Empty
- ? 0.0F
- : float.Parse(m.Groups[5].Value, CultureInfo.InvariantCulture);
- float avgFps = m.Groups[6].Value == string.Empty
- ? 0.0F
- : float.Parse(m.Groups[6].Value, CultureInfo.InvariantCulture);
- string remaining = string.Empty;
- if (m.Groups[7].Value != string.Empty)
- {
- remaining = m.Groups[7].Value + ":" + m.Groups[8].Value + ":" + m.Groups[9].Value;
- }
- if (string.IsNullOrEmpty(remaining))
- {
- remaining = "Calculating ...";
- }
-
- EncodeProgressEventArgs eventArgs = new EncodeProgressEventArgs
- {
- AverageFrameRate = avgFps,
- CurrentFrameRate = currentFps,
- EstimatedTimeLeft =
- Converters.EncodeToTimespan(
- remaining),
- PercentComplete = percent,
- Task = currentTask,
- TaskCount = totalTasks,
- ElapsedTime =
- DateTime.Now - startTime,
- };
-
- return eventArgs;
- }
-
- return null;
- }
- catch (Exception)
- {
- return null;
- }
- }
-
- /// <summary>
/// Setup the logging.
/// </summary>
/// <param name="encodeQueueTask">
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs
index 81f619b71..50bd04930 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs
@@ -15,12 +15,10 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
using System.Runtime.InteropServices;
using HandBrake.ApplicationServices.Interop;
- using HandBrake.ApplicationServices.Interop.Factories;
using HandBrake.ApplicationServices.Interop.HbLib;
using HandBrake.ApplicationServices.Interop.Helpers;
using HandBrake.ApplicationServices.Interop.Json.Anamorphic;
using HandBrake.ApplicationServices.Interop.Json.Encode;
- using HandBrake.ApplicationServices.Interop.Model;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
@@ -47,24 +45,21 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
/// <param name="job">
/// The encode job.
/// </param>
- /// <param name="title">
- /// The title.
- /// </param>
/// <param name="configuration">
/// The configuration.
/// </param>
/// <returns>
/// The <see cref="JsonEncodeObject"/>.
/// </returns>
- internal static JsonEncodeObject Create(EncodeTask job, SourceVideoInfo title, HBConfiguration configuration)
+ internal static JsonEncodeObject Create(EncodeTask job, HBConfiguration configuration)
{
JsonEncodeObject encode = new JsonEncodeObject
{
SequenceID = 0,
Audio = CreateAudio(job),
Destination = CreateDestination(job),
- Filter = CreateFilter(job, title),
- PAR = CreatePAR(job, title),
+ Filter = CreateFilter(job),
+ PAR = CreatePAR(job),
MetaData = CreateMetaData(job),
Source = CreateSource(job, configuration),
Subtitle = CreateSubtitle(job),
@@ -114,7 +109,8 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
{
Title = job.Title,
Range = range,
- Angle = job.Angle
+ Angle = job.Angle,
+ Path = job.Source,
};
return source;
}
@@ -161,16 +157,12 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
/// <param name="job">
/// The Job
/// </param>
- /// <param name="title">
- /// The title.
- /// </param>
/// <returns>
/// The produced PAR object.
/// </returns>
- private static PAR CreatePAR(EncodeTask job, SourceVideoInfo title)
+ private static PAR CreatePAR(EncodeTask job)
{
- Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, title, AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH);
- return new PAR { Num = resultGeometry.PAR.Num, Den = resultGeometry.PAR.Den };
+ return new PAR { Num = job.PixelAspectX, Den = job.PixelAspectY };
}
/// <summary>
@@ -385,13 +377,10 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
/// <param name="job">
/// The job.
/// </param>
- /// <param name="title">
- /// The title.
- /// </param>
/// <returns>
/// The <see cref="Filter"/>.
/// </returns>
- private static Filter CreateFilter(EncodeTask job, SourceVideoInfo title)
+ private static Filter CreateFilter(EncodeTask job)
{
Filter filter = new Filter
{
@@ -461,21 +450,15 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(job.Framerate.ToString()); // TODO check culture
int vrate = HBFunctions.hb_video_framerate_get_from_name(frameratePrt);
- int num;
- int den;
+ int? num = null;
+ int? den = null;
if (vrate > 0)
{
num = 27000000;
den = vrate;
}
- else
- {
- // cfr or pfr flag with no rate specified implies use the title rate.
- num = title.FramerateNumerator ?? 0;
- den = title.FramerateDenominator ?? 0;
- }
- string framerateString = string.Format("{0}:{1}:{2}", fm, num, den); // filter_cfr, filter_vrate.num, filter_vrate.den
+ string framerateString = num.HasValue ? string.Format("{0}:{1}:{2}", fm, num, den) : string.Format("{0}", fm); // filter_cfr, filter_vrate.num, filter_vrate.den
FilterList framerateShaper = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_VFR, Settings = framerateString };
filter.FilterList.Add(framerateShaper);
@@ -510,15 +493,14 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
}
// CropScale Filter
- Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, title, AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH);
FilterList cropScale = new FilterList
{
ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE,
Settings =
string.Format(
"{0}:{1}:{2}:{3}:{4}:{5}",
- resultGeometry.Width,
- resultGeometry.Height,
+ job.Width,
+ job.Height,
job.Cropping.Top,
job.Cropping.Bottom,
job.Cropping.Left,
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Interfaces/IEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Interfaces/IEncode.cs
index aa53ed180..e0685d4ad 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Interfaces/IEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Interfaces/IEncode.cs
@@ -72,11 +72,6 @@ namespace HandBrake.ApplicationServices.Services.Encode.Interfaces
int LogIndex { get; }
/// <summary>
- /// Gets a value indicating whether can pause.
- /// </summary>
- bool CanPause { get; }
-
- /// <summary>
/// Gets a value indicating whether is pasued.
/// </summary>
bool IsPasued { get; }
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
index 0f2113ca1..0ae99b964 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
@@ -11,19 +11,14 @@ namespace HandBrake.ApplicationServices.Services.Encode
{
using System;
using System.Diagnostics;
- using System.Linq;
- using System.ServiceModel.Channels;
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Services.Encode.Interfaces;
- using HandBrake.ApplicationServices.Services.Scan;
- using HandBrake.ApplicationServices.Services.Scan.Model;
- using HandBrake.ApplicationServices.Utilities;
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.EventArgs;
using HandBrake.ApplicationServices.Interop.Interfaces;
using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Factories;
+ using HandBrake.ApplicationServices.Services.Encode.Interfaces;
/// <summary>
/// LibHB Implementation of IEncode
@@ -52,32 +47,9 @@ namespace HandBrake.ApplicationServices.Services.Encode
/// </summary>
private QueueTask currentTask;
- /// <summary>
- /// A local instance of the scanned source.
- /// </summary>
- private Source scannedSource;
-
#endregion
/// <summary>
- /// Initializes a new instance of the <see cref="LibEncode"/> class.
- /// </summary>
- public LibEncode()
- {
- }
-
- /// <summary>
- /// Gets a value indicating whether can pause.
- /// </summary>
- public bool CanPause
- {
- get
- {
- return true;
- }
- }
-
- /// <summary>
/// Gets a value indicating whether is pasued.
/// </summary>
public bool IsPasued { get; private set; }
@@ -90,62 +62,69 @@ namespace HandBrake.ApplicationServices.Services.Encode
/// </param>
public void Start(QueueTask job)
{
- // Setup
- this.startTime = DateTime.Now;
- this.currentTask = job;
-
- // Create a new HandBrake instance
- // Setup the HandBrake Instance
- HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;
- HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged;
- this.instance = HandBrakeInstanceManager.GetEncodeInstance(job.Configuration.Verbosity);
- this.instance.EncodeCompleted += this.InstanceEncodeCompleted;
- this.instance.EncodeProgress += this.InstanceEncodeProgress;
-
try
{
+ // Setup
+ this.startTime = DateTime.Now;
+ this.currentTask = job;
+
+ // Create a new HandBrake instance
+ // Setup the HandBrake Instance
+ HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;
+ HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged;
+ this.instance = HandBrakeInstanceManager.GetEncodeInstance(job.Configuration.Verbosity);
+ this.instance.EncodeCompleted += this.InstanceEncodeCompleted;
+ this.instance.EncodeProgress += this.InstanceEncodeProgress;
+
// Sanity Checking and Setup
if (this.IsEncoding)
{
throw new Exception("HandBrake is already encoding.");
}
-
+
this.IsEncoding = true;
-
- // Enable logging if required.
- try
- {
- this.SetupLogging(job, true);
- }
- catch (Exception)
- {
- this.IsEncoding = false;
- throw;
- }
+ this.SetupLogging(job, true);
// Verify the Destination Path Exists, and if not, create it.
this.VerifyEncodeDestinationPath(job);
- // We have to scan the source again but only the title so the HandBrake instance is initialised correctly.
- // Since the UI sends the crop params down, we don't have to do all the previews.
-
- this.instance.ScanCompleted += delegate
- {
- // Process into internal structures.
- this.scannedSource = new Source { Titles = LibScan.ConvertTitles(this.instance.Titles) }; // TODO work around the bad Internal API.
- this.ScanCompleted(job, this.instance);
- };
+ ServiceLogMessage("Starting Encode ...");
- HandBrakeUtils.SetDvdNav(!job.Configuration.IsDvdNavDisabled);
+ // Get an EncodeJob object for the Interop Library
+ instance.StartEncode(EncodeFactory.Create(job.Task, job.Configuration));
- ServiceLogMessage("Scanning title for encoding ... ");
+ // Fire the Encode Started Event
+ this.InvokeEncodeStarted(System.EventArgs.Empty);
- this.instance.StartScan(job.ScannedSourcePath, job.Configuration.PreviewScanCount, TimeSpan.FromSeconds(job.Configuration.MinScanDuration), job.Task.Title);
+ // Set the Process Priority
+ switch (job.Configuration.ProcessPriority)
+ {
+ case "Realtime":
+ Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
+ break;
+ case "High":
+ Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
+ break;
+ case "Above Normal":
+ Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;
+ break;
+ case "Normal":
+ Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;
+ break;
+ case "Low":
+ Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
+ break;
+ default:
+ Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
+ break;
+ }
}
catch (Exception exc)
{
- ServiceLogMessage("Scan Failed ... " + Environment.NewLine + exc);
- this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "An Error has occured.", this.currentTask.Task.Destination));
+ this.IsEncoding = false;
+
+ ServiceLogMessage("Failed to start encoding ..." + Environment.NewLine + exc);
+ this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", job.Task.Source));
}
}
@@ -195,69 +174,6 @@ namespace HandBrake.ApplicationServices.Services.Encode
}
}
- /// <summary>
- /// The scan completed.
- /// </summary>
- /// <param name="job">
- /// The job.
- /// </param>
- /// <param name="instance">
- /// The instance.
- /// </param>
- private void ScanCompleted(QueueTask job, IHandBrakeInstance instance)
- {
- try
- {
- ServiceLogMessage("Scan Completed. Setting up the job for encoding ...");
-
- // Start the Encode
- Title title = this.scannedSource.Titles.FirstOrDefault(t => t.TitleNumber == job.Task.Title);
- if (title == null)
- {
- ServiceLogMessage("Title not found.");
- throw new Exception("Unable to get title for encoding. Encode Failed.");
- }
-
- ServiceLogMessage("Starting Encode ...");
-
- // Get an EncodeJob object for the Interop Library
- SourceVideoInfo videoInfo = new SourceVideoInfo(title.FramerateNumerator, title.FramerateDenominator, title.Resolution, title.ParVal);
- instance.StartEncode(EncodeFactory.Create(job.Task, videoInfo, job.Configuration));
-
- // Fire the Encode Started Event
- this.InvokeEncodeStarted(System.EventArgs.Empty);
-
- // Set the Process Priority
- switch (job.Configuration.ProcessPriority)
- {
- case "Realtime":
- Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
- break;
- case "High":
- Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
- break;
- case "Above Normal":
- Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;
- break;
- case "Normal":
- Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;
- break;
- case "Low":
- Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
- break;
- default:
- Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
- break;
- }
- }
- catch (Exception exc)
- {
- this.IsEncoding = false;
-
- ServiceLogMessage("Failed to start encoding ..." + Environment.NewLine + exc);
- this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", job.Task.Source));
- }
- }
#region HandBrakeInstance Event Handlers.
diff --git a/win/CS/HandBrakeWPF/Services/QueueProcessor.cs b/win/CS/HandBrakeWPF/Services/QueueProcessor.cs
index 414113d2f..a6dfe83c4 100644
--- a/win/CS/HandBrakeWPF/Services/QueueProcessor.cs
+++ b/win/CS/HandBrakeWPF/Services/QueueProcessor.cs
@@ -451,7 +451,7 @@ namespace HandBrakeWPF.Services
this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
this.EncodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
- if (this.EncodeService.CanPause && this.EncodeService.IsEncoding)
+ if (this.EncodeService.IsEncoding)
{
this.EncodeService.Resume();
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 9c46008f8..88aa0c9e9 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -605,7 +605,7 @@ namespace HandBrakeWPF.ViewModels
set
{
this.isEncoding = value;
- this.CanPause = value && this.encodeService.CanPause;
+ this.CanPause = value;
this.NotifyOfPropertyChange(() => this.IsEncoding);
}
}
@@ -1435,12 +1435,8 @@ namespace HandBrakeWPF.ViewModels
public void PauseEncode()
{
this.queueProcessor.Pause();
-
- if (this.encodeService.CanPause)
- {
- this.encodeService.Pause();
- this.IsEncoding = false;
- }
+ this.encodeService.Pause();
+ this.IsEncoding = false;
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
index 24bff58e6..1dd0ad93c 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
@@ -923,26 +923,10 @@ namespace HandBrakeWPF.ViewModels
// Step 2, For the changed field, call hb_set_anamorphic_size and process the results.
PictureSize.AnamorphicResult result = PictureSize.hb_set_anamorphic_size2(this.GetPictureSettings(), this.GetPictureTitleInfo(), setting);
-
- switch (this.SelectedAnamorphicMode)
- {
- case Anamorphic.None:
- this.Task.Width = result.OutputWidth;
- this.Task.Height = result.OutputHeight;
- break;
- case Anamorphic.Strict:
- this.Task.Width = 0;
- this.Task.Height = 0;
- break;
- case Anamorphic.Loose:
- this.Task.Width = result.OutputWidth;
- this.Task.Height = 0;
- break;
- case Anamorphic.Custom:
- this.Task.Width = result.OutputWidth;
- this.Task.Height = result.OutputHeight;
- break;
- }
+ this.Task.Width = result.OutputWidth;
+ this.Task.Height = result.OutputHeight;
+ this.Task.PixelAspectX = (int)Math.Round(result.OutputParWidth, 0);
+ this.Task.PixelAspectY = (int)Math.Round(result.OutputParHeight, 0);
// Step 3, Set the display width label to indicate the output.
double dispWidth = Math.Round((result.OutputWidth * result.OutputParWidth / result.OutputParHeight), 0);