From 52206517b2aefe811dae08849442a930d58f43aa Mon Sep 17 00:00:00 2001 From: Scott Date: Fri, 9 Oct 2015 22:37:30 +0100 Subject: Updating for the new deinterlace/decomb preset keys. --- .../Interop/Json/Presets/HBPreset.cs | 16 +--- .../Presets/Factories/JsonPresetFactory.cs | 100 +++++++++++++-------- 2 files changed, 65 insertions(+), 51 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs index 6112a26a3..f84ad3310 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs @@ -121,25 +121,15 @@ namespace HandBrake.ApplicationServices.Interop.Json.Presets /// public int PictureDeblock { get; set; } - /// - /// Gets or sets the picture decomb. - /// - public string PictureDecomb { get; set; } - - /// - /// Gets or sets the picture decomb custom. - /// - public string PictureDecombCustom { get; set; } - /// /// Gets or sets a value indicating whether picture decomb deinterlace. /// - public bool PictureDecombDeinterlace { get; set; } + public string PictureDeinterlaceFilter { get; set; } /// - /// Gets or sets the picture deinterlace. + /// Gets or sets the picture deinterlace preset. /// - public string PictureDeinterlace { get; set; } + public string PictureDeinterlacePreset { get; set; } /// /// Gets or sets the picture deinterlace custom. diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index b19cd9df3..bf6e6560e 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -94,53 +94,78 @@ namespace HandBrakeWPF.Services.Presets.Factories /* Filter Settings */ preset.Task.Grayscale = importedPreset.VideoGrayScale; preset.Task.Deblock = importedPreset.PictureDeblock; - switch (importedPreset.PictureDecomb) + + switch (importedPreset.PictureDeinterlaceFilter) { - case "custom": - preset.Task.Decomb = Decomb.Custom; - break; - case "default": + case "decomb": preset.Task.Decomb = Decomb.Default; + preset.Task.Deinterlace = Deinterlace.Off; break; - case "bob": - preset.Task.Decomb = Decomb.Bob; - break; - case "fast": - preset.Task.Decomb = Decomb.Fast; + case "deinterlace": + preset.Task.Decomb = Decomb.Off; + preset.Task.Deinterlace = Deinterlace.Fast; break; - default: preset.Task.Decomb = Decomb.Off; + preset.Task.Deinterlace = Deinterlace.Off; break; } - preset.Task.CustomDecomb = importedPreset.PictureDecombCustom; - - if (!importedPreset.PictureDecombDeinterlace) + if (preset.Task.Decomb != Decomb.Off) { - preset.Task.Decomb = Decomb.Off; + switch (importedPreset.PictureDeinterlaceFilter) + { + case "custom": + preset.Task.Decomb = Decomb.Custom; + break; + case "default": + preset.Task.Decomb = Decomb.Default; + break; + case "bob": + preset.Task.Decomb = Decomb.Bob; + break; + case "fast": + preset.Task.Decomb = Decomb.Fast; + break; + default: + preset.Task.Decomb = Decomb.Default; + break; + } + + if (preset.Task.Decomb == Decomb.Custom) + { + preset.Task.CustomDecomb = importedPreset.PictureDeinterlaceCustom; + } } - switch (importedPreset.PictureDeinterlace) + if (preset.Task.Deinterlace != Deinterlace.Off) { - case "custom": - preset.Task.Deinterlace = Deinterlace.Custom; - break; - case "bob": - preset.Task.Deinterlace = Deinterlace.Bob; - break; - case "gast": - preset.Task.Deinterlace = Deinterlace.Fast; - break; - case "slow": - preset.Task.Deinterlace = Deinterlace.Slow; - break; - case "slower": - preset.Task.Deinterlace = Deinterlace.Slower; - break; - default: - preset.Task.Deinterlace = Deinterlace.Off; - break; + switch (importedPreset.PictureDeinterlaceFilter) + { + case "custom": + preset.Task.Deinterlace = Deinterlace.Custom; + break; + case "bob": + preset.Task.Deinterlace = Deinterlace.Bob; + break; + case "fast": + preset.Task.Deinterlace = Deinterlace.Fast; + break; + case "slow": + preset.Task.Deinterlace = Deinterlace.Slow; + break; + case "slower": + preset.Task.Deinterlace = Deinterlace.Slower; + break; + default: + preset.Task.Deinterlace = Deinterlace.Fast; + break; + } + + if (preset.Task.Deinterlace == Deinterlace.Custom) + { + preset.Task.CustomDecomb = importedPreset.PictureDeinterlaceCustom; + } } preset.Task.CustomDeinterlace = importedPreset.PictureDetelecineCustom; @@ -485,10 +510,9 @@ namespace HandBrakeWPF.Services.Presets.Factories // Filters preset.PictureDeblock = export.Task.Deblock; - preset.PictureDecomb = EnumHelper.GetShortName(export.Task.Decomb); - preset.PictureDecombCustom = export.Task.CustomDecomb; - preset.PictureDecombDeinterlace = export.Task.Decomb != Decomb.Off; - preset.PictureDeinterlace = EnumHelper.GetShortName(export.Task.Deinterlace); + preset.PictureDeinterlaceFilter = export.Task.Decomb != Decomb.Off ? "decomb" : export.Task.Deinterlace != Deinterlace.Off ? "deinterlace" : "off"; + preset.PictureDeinterlacePreset = export.Task.Decomb != Decomb.Off ? EnumHelper.GetShortName(export.Task.Decomb) : export.Task.Deinterlace != Deinterlace.Off ? EnumHelper.GetShortName(export.Task.Deinterlace) : string.Empty; + preset.PictureDeinterlaceCustom = export.Task.Decomb != Decomb.Off ? export.Task.CustomDecomb : export.Task.Deinterlace != Deinterlace.Off ? export.Task.CustomDeinterlace : string.Empty; preset.PictureDeinterlaceCustom = export.Task.CustomDeinterlace; preset.PictureDenoiseCustom = export.Task.CustomDenoise; preset.PictureDenoiseFilter = EnumHelper.GetShortName(export.Task.Denoise); -- cgit v1.2.3