From 78f3a92eeb301e9896fdc59efdd3d37133984033 Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 12 Jan 2015 19:50:52 +0000 Subject: [PATCH] WinGui: Some fixes around x264/x265 tune/profile options git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6739 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Services/Encode/Model/EncodeTask.cs | 2 +- .../Utilities/InteropModelCreator.cs | 22 ++++++++++++++----- .../Utilities/QueryGeneratorUtility.cs | 2 +- .../HandBrakeInterop/Json/Encode/Video.cs | 2 +- .../Model/Encoding/x264/x264Profile.cs | 2 +- .../Model/Encoding/x265/x265Tune.cs | 11 ++++++++-- .../HandBrakeWPF/ViewModels/VideoViewModel.cs | 4 ++-- 7 files changed, 32 insertions(+), 13 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs index d5c62794d..991d60a76 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs @@ -54,7 +54,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model this.AllowedPassthruOptions = new AllowedPassthru(); this.X264Preset = x264Preset.Medium; this.QsvPreset = QsvPreset.Quality; - this.H264Profile = x264Profile.None; + this.H264Profile = x264Profile.Auto; this.X264Tune = x264Tune.None; this.Modulus = 16; diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs index 15114000c..17a8ba000 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs @@ -19,9 +19,11 @@ namespace HandBrake.ApplicationServices.Utilities using HandBrake.Interop.Model; using HandBrake.Interop.Model.Encoding; using HandBrake.Interop.Model.Encoding.x264; + using HandBrake.Interop.Model.Encoding.x265; /// /// A Utility Class to Convert a + /// TODO remove this class and replace a new factory to convert the EncodeTask object. This will remove a layer of abstraction. /// public class InteropModelCreator { @@ -200,17 +202,27 @@ namespace HandBrake.ApplicationServices.Utilities { profile.VideoTunes.Add("fastdecode"); } + + profile.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); // TODO change these away from strings. + profile.VideoLevel = work.H264Level; } else if (work.VideoEncoder == VideoEncoder.X265) { + profile.VideoPreset = work.X265Preset.ToString().ToLower().Replace(" ", string.Empty); - profile.VideoProfile = work.H265Profile.ToString().ToLower().Replace(" ", string.Empty); - profile.VideoTunes = new List(); - } - profile.VideoLevel = work.H264Level; - profile.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); // TODO change these away from strings. + if (work.H265Profile != x265Profile.None) + { + profile.VideoProfile = work.H265Profile.ToString().ToLower().Replace(" ", string.Empty); + } + profile.VideoTunes = new List(); + if (work.X265Tune != x265Tune.None) + { + profile.VideoTunes.Add(work.X265Tune.ToString().ToLower().Replace(" ", string.Empty)); + } + } + // Chapter Markers profile.IncludeChapterMarkers = work.IncludeChapterMarkers; job.CustomChapterNames = work.ChapterNames.Select(item => item.ChapterName).ToList(); diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index fd9ad3b4c..653732d2b 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -1030,7 +1030,7 @@ namespace HandBrake.ApplicationServices.Utilities { query += string.Format(" --encoder-level=\"{0}\" ", task.H264Level); } - if (task.H264Profile != x264Profile.None) + if (task.H264Profile != x264Profile.Auto) { query += string.Format( " --encoder-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty)); diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs index 461397eb2..ede0f919c 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs @@ -37,7 +37,7 @@ namespace HandBrake.Interop.Json.Encode public bool TwoPass { get; set; } /// - /// Gets or sets Turbo First Pass. For x264/5 + /// Gets or sets a value indicating whether Turbo First Pass. For x264/5 /// public bool Turbo { get; set; } diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs index bc0983ff1..d1c1facb7 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs @@ -17,7 +17,7 @@ namespace HandBrake.Interop.Model.Encoding.x264 public enum x264Profile { [Display(Name = "Auto")] - None = 0, + Auto = 0, [Display(Name = "Baseline")] Baseline, diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs index 03d762359..edbcbff95 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs @@ -20,9 +20,16 @@ namespace HandBrake.Interop.Model.Encoding.x265 None = 0, [Display(Name = "PSNR")] - Psnr, + psnr, [Display(Name = "SSIM")] - Ssim, + ssim, + + [Display(Name = "Zero Latency")] + zerolatency, + + [Display(Name = "Fast Decode")] + fastdecode, + } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 36276b2f2..8b745aa3c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -1131,7 +1131,7 @@ namespace HandBrakeWPF.ViewModels } else { - this.H264Profile = x264Profile.None; + this.H264Profile = x264Profile.Auto; this.H264Level = "Auto"; } @@ -1261,7 +1261,7 @@ namespace HandBrakeWPF.ViewModels this.canClear = false; this.X264PresetValue = 5; this.X264Tune = x264Tune.None; - this.H264Profile = x264Profile.None; + this.H264Profile = x264Profile.Auto; this.FastDecode = false; this.H264Level = "Auto"; this.ExtraArguments = string.Empty; -- 2.40.0