From ca93f96b13713110158c829e9134a28b4f726dd8 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 3 Mar 2013 18:09:57 +0000 Subject: [PATCH] WinGui: qsv bug fixes and a demo preset for testing purposes. git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/qsv@5288 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Services/PresetService.cs | 38 +++++++++++++++++++ .../Utilities/QueryGeneratorUtility.cs | 2 +- .../Model/Encoding/VideoEncoder.cs | 6 +-- .../HandBrakeWPF/ViewModels/VideoViewModel.cs | 7 +++- 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs index 5edfb4e1e..99369073b 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs @@ -24,6 +24,7 @@ namespace HandBrake.ApplicationServices.Services using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Model.Encoding; using HandBrake.ApplicationServices.Utilities; + using HandBrake.Interop.Model.Encoding; /// /// The preset service manages HandBrake's presets @@ -444,6 +445,8 @@ namespace HandBrake.ApplicationServices.Services this.presets.Add(preset); } } + + this.presets.Add(this.QsvDemoPreset()); // TODO remove later. } } catch (Exception exc) @@ -505,5 +508,40 @@ namespace HandBrake.ApplicationServices.Services } #endregion + + #region Tempory Hack + + /// + /// The qsv preset temp. + /// + /// + /// The . + /// + private Preset QsvDemoPreset() + { + Preset preset = new Preset(); + preset.Name = "QuickSync Demo"; + preset.Category = "Regular"; + preset.Description = "An example preset for QSV"; + preset.IsBuildIn = true; + preset.PictureSettingsMode = PresetPictureSettingsMode.None; + preset.Task = new EncodeTask(); + + preset.Task.VideoEncoder = VideoEncoder.QuickSync; + preset.Task.Quality = 20; + preset.Task.AdvancedEncoderOptions = + "qsv-num-ref-frame=3:qsv-gop-ref-dist=5:qsv-gop-pic-size=5:qsv-async-depth=4"; + preset.Task.AudioTracks = new ObservableCollection(); + preset.Task.AudioTracks.Add(new AudioTrack { Bitrate = 160, Encoder = AudioEncoder.Faac, MixDown = Mixdown.DolbyProLogicII}); + preset.Task.Anamorphic = Anamorphic.Loose; + preset.Task.QsvPreset = QsvPreset.Balanced; + preset.Task.FramerateMode = FramerateMode.VFR; + preset.Task.OutputFormat = OutputFormat.Mp4; + preset.Task.VideoEncodeRateType = VideoEncodeRateType.ConstantQuality; + + return preset; + } + + #endregion } } diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index 88cfd28be..f0f7402ad 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -426,7 +426,6 @@ namespace HandBrake.ApplicationServices.Utilities case VideoEncoder.FFMpeg2: query += " -e ffmpeg2"; break; - case VideoEncoder.QuickSync: query += " -e qsv"; break; @@ -455,6 +454,7 @@ namespace HandBrake.ApplicationServices.Utilities case VideoEncoder.FFMpeg2: query += string.Format(" -q {0}", task.Quality.Value.ToString(CultureInfo.InvariantCulture)); break; + case VideoEncoder.QuickSync: case VideoEncoder.X264: query += string.Format(" -q {0}", task.Quality.Value.ToString(CultureInfo.InvariantCulture)); break; diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs index 7aac80306..f3b4bf096 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs @@ -19,6 +19,9 @@ namespace HandBrake.Interop.Model.Encoding [Display(Name = "H.264 (x264)")] X264 = 0, + [Display(Name = "QuickSync (H.264)")] + QuickSync, + [Display(Name = "MPEG-4 (FFmpeg)")] FFMpeg, @@ -27,8 +30,5 @@ namespace HandBrake.Interop.Model.Encoding [Display(Name = "VP3 (Theora)")] Theora, - - [Display(Name = "QuickSync (H.264)")] - QuickSync } } diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 39a51cf4e..37ec57cab 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -310,7 +310,7 @@ namespace HandBrakeWPF.ViewModels { get { - return 51.Equals(this.RF); + return 51.Equals(this.RF) && this.SelectedVideoEncoder == VideoEncoder.X264; } } @@ -373,6 +373,7 @@ namespace HandBrakeWPF.ViewModels case VideoEncoder.FFMpeg2: this.Task.Quality = (32 - value); break; + case VideoEncoder.QuickSync: case VideoEncoder.X264: double rfValue = 51.0 - value * cqStep; rfValue = Math.Round(rfValue, 2); @@ -840,6 +841,7 @@ namespace HandBrakeWPF.ViewModels this.RF = 32 - cq; } break; + case VideoEncoder.QuickSync: case VideoEncoder.X264: double multiplier = 1.0 / cqStep; @@ -913,6 +915,7 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.H264Profile); this.NotifyOfPropertyChange(() => this.FastDecode); this.NotifyOfPropertyChange(() => this.ExtraArguments); + this.NotifyOfPropertyChange(() => this.QsvPreset); } /// @@ -953,7 +956,6 @@ namespace HandBrakeWPF.ViewModels { this.canClear = false; this.X264PresetValue = 5; - this.qsvPresetValue = 2; this.X264Tune = x264Tune.None; this.H264Profile = x264Profile.None; this.FastDecode = false; @@ -979,6 +981,7 @@ namespace HandBrakeWPF.ViewModels this.QualityMax = 31; break; case VideoEncoder.X264: + case VideoEncoder.QuickSync: this.QualityMin = 0; this.QualityMax = (int)(51 / userSettingService.GetUserSetting(UserSettingConstants.X264Step)); break; -- 2.40.0