From feb363eba5e4e914893c4b096402d7d7f9a4a747 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 25 Apr 2019 18:11:06 +0100 Subject: WinGui: Update the UI for the new deblock filter. #2028 --- .../Services/Encode/Factories/EncodeTaskFactory.cs | 4 ++-- .../Services/Encode/Factories/EncodeTaskImportFactory.cs | 3 +-- win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs | 13 +++++++------ .../Services/Presets/Factories/JsonPresetFactory.cs | 9 +++++++-- win/CS/HandBrakeWPF/Services/Presets/PresetService.cs | 1 - 5 files changed, 17 insertions(+), 13 deletions(-) (limited to 'win/CS/HandBrakeWPF/Services') diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs index 3c6e4d35c..72948a332 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs @@ -503,9 +503,9 @@ namespace HandBrakeWPF.Services.Encode.Factories } // Deblock - if (job.Deblock >= 5) + if (job.DeblockPreset != null && job.DeblockPreset.Key != "off") { - IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DEBLOCK, null, null, string.Format("qp={0}", job.Deblock)); + IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DEBLOCK, job.DeblockPreset.Key, job.DeblockTune.Key, job.CustomDeblock); string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); if (!string.IsNullOrEmpty(unparsedJson)) { diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs index 3daf6b353..8cc635017 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs @@ -271,7 +271,6 @@ namespace HandBrakeWPF.Services.Encode.Factories } task.SubtitleTracks.Add(null); - } } @@ -318,7 +317,7 @@ namespace HandBrakeWPF.Services.Encode.Factories if (deblockFilter != null) { var filterSettings = deblockFilter.Settings; - task.Deblock = filterSettings.Value("qp").ToInt(); + task.DeblockPreset = null; // TODO Support Preset / Tune } // Sharpen diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs index aec7219c2..5272810cd 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs @@ -81,7 +81,9 @@ namespace HandBrakeWPF.Services.Encode.Model this.CustomDetelecine = task.CustomDetelecine; this.CustomCombDetect = task.CustomCombDetect; this.CombDetect = task.CombDetect; - this.Deblock = task.Deblock; + this.DeblockPreset = task.DeblockPreset; + this.DeblockTune = task.DeblockTune; + this.CustomDeblock = task.CustomDeblock; this.DeinterlacePreset = task.DeinterlacePreset; this.DeinterlaceFilter = task.DeinterlaceFilter; this.Denoise = task.Denoise; @@ -326,11 +328,6 @@ namespace HandBrakeWPF.Services.Encode.Model /// public string CustomDenoise { get; set; } - /// - /// Gets or sets Deblock. - /// - public int Deblock { get; set; } - /// /// Gets or sets a value indicating whether Grayscale. /// @@ -350,6 +347,10 @@ namespace HandBrakeWPF.Services.Encode.Model public FilterPreset SharpenPreset { get; set; } public FilterTune SharpenTune { get; set; } public string SharpenCustom { get; set; } + + public FilterPreset DeblockPreset { get; set; } + public FilterTune DeblockTune { get; set; } + public string CustomDeblock { get; set; } #endregion #region Video diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index 360cf7cab..c6dd9595e 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -102,7 +102,10 @@ namespace HandBrakeWPF.Services.Presets.Factories /* Filter Settings */ preset.Task.Grayscale = importedPreset.VideoGrayScale; - preset.Task.Deblock = importedPreset.PictureDeblock; + + preset.Task.DeblockPreset = new FilterPreset(HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_DEBLOCK).FirstOrDefault(s => s.ShortName == importedPreset.PictureDeblockPreset)); + preset.Task.DeblockTune = new FilterTune(HandBrakeFilterHelpers.GetFilterTunes((int)hb_filter_ids.HB_FILTER_DEBLOCK).FirstOrDefault(s => s.ShortName == importedPreset.PictureDeblockTune)); + preset.Task.CustomDeblock = importedPreset.PictureDeblockCustom; if (importedPreset.PictureSharpenFilter != null) { @@ -603,7 +606,9 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.PictureBottomCrop = export.Task.Cropping.Bottom; // Filters - preset.PictureDeblock = export.Task.Deblock; + preset.PictureDeblockPreset = export.Task.DeblockPreset?.Key; + preset.PictureDeblockTune = export.Task.DeblockTune?.Key; + preset.PictureDeblockCustom = export.Task.CustomDeblock; preset.PictureDeinterlaceFilter = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb ? "decomb" diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index c54780042..52f1d5d7f 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -806,7 +806,6 @@ namespace HandBrakeWPF.Services.Presets this.Add(preset, true); } } - } /// -- cgit v1.2.3