diff options
-rw-r--r-- | win/C#/Presets/PlistPresetHandler.cs | 53 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 8 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 9 | ||||
-rw-r--r-- | win/C#/frmMain.resx | 21 |
4 files changed, 40 insertions, 51 deletions
diff --git a/win/C#/Presets/PlistPresetHandler.cs b/win/C#/Presets/PlistPresetHandler.cs index a030cfd44..d05cb52af 100644 --- a/win/C#/Presets/PlistPresetHandler.cs +++ b/win/C#/Presets/PlistPresetHandler.cs @@ -337,10 +337,7 @@ namespace Handbrake.Presets public static void Export(string path, Preset preset)
{
QueryParser parsed = QueryParser.Parse(preset.Query);
-
- XmlTextWriter xmlWriter;
-
- xmlWriter = new XmlTextWriter(path, Encoding.UTF8);
+ XmlTextWriter xmlWriter = new XmlTextWriter(path, Encoding.UTF8) { Formatting = Formatting.Indented };
// Header
xmlWriter.WriteStartDocument();
@@ -399,16 +396,16 @@ namespace Handbrake.Presets private static void AddEncodeSettings(XmlTextWriter xmlWriter, QueryParser parsed, Preset preset)
{
AddEncodeElement(xmlWriter, "ChapterMarkers", "integer", parsed.ChapterMarkers ? "1" : "0");
- AddEncodeElement(xmlWriter, "Default", "integer", string.Empty); // TODO
- AddEncodeElement(xmlWriter, "FileFormat", "string", parsed.Format);
- AddBooleanElement(xmlWriter, "Folder", false); // TODO
+ AddEncodeElement(xmlWriter, "Default", "integer", "0");
+ AddEncodeElement(xmlWriter, "FileFormat", "string", parsed.Format.ToUpper() + " file");
+ AddBooleanElement(xmlWriter, "Folder", false);
AddEncodeElement(xmlWriter, "Mp4HttpOptimize", "integer", parsed.OptimizeMP4 ? "1" : "0");
AddEncodeElement(xmlWriter, "Mp4LargeFile", "integer", parsed.LargeMP4 ? "1" : "0");
AddEncodeElement(xmlWriter, "Mp4iPodCompatible", "integer", parsed.IpodAtom ? "1" : "0");
- AddEncodeElement(xmlWriter, "PictureAutoCrop", "integer", "1"); // TODO
+ AddEncodeElement(xmlWriter, "PictureAutoCrop", "integer", "1");
AddEncodeElement(xmlWriter, "PictureBottomCrop", "integer", parsed.CropBottom);
- // Filters - TODO Requires Some Logic to convert modes
+ // Filters
AddEncodeElement(xmlWriter, "PictureDeblock", "integer", parsed.DeBlock.ToString());
switch (parsed.Decomb)
@@ -496,6 +493,7 @@ namespace Handbrake.Presets AddEncodeElement(xmlWriter, "PictureHeight", "integer", parsed.Height.ToString());
AddEncodeElement(xmlWriter, "PictureKeepRatio", "integer", parsed.KeepDisplayAsect ? "1" : "0");
AddEncodeElement(xmlWriter, "PictureLeftCrop", "integer", parsed.CropLeft);
+ AddEncodeElement(xmlWriter, "PictureModulus", "integer", parsed.AnamorphicModulus.ToString());
AddEncodeElement(xmlWriter, "PicturePAR", "integer", parsed.AnamorphicMode.ToString());
AddEncodeElement(xmlWriter, "PictureRightCrop", "integer", parsed.CropRight);
AddEncodeElement(xmlWriter, "PictureTopCrop", "integer", parsed.CropTop);
@@ -508,14 +506,15 @@ namespace Handbrake.Presets AddEncodeElement(xmlWriter, "Type", "integer", "1"); // 1 is user preset, 0 is built in
// Preset Settings
- AddEncodeElement(xmlWriter, "UsesMaxPictureSettings", "integer", (parsed.MaxWidth != 0 || parsed.MaxHeight != 0).ToString());
- AddEncodeElement(xmlWriter, "UsesPictureFilters", "integer", "True");
- AddEncodeElement(xmlWriter, "UsesPictureSettings", "integer", "True");
+ AddEncodeElement(xmlWriter, "UsesMaxPictureSettings", "integer", (parsed.MaxWidth != 0 || parsed.MaxHeight != 0) ? "1" : "0");
+ AddEncodeElement(xmlWriter, "UsesPictureFilters", "integer", "1");
+ AddEncodeElement(xmlWriter, "UsesPictureSettings", "integer", "2");
// Video Settings
AddEncodeElement(xmlWriter, "VideoAvgBitrate", "string", parsed.AverageVideoBitrate);
AddEncodeElement(xmlWriter, "VideoEncoder", "string", parsed.VideoEncoder);
AddEncodeElement(xmlWriter, "VideoFramerate", "string", parsed.VideoFramerate);
+ AddEncodeElement(xmlWriter, "VideFrameratePFR", "integer", parsed.Pfr ? "1" : "0");
AddEncodeElement(xmlWriter, "VideoGrayScale", "integer", parsed.Grayscale ? "1" : "0");
AddEncodeElement(xmlWriter, "VideoQualitySlider", "real", parsed.VideoQuality.ToString());
@@ -580,6 +579,13 @@ namespace Handbrake.Presets private static void AddEncodeElement(XmlTextWriter xmlWriter, string keyName, string type, string value)
{
xmlWriter.WriteElementString("key", keyName);
+
+ // This is a hack for Apples XML parser. It doesn't understand <integer /> so instead, always set a default value
+ // of 0 if the value is empty.
+ if (type == "integer" && string.IsNullOrEmpty(value))
+ {
+ value = "0";
+ }
xmlWriter.WriteElementString(type, value);
}
@@ -617,37 +623,28 @@ namespace Handbrake.Presets /// </param>
private static void AddAudioItem(XmlTextWriter xmlWriter, AudioTrack audioTrack)
{
- string bitrate = audioTrack.Bitrate;
- string encoder = audioTrack.Encoder;
- string mixdown = audioTrack.MixDown;
- string sample = audioTrack.SampleRate;
- int track;
- int.TryParse(audioTrack.Track, out track);
- string drc = audioTrack.DRC;
- string desc = "Automatic";
-
xmlWriter.WriteStartElement("dict");
xmlWriter.WriteElementString("key", "AudioBitrate");
- xmlWriter.WriteElementString("string", bitrate);
+ xmlWriter.WriteElementString("string", audioTrack.Bitrate);
xmlWriter.WriteElementString("key", "AudioEncoder");
- xmlWriter.WriteElementString("string", encoder);
+ xmlWriter.WriteElementString("string", audioTrack.Encoder);
xmlWriter.WriteElementString("key", "AudioMixdown");
- xmlWriter.WriteElementString("string", mixdown);
+ xmlWriter.WriteElementString("string", audioTrack.MixDown);
xmlWriter.WriteElementString("key", "AudioSamplerate");
- xmlWriter.WriteElementString("string", sample);
+ xmlWriter.WriteElementString("string", audioTrack.SampleRate);
xmlWriter.WriteElementString("key", "AudioTrack");
- xmlWriter.WriteElementString("integer", track.ToString());
+ xmlWriter.WriteElementString("integer", audioTrack.Track);
xmlWriter.WriteElementString("key", "AudioTrackDRCSlider");
- xmlWriter.WriteElementString("real", drc);
+ xmlWriter.WriteElementString("real", audioTrack.DRC);
xmlWriter.WriteElementString("key", "AudioTrackDescription");
- xmlWriter.WriteElementString("string", desc);
+ xmlWriter.WriteElementString("string", "Unknown");
xmlWriter.WriteEndElement();
}
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index f4dee1681..b42649b43 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -39,7 +39,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container();
System.Windows.Forms.ContextMenuStrip notifyIconMenu;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();
this.DVD_Save = new System.Windows.Forms.SaveFileDialog();
this.ToolTip = new System.Windows.Forms.ToolTip(this.components);
@@ -407,9 +407,9 @@ namespace Handbrake //
// number
//
- dataGridViewCellStyle2.Format = "N0";
- dataGridViewCellStyle2.NullValue = null;
- this.number.DefaultCellStyle = dataGridViewCellStyle2;
+ dataGridViewCellStyle1.Format = "N0";
+ dataGridViewCellStyle1.NullValue = null;
+ this.number.DefaultCellStyle = dataGridViewCellStyle1;
this.number.Frozen = true;
this.number.HeaderText = "Chapter Number";
this.number.MaxInputLength = 3;
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 8c5ca36b5..b54fda06d 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -924,21 +924,16 @@ namespace Handbrake /// </summary>
private void ExportPreset()
{
- MessageBox.Show("This feature has not been implimented yet.", "Not Implimented", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
-
- /*SaveFileDialog savefiledialog = new SaveFileDialog();
- savefiledialog.Filter = "plist|*.plist";
+ SaveFileDialog savefiledialog = new SaveFileDialog { Filter = "plist|*.plist" };
if (treeView_presets.SelectedNode != null)
{
-
if (savefiledialog.ShowDialog() == DialogResult.OK)
{
Preset preset = presetHandler.GetPreset(treeView_presets.SelectedNode.Text);
PlistPresetHandler.Export(savefiledialog.FileName, preset);
}
- }*/
+ }
}
#endregion
diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index dc017b2cd..ef0cad28a 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -583,18 +583,6 @@ Clear the text box below to return to the internal query generation.</value> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>98</value>
</metadata>
- <metadata name="File_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>664, 15</value>
- </metadata>
- <metadata name="openPreset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>680, 54</value>
- </metadata>
- <metadata name="File_ChapterImport.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>787, 54</value>
- </metadata>
- <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>98</value>
- </metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA
@@ -974,4 +962,13 @@ Clear the text box below to return to the internal query generation.</value> AAD6AQAA4AEAAMABAACAAQAAgAEAAMBBAADAYQAAjGEAAIRhAADc+wAA3/8AAA==
</value>
</data>
+ <metadata name="File_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>664, 15</value>
+ </metadata>
+ <metadata name="openPreset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>680, 54</value>
+ </metadata>
+ <metadata name="File_ChapterImport.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>787, 54</value>
+ </metadata>
</root>
\ No newline at end of file |