diff options
author | sr55 <[email protected]> | 2021-01-30 18:33:56 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2021-01-30 18:33:56 +0000 |
commit | 047b684310107ec84d16bb767a9345c7c7fe1afe (patch) | |
tree | 3bc4622ce970f6d6ef03d0e191ad9d949e4314c3 /win/CS/HandBrakeWPF/Services | |
parent | 64e15a878106652f723bd0d72c3a32a3e7e184c8 (diff) |
WinGui: Add support for Chroma Smooth filter.
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
3 files changed, 37 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs index faba29387..cac804d38 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs @@ -499,6 +499,18 @@ namespace HandBrakeWPF.Services.Encode.Factories } } + if (job.ChromaSmooth != null && job.ChromaSmooth.Key != "off") + { + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_CHROMA_SMOOTH, job.ChromaSmooth.Key, job.ChromaSmoothTune?.Key, job.CustomChromaSmooth); + if (!string.IsNullOrEmpty(unparsedJson)) + { + JsonDocument settings = JsonDocument.Parse(unparsedJson); + + Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_CHROMA_SMOOTH, Settings = settings }; + filter.FilterList.Add(filterItem); + } + } + // Grayscale if (job.Grayscale) diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs index bd50f19cf..3f1835888 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs @@ -93,6 +93,9 @@ namespace HandBrakeWPF.Services.Encode.Model this.Padding = task.Padding; this.Colourspace = task.Colourspace; this.CustomColourspace = task.CustomColourspace; + this.ChromaSmooth = task.ChromaSmooth; + this.ChromaSmoothTune = task.ChromaSmoothTune; + this.CustomChromaSmooth = task.CustomChromaSmooth; this.DisplayWidth = task.DisplayWidth; this.EndPoint = task.EndPoint; @@ -243,7 +246,13 @@ namespace HandBrakeWPF.Services.Encode.Model public FilterPreset Colourspace { get; set; } public string CustomColourspace { get; set; } - + + public FilterPreset ChromaSmooth { get; set; } + + public FilterTune ChromaSmoothTune { get; set; } + + public string CustomChromaSmooth { get; set; } + /* Video */ public VideoEncodeRateType VideoEncodeRateType { get; set; } diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index bf116c183..d54330c81 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -97,6 +97,17 @@ namespace HandBrakeWPF.Services.Presets.Factories {
preset.Task.Colourspace = new FilterPreset("Off", "off");
}
+
+ if (!string.IsNullOrEmpty(importedPreset.PictureChromaSmoothPreset))
+ {
+ preset.Task.ChromaSmooth = new FilterPreset(HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_CHROMA_SMOOTH).FirstOrDefault(s => s.ShortName == importedPreset.PictureChromaSmoothPreset));
+ preset.Task.ChromaSmoothTune = new FilterTune(HandBrakeFilterHelpers.GetFilterTunes((int)hb_filter_ids.HB_FILTER_CHROMA_SMOOTH).FirstOrDefault(s => s.ShortName == importedPreset.PictureChromaSmoothTune));
+ preset.Task.CustomChromaSmooth = importedPreset.PictureChromaSmoothCustom;
+ }
+ else
+ {
+ preset.Task.ChromaSmooth = new FilterPreset("Off", "off");
+ }
if (!string.IsNullOrEmpty(importedPreset.PictureDeblockPreset))
{
@@ -648,6 +659,10 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.PictureColorspacePreset = export.Task.Colourspace?.Key;
preset.PictureColorspaceCustom = export.Task.CustomColourspace;
+ preset.PictureChromaSmoothPreset = export.Task.ChromaSmooth?.Key;
+ preset.PictureChromaSmoothTune = export.Task.ChromaSmoothTune?.Key;
+ preset.PictureChromaSmoothCustom = export.Task.CustomChromaSmooth;
+
// Video
preset.VideoEncoder = EnumHelper<VideoEncoder>.GetShortName(export.Task.VideoEncoder);
preset.VideoFramerate = export.Task.Framerate.HasValue ? export.Task.Framerate.ToString() : null;
|