summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2021-01-30 17:20:03 +0000
committersr55 <[email protected]>2021-01-30 17:20:03 +0000
commit64e15a878106652f723bd0d72c3a32a3e7e184c8 (patch)
tree77f888ce0bd1510723e5612298bc1193aeb48084 /win/CS/HandBrakeWPF/Services
parent15cad9f2092ece526ea245b9600fd57de0d0561c (diff)
WinGui: Add support for the colourspace filter.
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs14
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs6
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs13
3 files changed, 33 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs
index da1fcf678..faba29387 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs
@@ -486,6 +486,20 @@ namespace HandBrakeWPF.Services.Encode.Factories
}
}
+ // Colourspace
+ if (job.Colourspace != null && job.Colourspace.Key != "off")
+ {
+ string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_COLORSPACE, job.Colourspace.Key, null, job.CustomColourspace);
+ if (!string.IsNullOrEmpty(unparsedJson))
+ {
+ JsonDocument settings = JsonDocument.Parse(unparsedJson);
+
+ Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_COLORSPACE, 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 710127d0c..bd50f19cf 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs
@@ -91,6 +91,8 @@ namespace HandBrakeWPF.Services.Encode.Model
this.SharpenTune = task.SharpenTune;
this.SharpenCustom = task.SharpenCustom;
this.Padding = task.Padding;
+ this.Colourspace = task.Colourspace;
+ this.CustomColourspace = task.CustomColourspace;
this.DisplayWidth = task.DisplayWidth;
this.EndPoint = task.EndPoint;
@@ -237,6 +239,10 @@ namespace HandBrakeWPF.Services.Encode.Model
public string CustomDeblock { get; set; }
public PaddingFilter Padding { get; set; }
+
+ public FilterPreset Colourspace { get; set; }
+
+ public string CustomColourspace { get; set; }
/* Video */
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
index 4559f61f5..bf116c183 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
@@ -88,6 +88,16 @@ namespace HandBrakeWPF.Services.Presets.Factories
/* Filter Settings */
preset.Task.Grayscale = importedPreset.VideoGrayScale;
+ if (!string.IsNullOrEmpty(importedPreset.PictureColorspacePreset))
+ {
+ preset.Task.Colourspace = new FilterPreset(HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_COLORSPACE).FirstOrDefault(s => s.ShortName == importedPreset.PictureColorspacePreset));
+ preset.Task.CustomColourspace = importedPreset.PictureColorspaceCustom;
+ }
+ else
+ {
+ preset.Task.Colourspace = new FilterPreset("Off", "off");
+ }
+
if (!string.IsNullOrEmpty(importedPreset.PictureDeblockPreset))
{
preset.Task.DeblockPreset = new FilterPreset(HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_DEBLOCK).FirstOrDefault(s => s.ShortName == importedPreset.PictureDeblockPreset));
@@ -635,6 +645,9 @@ namespace HandBrakeWPF.Services.Presets.Factories
preset.PictureSharpenTune = export.Task.SharpenTune != null ? export.Task.SharpenTune.Key : string.Empty;
preset.PictureSharpenCustom = export.Task.SharpenCustom;
+ preset.PictureColorspacePreset = export.Task.Colourspace?.Key;
+ preset.PictureColorspaceCustom = export.Task.CustomColourspace;
+
// Video
preset.VideoEncoder = EnumHelper<VideoEncoder>.GetShortName(export.Task.VideoEncoder);
preset.VideoFramerate = export.Task.Framerate.HasValue ? export.Task.Framerate.ToString() : null;