diff options
author | Rodeo <[email protected]> | 2013-11-08 23:04:44 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-11-08 23:04:44 +0000 |
commit | 2068e877b79fb5513704a6a0c12764e55e65af6e (patch) | |
tree | 7420f1cd9a7d467ad29355df39f2723573f99720 /win | |
parent | 6b27b0d868d030992cf50d2c0f9369ecfd8916d2 (diff) |
WinGui: use libhb presets for QSV.
This replaces the built-in QSV presets.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5889 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
4 files changed, 48 insertions, 109 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs index f034cb682..3ddb1ff51 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs @@ -276,13 +276,13 @@ namespace HandBrake.ApplicationServices.Utilities if (parsed.FastDecode)
{
tune = tune == "none" ? "fastdecode" : tune + ",fastdecode";
- }
- AddEncodeElement(xmlWriter, "x264Tune", "string", tune);
- AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");
- AddEncodeElement(xmlWriter, "QsvPreset", "string", parsed.QsvPreset.ToString());
-
- int videoQualityType = 0;
- if (parsed.VideoBitrate != null) videoQualityType = 1;
+ } + AddEncodeElement(xmlWriter, "x264Tune", "string", tune); + AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0"); + AddEncodeElement(xmlWriter, "qsvPreset", "string", parsed.QsvPreset.ToString().ToLower()); + + int videoQualityType = 0; + if (parsed.VideoBitrate != null) videoQualityType = 1; else if (parsed.Quality != null) videoQualityType = 2;
AddEncodeElement(xmlWriter, "VideoQualityType", "integer", videoQualityType.ToString());
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index 13be72527..5dee88426 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -957,12 +957,24 @@ namespace HandBrake.ApplicationServices.Utilities {
query += string.Format(" -x {0}", task.ExtraAdvancedArguments);
}
- }
- }
-
- // Options that apply to both x264 and QuickSync
- if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)
- {
+ } + } + + // QSV Only + if (task.VideoEncoder == VideoEncoder.QuickSync) + { + query += string.Format(" --qsv-preset={0}", task.QsvPreset.ToString().ToLower()); + } + + // options that apply to all encoders + if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions)) + { + query += string.Format(" -x {0}", task.AdvancedEncoderOptions); + } + + // Options that apply to both x264 and QuickSync + if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264) + { // when using x264 with the advanced panel, the H.264 profile/level widgets are disabled
if (!(task.VideoEncoder == VideoEncoder.X264 && task.ShowAdvancedTab))
{
@@ -973,61 +985,15 @@ namespace HandBrake.ApplicationServices.Utilities if (task.H264Profile != x264Profile.None)
{
query += string.Format(
- " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));
- }
- }
-
- if (task.VideoEncoder == VideoEncoder.QuickSync)
- {
- string qsvPreset;
-
- if (SystemInfo.IsHswOrNewer)
- {
- switch (task.QsvPreset)
- {
- case QsvPreset.Speed:
- qsvPreset = "6";
- break;
- case QsvPreset.Balanced:
- qsvPreset = "4";
- break;
- default:
- qsvPreset = "2";
- break;
- }
- }
- else
- {
- switch (task.QsvPreset)
- {
- case QsvPreset.Speed:
- qsvPreset = "4";
- break;
- case QsvPreset.Balanced:
- qsvPreset = "2";
- break;
- default:
- qsvPreset = "2";
- break;
- }
- }
-
- query += string.IsNullOrEmpty(task.AdvancedEncoderOptions)
- ? string.Format(" -x target-usage={0}", qsvPreset)
- : string.Format(" -x target-usage={0}:{1}", qsvPreset, task.AdvancedEncoderOptions);
- }
- else if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions)) // Not a H.264 encode
- {
- query += string.Format(" -x {0}", task.AdvancedEncoderOptions);
- }
-
- return query;
- }
-
- return string.IsNullOrEmpty(task.AdvancedEncoderOptions) ? string.Empty : string.Format(" -x {0}", task.AdvancedEncoderOptions);
- }
-
- /// <summary>
+ " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty)); + } + } + } + + return query; + } + + /// <summary> /// Generate the Command Line Arguments for any additional advanced options.
/// </summary>
/// <param name="verbosity">
diff --git a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs index d7ae4e498..f7968fcb4 100644 --- a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs @@ -30,13 +30,12 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Initializes a new instance of the <see cref="EncoderOptionsViewModel"/> class.
/// </summary>
- public EncoderOptionsViewModel()
- {
- this.Task = new EncodeTask();
- cachedOptions.Add(VideoEncoder.QuickSync, "async-depth=4");
- }
-
- /// <summary>
+ public EncoderOptionsViewModel() + { + this.Task = new EncodeTask(); + } + + /// <summary> /// Gets or sets the task.
/// </summary>
public EncodeTask Task { get; set; }
diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs b/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs index a285e490b..e9d54d4ce 100644 --- a/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs @@ -43,40 +43,14 @@ namespace HandBrakeWPF.Views private void qsv_preset_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
- VideoViewModel mvm = ((VideoViewModel)this.DataContext);
- EncodeTask task = mvm.Task;
-
- string addon = "";
-
- if (SystemInfo.IsHswOrNewer)
- {
- if (task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality)
- {
- if (task.QsvPreset == QsvPreset.Balanced ||
- task.QsvPreset == QsvPreset.Speed)
- addon = "num-ref-frame=1";
- }
- if (task.VideoEncodeRateType == VideoEncodeRateType.AverageBitrate)
- {
- if (task.QsvPreset == QsvPreset.Quality)
- addon = "lookahead=1:gop-ref-dist=3";
- else
- if (task.QsvPreset == QsvPreset.Balanced)
- {
- addon = "num-ref-frame=1:gop-ref-dist=1";
- }
- else
- if (task.QsvPreset == QsvPreset.Speed)
- addon = "gop-ref-dist=1";
- }
- }
-
-
- string full_string = addon + ":";
-
- IDictionary<string, string> newOptions = new Dictionary<string, string>();
- string[] existingSegments = full_string.Split(':');
- foreach (string existingSegment in existingSegments)
+ VideoViewModel mvm = ((VideoViewModel)this.DataContext); + EncodeTask task = mvm.Task; + + string full_string = ""; + + IDictionary<string, string> newOptions = new Dictionary<string, string>(); + string[] existingSegments = full_string.Split(':'); + foreach (string existingSegment in existingSegments) {
string optionName = existingSegment;
string optionValue = string.Empty;
|