diff options
author | sr55 <[email protected]> | 2012-03-25 18:14:10 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-03-25 18:14:10 +0000 |
commit | 479f2a8da44ee1237acdf187892e0bf2e77c5663 (patch) | |
tree | 7afe479dcc484fe8319019c2216e954c3e30a6cd /win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | |
parent | 970ae1ed9f3c05fa4a8a4bc454892ef63278c721 (diff) |
WinGuWinGui:(WPF) Remove some legacy queue code with the queue models and fix up some issues with the quality slider on the new video tab. Improve the User settings service code.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4542 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 7f7520dc4..295eb3b3b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -12,6 +12,7 @@ namespace HandBrakeWPF.ViewModels using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
+ using System.Globalization;
using Caliburn.Micro;
@@ -310,8 +311,8 @@ namespace HandBrakeWPF.ViewModels this.ShowPeakFramerate = true;
if (this.Task.FramerateMode == FramerateMode.VFR)
{
- this.Task.FramerateMode = FramerateMode.PFR;
- }
+ this.Task.FramerateMode = FramerateMode.PFR;
+ }
this.Task.Framerate = double.Parse(value);
}
@@ -416,9 +417,15 @@ namespace HandBrakeWPF.ViewModels {
return;
}
-
+
this.SelectedVideoEncoder = preset.Task.VideoEncoder;
- this.SelectedFramerate = preset.Task.Framerate.ToString();
+ if (preset.Task.Framerate.HasValue)
+ {
+ this.SelectedFramerate = preset.Task.Framerate.Value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ this.IsConstantQuantity = preset.Task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality;
+
switch (preset.Task.FramerateMode)
{
case FramerateMode.CFR:
@@ -433,9 +440,39 @@ namespace HandBrakeWPF.ViewModels this.ShowPeakFramerate = true;
break;
}
-
- // TODO Compute RF
- this.RF = 20;
+
+ double cqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
+ double rfValue = 0;
+ switch (this.SelectedVideoEncoder)
+ {
+ case VideoEncoder.FFMpeg:
+ case VideoEncoder.FFMpeg2:
+ int cq;
+ if (preset.Task.Quality.HasValue)
+ {
+ int.TryParse(preset.Task.Quality.Value.ToString(CultureInfo.InvariantCulture), out cq);
+ this.RF = 32 - cq;
+ }
+ break;
+ case VideoEncoder.X264:
+
+ double multiplier = 1.0 / cqStep;
+ if (preset.Task.Quality.HasValue)
+ {
+ rfValue = preset.Task.Quality.Value * multiplier;
+ }
+
+ this.RF = this.QualityMax - (int)Math.Round(rfValue, 0);
+
+ break;
+
+ case VideoEncoder.Theora:
+ if (preset.Task.Quality.HasValue)
+ {
+ this.RF = (int)preset.Task.Quality.Value;
+ }
+ break;
+ }
this.Task.TwoPass = preset.Task.TwoPass;
this.Task.TurboFirstPass = preset.Task.TurboFirstPass;
|