summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-05-07 17:52:36 +0000
committersr55 <[email protected]>2015-05-07 17:52:36 +0000
commit86cbd6ce4d2c0f2b89d2933b9061e523e059d4dd (patch)
treef9cdee8106959d8c7a3fd36d98b3a3c4ac6768f6 /win
parent17f4930018d7e23e95edd8a53a4e0f3e7d98a4ff (diff)
WinGui: Restore Preview functionality. The calc logic still needs fixed as there are a few edge cases that still todate don't work.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7164 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs13
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs11
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs53
3 files changed, 53 insertions, 24 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
index 8aafbc02d..e46f5b30b 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
@@ -274,8 +274,8 @@ namespace HandBrake.ApplicationServices.Interop
hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s
{
crop = new[] { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right },
- itu_par = 0,
- keep = settings.KeepDisplayAspect ? 0x04 : 0,
+ 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,
@@ -291,13 +291,10 @@ namespace HandBrake.ApplicationServices.Interop
};
// Sanitize the input.
- Geometry resultGeometry = AnamorphicFactory.CreateGeometry(
- settings,
- new SourceVideoInfo(
- new Size(title.Geometry.Width, title.Geometry.Height),
- new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den)));
- int width = resultGeometry.Width;
+ Geometry resultGeometry = AnamorphicFactory.CreateGeometry(settings, new SourceVideoInfo(new Size(title.Geometry.Width, title.Geometry.Height), new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den)));
+ int width = resultGeometry.Width * resultGeometry.PAR.Num / resultGeometry.PAR.Den;
int height = resultGeometry.Height;
+
uiGeometry.geometry.width = width;
uiGeometry.geometry.height = height;
uiGeometry.geometry.par.num = settings.PixelAspectX;
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs
index bcc7f2714..8cf266d7e 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs
@@ -30,6 +30,17 @@ namespace HandBrake.ApplicationServices.Interop.Model.Preview
/// <param name="task">The task.</param>
public PreviewSettings(EncodeTask task)
{
+ this.Cropping = new Cropping(task.Cropping);
+ this.MaxWidth = task.MaxWidth ?? 0;
+ this.MaxHeight = task.MaxHeight ?? 0;
+ this.KeepDisplayAspect = task.KeepDisplayAspect;
+ this.TitleNumber = task.Title;
+ this.Anamorphic = task.Anamorphic;
+ this.Modulus = task.Modulus;
+ this.Width = task.Width ?? 0;
+ this.Height = task.Height ?? 0;
+ this.PixelAspectX = task.PixelAspectX;
+ this.PixelAspectY = task.PixelAspectY;
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index e4d20d053..41e280b9a 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -260,13 +260,13 @@ namespace HandBrakeWPF.ViewModels
this.CurrentTask = new EncodeTask();
this.CurrentTask.PropertyChanged += this.CurrentTask_PropertyChanged;
this.ScannedSource = new Source();
- this.HasSource = false;
-
- // Setup Events
- this.scanService.ScanStarted += this.ScanStared;
- this.scanService.ScanCompleted += this.ScanCompleted;
- this.scanService.ScanStatusChanged += this.ScanStatusChanged;
- this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
+ this.HasSource = false;
+
+ // Setup Events
+ this.scanService.ScanStarted += this.ScanStared;
+ this.scanService.ScanCompleted += this.ScanCompleted;
+ this.scanService.ScanStatusChanged += this.ScanStatusChanged;
+ this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
this.queueProcessor.QueueCompleted += this.QueueCompleted;
this.queueProcessor.QueueChanged += this.QueueChanged;
this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
@@ -1220,13 +1220,13 @@ namespace HandBrakeWPF.ViewModels
public void Shutdown()
{
// Shutdown Service
- this.encodeService.Stop();
-
- // Unsubscribe from Events.
- this.scanService.ScanStarted -= this.ScanStared;
- this.scanService.ScanCompleted -= this.ScanCompleted;
- this.scanService.ScanStatusChanged -= this.ScanStatusChanged;
-
+ this.encodeService.Stop();
+
+ // Unsubscribe from Events.
+ this.scanService.ScanStarted -= this.ScanStared;
+ this.scanService.ScanCompleted -= this.ScanCompleted;
+ this.scanService.ScanStatusChanged -= this.ScanStatusChanged;
+
this.queueProcessor.QueueCompleted -= this.QueueCompleted;
this.queueProcessor.QueueChanged -= this.QueueChanged;
this.queueProcessor.JobProcessingStarted -= this.QueueProcessorJobProcessingStarted;
@@ -2258,14 +2258,35 @@ namespace HandBrakeWPF.ViewModels
{
if (this.queueProcessor.EncodeService.IsEncoding)
{
+ long length = 0;
+ double filesize = 0;
+ try
+ {
+ length = new System.IO.FileInfo(this.Destination).Length;
+ if (length != 0)
+ {
+ length = length / 1024 / 1024; // MB
+ }
+
+ double portionLeft = 100 / e.PercentComplete;
+
+ filesize = Math.Round( length * portionLeft, 1);
+
+ }
+ catch (Exception ee)
+ {
+ Debug.WriteLine(ee);
+ }
+
this.ProgramStatusLabel =
- string.Format("{0:00.00}% FPS: {1:000.0} Avg FPS: {2:000.0} Time Remaining: {3} Elapsed: {4:hh\\:mm\\:ss}" + Resources.Main_JobsPending_addon,
+ string.Format("{0:00.00}% FPS: {1:000.0} Avg FPS: {2:000.0} Time Remaining: {3} Elapsed: {4:hh\\:mm\\:ss} Filesize: {6}MB" + Resources.Main_JobsPending_addon,
e.PercentComplete,
e.CurrentFrameRate,
e.AverageFrameRate,
e.EstimatedTimeLeft,
e.ElapsedTime,
- this.queueProcessor.Count);
+ this.queueProcessor.Count,
+ filesize);
if (lastEncodePercentage != percent && this.windowsSeven.IsWindowsSeven)
{