From f3c2acc2e605655b26091b202f74981ae0486bea Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 12 Apr 2012 19:30:26 +0000 Subject: WinGui: Lots of fixes to the Plist Import / Export functionality. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4593 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Utilities/PlistUtility.cs | 88 ++++++++++++++-------- 1 file changed, 57 insertions(+), 31 deletions(-) (limited to 'win/CS') diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs index ccac82893..96e8d917c 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs @@ -6,7 +6,6 @@ namespace HandBrake.ApplicationServices.Utilities { using System; - using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Text; @@ -32,6 +31,14 @@ namespace HandBrake.ApplicationServices.Utilities #region Import + /// + /// Import a Plist Preset + /// + /// + /// The filename. + /// + /// + /// public static Preset Import(string filename) { Preset preset = new Preset(); @@ -94,7 +101,7 @@ namespace HandBrake.ApplicationServices.Utilities track.SampleRate = value == "Auto" ? 0 : double.Parse(value); break; case "AudioTrack": - //track.SourceTrack = value; + //track.SourceTrack = value; break; case "AudioTrackDRCSlider": track.DRC = double.Parse(value); @@ -121,7 +128,7 @@ namespace HandBrake.ApplicationServices.Utilities switch (key) { - // Output Settings + // Output Settings case "FileFormat": parsed.OutputFormat = Converters.GetFileFormat(value.Replace("file", string.Empty).Trim()); break; @@ -129,13 +136,13 @@ namespace HandBrake.ApplicationServices.Utilities parsed.OptimizeMP4 = value == "1"; break; case "Mp4LargeFile": - parsed.IPod5GSupport = value == "1"; + parsed.LargeFile = value == "1"; break; case "Mp4iPodCompatible": parsed.IPod5GSupport = value == "1"; break; - // Picture Settings + // Picture Settings case "PictureAutoCrop": parsed.HasCropping = value != "1"; break; @@ -178,16 +185,23 @@ namespace HandBrake.ApplicationServices.Utilities } break; - // Filters + // Filters case "PictureDeblock": parsed.Deblock = int.Parse(value); break; case "PictureDecomb": parsed.Decomb = Decomb.Off; - // Don't place custom here as it's handled in the filter panel - if (value == "2") + switch (value) { - parsed.Decomb = Decomb.Default; + case "1": + parsed.Decomb = Decomb.Custom; + break; + case "2": + parsed.Decomb = Decomb.Default; + break; + case "3": + parsed.Decomb = Decomb.Fast; + break; } break; case "PictureDecombCustom": @@ -205,7 +219,9 @@ namespace HandBrake.ApplicationServices.Utilities case "0": parsed.Deinterlace = Deinterlace.Off; break; - // Don't place custom here as it's handled in the filter panel + case "1": + parsed.Deinterlace = Deinterlace.Custom; + break; case "2": parsed.Deinterlace = Deinterlace.Fast; break; @@ -229,7 +245,9 @@ namespace HandBrake.ApplicationServices.Utilities case "0": parsed.Denoise = Denoise.Off; break; - // Don't place custom here as it's handled in the filter panel + case "1": + parsed.Denoise = Denoise.Custom; + break; case "2": parsed.Denoise = Denoise.Weak; break; @@ -251,6 +269,10 @@ namespace HandBrake.ApplicationServices.Utilities case "PictureDetelecine": parsed.Detelecine = Detelecine.Off; if (value == "1") + { + parsed.Detelecine = Detelecine.Custom; + } + if (value == "2") { parsed.Detelecine = Detelecine.Default; } @@ -262,7 +284,7 @@ namespace HandBrake.ApplicationServices.Utilities } break; - // Video Tab + // Video Tab case "VideoAvgBitrate": if (!string.IsNullOrEmpty(value)) { @@ -316,17 +338,17 @@ namespace HandBrake.ApplicationServices.Utilities parsed.TwoPass = value == "1"; break; - // Chapter Markers Tab + // Chapter Markers Tab case "ChapterMarkers": parsed.IncludeChapterMarkers = value == "1"; break; - // Advanced x264 tab + // Advanced x264 tab case "x264Option": parsed.AdvancedEncoderOptions = value; break; - // Preset Information + // Preset Information case "PresetBuildNumber": preset.Version = value; break; @@ -554,11 +576,15 @@ namespace HandBrake.ApplicationServices.Utilities AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty); break; case Decomb.Default: - AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "1"); + AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "2"); AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty); break; - default: - AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "2"); + case Decomb.Fast: + AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "3"); + AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty); + break; + case Decomb.Custom: + AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "1"); AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", parsed.CustomDecomb); break; } @@ -571,19 +597,19 @@ namespace HandBrake.ApplicationServices.Utilities AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty); break; case Deinterlace.Fast: - AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "1"); + AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "2"); AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty); break; case Deinterlace.Slow: - AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "2"); + AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "3"); AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty); break; case Deinterlace.Slower: - AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "3"); + AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "4"); AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty); break; - default: - AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "4"); + case Deinterlace.Custom: + AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "1"); AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", parsed.CustomDeinterlace); break; } @@ -595,24 +621,24 @@ namespace HandBrake.ApplicationServices.Utilities AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty); break; case Denoise.Weak: - AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "1"); + AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "2"); AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty); break; case Denoise.Medium: - AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "2"); + AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "3"); AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty); break; case Denoise.Strong: - AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "3"); + AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "4"); AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty); break; - default: - AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "4"); + case Denoise.Custom: + AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "1"); AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", parsed.CustomDenoise); break; } - int detelecine; + int detelecine = 0; switch (parsed.Detelecine) { case Detelecine.Off: @@ -621,7 +647,7 @@ namespace HandBrake.ApplicationServices.Utilities case Detelecine.Default: detelecine = 2; break; - default: + case Detelecine.Custom: detelecine = 1; break; } @@ -779,7 +805,7 @@ namespace HandBrake.ApplicationServices.Utilities xmlWriter.WriteElementString("key", "AudioTrackGainSlider"); xmlWriter.WriteElementString("real", audioTrack.Gain.ToString()); - + xmlWriter.WriteEndElement(); } #endregion -- cgit v1.2.3