diff options
author | sr55 <[email protected]> | 2018-07-08 18:23:50 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2018-07-08 18:23:50 +0100 |
commit | e3a2f723adc662f1ba5707cdeeea62449c70fd7d (patch) | |
tree | 4441e761ff13613831d0fafb93dc75747d239852 /win/CS/HandBrakeWPF/Services | |
parent | e8c7818b83befe3a3e2fad73c61041b16d8d0055 (diff) |
WinGui: Simplify the Deinterlace / Decomb / Interlace Detection Tab and associated code. Tweak the layout of the deinterlace controls to match the Mac/Linux UI's. Pull Presets from libhb.
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
3 files changed, 16 insertions, 79 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs index cd21d7b47..e938f8b5a 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs @@ -426,7 +426,7 @@ namespace HandBrakeWPF.Services.Encode.Factories // Deinterlace if (job.DeinterlaceFilter == DeinterlaceFilter.Yadif) { - IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DEINTERLACE, EnumHelper<Deinterlace>.GetShortName(job.Deinterlace), null, job.CustomDeinterlace); + IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DEINTERLACE, job.DeinterlacePreset?.ShortName, null, job.CustomDeinterlaceSettings); string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); if (!string.IsNullOrEmpty(unparsedJson)) { @@ -440,7 +440,7 @@ namespace HandBrakeWPF.Services.Encode.Factories // Decomb if (job.DeinterlaceFilter == DeinterlaceFilter.Decomb) { - IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DECOMB, EnumHelper<Decomb>.GetShortName(job.Decomb), null, job.CustomDecomb); + IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DECOMB, job.DeinterlacePreset?.ShortName, null, job.CustomDeinterlaceSettings); string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); if (!string.IsNullOrEmpty(unparsedJson)) { diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs index c40c6c0b9..a57b2e43b 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs @@ -90,15 +90,13 @@ namespace HandBrakeWPF.Services.Encode.Model this.AlignAVStart = task.AlignAVStart; this.ChapterMarkersFilePath = task.ChapterMarkersFilePath; this.Cropping = new Cropping(task.Cropping); - this.CustomDecomb = task.CustomDecomb; - this.CustomDeinterlace = task.CustomDeinterlace; + this.CustomDeinterlaceSettings = task.CustomDeinterlaceSettings; this.CustomDenoise = task.CustomDenoise; this.CustomDetelecine = task.CustomDetelecine; this.CustomCombDetect = task.CustomCombDetect; this.CombDetect = task.CombDetect; this.Deblock = task.Deblock; - this.Decomb = task.Decomb; - this.Deinterlace = task.Deinterlace; + this.DeinterlacePreset = task.DeinterlacePreset; this.DeinterlaceFilter = task.DeinterlaceFilter; this.Denoise = task.Denoise; this.DenoisePreset = task.DenoisePreset; @@ -297,17 +295,7 @@ namespace HandBrakeWPF.Services.Encode.Model /// <summary> /// Gets or sets Deinterlace. /// </summary> - public Deinterlace Deinterlace { get; set; } - - /// <summary> - /// Gets or sets CustomDeinterlace. - /// </summary> - public string CustomDeinterlace { get; set; } - - /// <summary> - /// Gets or sets Decomb. - /// </summary> - public Decomb Decomb { get; set; } + public HBPresetTune DeinterlacePreset { get; set; } /// <summary> /// Gets or sets the comb detect. @@ -317,7 +305,7 @@ namespace HandBrakeWPF.Services.Encode.Model /// <summary> /// Gets or sets CustomDecomb. /// </summary> - public string CustomDecomb { get; set; } + public string CustomDeinterlaceSettings { get; set; } /// <summary> /// Gets or sets the custom comb detect. diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index cdb815d32..3f86e1aa5 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -136,77 +136,30 @@ namespace HandBrakeWPF.Services.Presets.Factories switch (importedPreset.PictureDeinterlaceFilter)
{
case "decomb":
- preset.Task.Decomb = Decomb.Default;
- preset.Task.Deinterlace = Deinterlace.Default;
preset.Task.DeinterlaceFilter = DeinterlaceFilter.Decomb;
break;
case "yadif":
- preset.Task.Decomb = Decomb.Default;
- preset.Task.Deinterlace = Deinterlace.Default;
preset.Task.DeinterlaceFilter = DeinterlaceFilter.Yadif;
break;
default:
- preset.Task.Decomb = Decomb.Default;
- preset.Task.Deinterlace = Deinterlace.Default;
preset.Task.DeinterlaceFilter = DeinterlaceFilter.Off;
break;
}
if (preset.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb)
{
- switch (importedPreset.PictureDeinterlacePreset)
- {
- 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 "eedi2":
- preset.Task.Decomb = Decomb.EEDI2;
- break;
- case "eedi2bob":
- preset.Task.Decomb = Decomb.EEDI2Bob;
- break;
- default:
- preset.Task.Decomb = Decomb.Default;
- break;
- }
-
- if (preset.Task.Decomb == Decomb.Custom)
- {
- preset.Task.CustomDecomb = importedPreset.PictureDeinterlaceCustom;
- }
+ List<HBPresetTune> filterPresets = HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_DECOMB);
+ HBPresetTune presetTune = filterPresets.FirstOrDefault(f => f.ShortName == importedPreset.PictureDeinterlacePreset);
+ preset.Task.DeinterlacePreset = presetTune ?? new HBPresetTune("Default", "default");
+ preset.Task.CustomDeinterlaceSettings = importedPreset.PictureDeinterlaceCustom;
}
if (preset.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif)
{
- switch (importedPreset.PictureDeinterlacePreset)
- {
- case "custom":
- preset.Task.Deinterlace = Deinterlace.Custom;
- break;
- case "bob":
- preset.Task.Deinterlace = Deinterlace.Bob;
- break;
- case "skip-spatial":
- preset.Task.Deinterlace = Deinterlace.SkipSpatialCheck;
- break;
- case "default":
- preset.Task.Deinterlace = Deinterlace.Default;
- break;
- default:
- preset.Task.Deinterlace = Deinterlace.Default;
- break;
- }
-
- if (preset.Task.Deinterlace == Deinterlace.Custom)
- {
- preset.Task.CustomDeinterlace = importedPreset.PictureDeinterlaceCustom;
- }
+ List<HBPresetTune> filterPresets = HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_DEINTERLACE);
+ HBPresetTune presetTune = filterPresets.FirstOrDefault(f => f.ShortName == importedPreset.PictureDeinterlacePreset);
+ preset.Task.DeinterlacePreset = presetTune ?? new HBPresetTune("Default", "default");
+ preset.Task.CustomDeinterlaceSettings = importedPreset.PictureDeinterlaceCustom;
}
if (preset.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif || preset.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb)
@@ -650,12 +603,8 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.PictureDeinterlaceFilter = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
? "decomb"
: export.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif ? "yadif" : "off";
- preset.PictureDeinterlacePreset = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
- ? EnumHelper<Decomb>.GetShortName(export.Task.Decomb)
- : export.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif ? EnumHelper<Deinterlace>.GetShortName(export.Task.Deinterlace) : string.Empty;
- preset.PictureDeinterlaceCustom = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
- ? export.Task.CustomDecomb
- : export.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif ? export.Task.CustomDeinterlace : string.Empty;
+ preset.PictureDeinterlacePreset = export.Task.DeinterlacePreset?.ShortName;
+ preset.PictureDeinterlaceCustom = export.Task.CustomDeinterlaceSettings;
preset.PictureCombDetectPreset = EnumHelper<CombDetect>.GetShortName(export.Task.CombDetect);
preset.PictureCombDetectCustom = export.Task.CustomCombDetect;
|