]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Mon, 18 Jan 2010 13:42:08 +0000 (13:42 +0000)
committersr55 <sr55.hb@outlook.com>
Mon, 18 Jan 2010 13:42:08 +0000 (13:42 +0000)
- Just some re-factored code.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3077 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Controls/AudioPanel.Designer.cs
win/C#/Controls/AudioPanel.cs
win/C#/Controls/Filters.cs
win/C#/EncodeQueue/Encode.cs
win/C#/Functions/PresetLoader.cs
win/C#/Functions/QueryParser.cs
win/C#/Presets/Import.cs

index d31b4f218c689ca3501b77f598be692829178ce4..46692e570baaae9f72a318801d20e8959f882172 100644 (file)
@@ -85,7 +85,6 @@ namespace Handbrake.Controls
             this.lv_audioList.FullRowSelect = true;\r
             this.lv_audioList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;\r
             this.lv_audioList.HideSelection = false;\r
-            this.lv_audioList.LabelWrap = false;\r
             this.lv_audioList.Location = new System.Drawing.Point(16, 150);\r
             this.lv_audioList.MultiSelect = false;\r
             this.lv_audioList.Name = "lv_audioList";\r
@@ -128,6 +127,7 @@ namespace Handbrake.Controls
             // col_drc\r
             // \r
             this.col_drc.Text = "DRC";\r
+            this.col_drc.Width = 57;\r
             // \r
             // audioMenu\r
             // \r
@@ -223,7 +223,7 @@ namespace Handbrake.Controls
             this.tb_drc.Size = new System.Drawing.Size(57, 45);\r
             this.tb_drc.TabIndex = 60;\r
             this.tb_drc.TickFrequency = 10;\r
-            this.tb_drc.Scroll += new System.EventHandler(this.tb_drc_Scroll);\r
+            this.tb_drc.Scroll += new System.EventHandler(this.controlChanged);\r
             // \r
             // label68\r
             // \r
@@ -289,7 +289,7 @@ namespace Handbrake.Controls
             this.drp_audioEncoder.Name = "drp_audioEncoder";\r
             this.drp_audioEncoder.Size = new System.Drawing.Size(111, 21);\r
             this.drp_audioEncoder.TabIndex = 52;\r
-            this.drp_audioEncoder.SelectedIndexChanged += new System.EventHandler(this.drp_audenc_SelectedIndexChanged);\r
+            this.drp_audioEncoder.SelectedIndexChanged += new System.EventHandler(this.controlChanged);\r
             // \r
             // label27\r
             // \r
@@ -316,7 +316,7 @@ namespace Handbrake.Controls
             this.drp_audioMix.Name = "drp_audioMix";\r
             this.drp_audioMix.Size = new System.Drawing.Size(129, 21);\r
             this.drp_audioMix.TabIndex = 54;\r
-            this.drp_audioMix.SelectedIndexChanged += new System.EventHandler(this.drp_audmix_SelectedIndexChanged);\r
+            this.drp_audioMix.SelectedIndexChanged += new System.EventHandler(this.controlChanged);\r
             // \r
             // drp_audioTrack\r
             // \r
@@ -328,7 +328,7 @@ namespace Handbrake.Controls
             this.drp_audioTrack.Name = "drp_audioTrack";\r
             this.drp_audioTrack.Size = new System.Drawing.Size(194, 21);\r
             this.drp_audioTrack.TabIndex = 50;\r
-            this.drp_audioTrack.SelectedIndexChanged += new System.EventHandler(this.drp_audioTrack_SelectedIndexChanged);\r
+            this.drp_audioTrack.SelectedIndexChanged += new System.EventHandler(this.controlChanged);\r
             // \r
             // drp_audioBitrate\r
             // \r
@@ -349,7 +349,7 @@ namespace Handbrake.Controls
             this.drp_audioBitrate.Name = "drp_audioBitrate";\r
             this.drp_audioBitrate.Size = new System.Drawing.Size(70, 21);\r
             this.drp_audioBitrate.TabIndex = 58;\r
-            this.drp_audioBitrate.SelectedIndexChanged += new System.EventHandler(this.drp_audbit_SelectedIndexChanged);\r
+            this.drp_audioBitrate.SelectedIndexChanged += new System.EventHandler(this.controlChanged);\r
             // \r
             // drp_audioSample\r
             // \r
@@ -366,7 +366,7 @@ namespace Handbrake.Controls
             this.drp_audioSample.Name = "drp_audioSample";\r
             this.drp_audioSample.Size = new System.Drawing.Size(55, 21);\r
             this.drp_audioSample.TabIndex = 56;\r
-            this.drp_audioSample.SelectedIndexChanged += new System.EventHandler(this.drp_audsr_SelectedIndexChanged);\r
+            this.drp_audioSample.SelectedIndexChanged += new System.EventHandler(this.controlChanged);\r
             // \r
             // AudioTrackGroup\r
             // \r
index 867dbbabfc8b39f492d48137f2f3d1a91642a2cf..73b28f3ab12c85150da9ae1216ed7774ce8eb8c0 100644 (file)
@@ -5,6 +5,7 @@
           It may be used under the terms of the GNU General Public License. */\r
 \r
 using System;\r
+using System.Linq;\r
 using System.Windows.Forms;\r
 \r
 namespace Handbrake.Controls\r
@@ -16,145 +17,97 @@ namespace Handbrake.Controls
         public AudioPanel()\r
         {\r
             InitializeComponent();\r
-            drp_audioMix.SelectedIndex = 0;\r
+            drp_audioMix.SelectedItem = "Dolby Pro Logic II";\r
+            drp_audioSample.SelectedIndex = 1;\r
         }\r
 \r
-        // Audio Track Options\r
-        private void drp_audioTrack_SelectedIndexChanged(object sender, EventArgs e)\r
-        {\r
-            if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text = drp_audioTrack.Text;\r
-                lv_audioList.Select();\r
-            }\r
-        }\r
-        private void drp_audenc_SelectedIndexChanged(object sender, EventArgs e)\r
+        // Control and ListView\r
+        private void controlChanged(object sender, EventArgs e)\r
         {\r
-            // Setup the widgets with the correct avail options\r
-            if (drp_audioEncoder.Text.Contains("AAC"))\r
-            {\r
-                setMixDown(true);\r
-                setBitrate(160);\r
-            }\r
-            else\r
-            {\r
-                setMixDown(false);\r
-                setBitrate(320);\r
-            }\r
+            Control ctl = (Control)sender;\r
 \r
-            // Configure the widgets with values\r
-            if (drp_audioEncoder.Text.Contains("AC3") || drp_audioEncoder.Text.Contains("DTS"))\r
+            switch (ctl.Name)\r
             {\r
-                drp_audioMix.Enabled = false;\r
-                drp_audioBitrate.Enabled = false;\r
-                drp_audioSample.Enabled = false;\r
-                tb_drc.Enabled = false;\r
-\r
-                lbl_bitrate.Enabled = false;\r
-                lbl_drc.Enabled = false;\r
-                lbl_drcHeader.Enabled = false;\r
-                lbl_mixdown.Enabled = false;\r
-                lbl_sampleRate.Enabled = false;\r
-\r
-                drp_audioBitrate.SelectedIndex = 0;\r
-                drp_audioSample.SelectedIndex = 0;\r
-                drp_audioMix.Items.Add("AC3 Passthru");\r
-                drp_audioMix.Items.Add("DTS Passthru");\r
-\r
-                if (drp_audioEncoder.Text.Contains("AC3"))\r
-                    drp_audioMix.SelectedItem = "AC3 Passthru";\r
-                else\r
-                    drp_audioMix.SelectedItem = "DTS Passthru";\r
+                case "drp_audioTrack":\r
+                    if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
+                        lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text = drp_audioTrack.Text;\r
+                    break;\r
+                case "drp_audioEncoder":\r
+                    SetMixDown();\r
+                    SetBitrate();\r
+\r
+                    // Configure the widgets with values\r
+                    if (drp_audioEncoder.Text.Contains("AC3") || drp_audioEncoder.Text.Contains("DTS"))\r
+                    {\r
+                        drp_audioMix.Enabled = drp_audioBitrate.Enabled = drp_audioSample.Enabled = tb_drc.Enabled = false;\r
+                        lbl_bitrate.Enabled = lbl_drc.Enabled = lbl_drcHeader.Enabled = lbl_mixdown.Enabled = lbl_sampleRate.Enabled = false;\r
+                    }\r
+                    else\r
+                    {\r
+                        drp_audioMix.Enabled = drp_audioBitrate.Enabled = drp_audioSample.Enabled = tb_drc.Enabled = true;\r
+                        lbl_bitrate.Enabled = lbl_drc.Enabled = lbl_drcHeader.Enabled = lbl_mixdown.Enabled = lbl_sampleRate.Enabled = true;\r
+                    }\r
 \r
-                drp_audioBitrate.Items.Add("Auto");\r
-                drp_audioBitrate.SelectedItem = "Auto";\r
-                tb_drc.Value = 0;\r
-            }\r
-            else\r
-            {\r
-                drp_audioMix.Enabled = true;\r
-                drp_audioBitrate.Enabled = true;\r
-                drp_audioSample.Enabled = true;\r
-                tb_drc.Enabled = true;\r
-\r
-                lbl_bitrate.Enabled = true;\r
-                lbl_drc.Enabled = true;\r
-                lbl_drcHeader.Enabled = true;\r
-                lbl_mixdown.Enabled = true;\r
-                lbl_sampleRate.Enabled = true;\r
-\r
-                drp_audioMix.Items.Remove("AC3 Passthru");\r
-                drp_audioMix.Items.Remove("DTS Passthru");\r
-                drp_audioBitrate.Items.Remove("Auto");\r
-\r
-                drp_audioMix.SelectedIndex = 0;\r
-                drp_audioBitrate.SelectedIndex = 9;\r
-                drp_audioSample.SelectedIndex = 0;\r
-            }\r
+                    // Update an item in the Audio list if required.\r
+                    if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
+                        lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text = drp_audioEncoder.Text;\r
+                    break;\r
+                case "drp_audioMix":\r
+                    SetBitrate();\r
+\r
+                    if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
+                        lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text = drp_audioMix.Text;\r
+                    break;\r
+                case "drp_audioSample":\r
+                    if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
+                        lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text = drp_audioSample.Text;\r
+                    break;\r
+                case "drp_audioBitrate":\r
+                    // Update an item in the Audio list if required.\r
+                    if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
+                        lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text = drp_audioBitrate.Text;\r
+                    break;\r
+                case "tb_drc":\r
+                    double value;\r
+                    if (tb_drc.Value == 0) value = 0;\r
+                    else\r
+                        value = ((tb_drc.Value - 1) / 10.0) + 1;\r
 \r
-            // Update an item in the Audio list if required.\r
-            if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text = drp_audioEncoder.Text;\r
-                if (drp_audioEncoder.Text.Contains("AC3"))\r
-                {\r
-                    lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text = "AC3 Passthru";\r
-                    lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text = "Auto";\r
-                    lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text = "Auto";\r
-                    lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text = "0.0";\r
-                }\r
-                lv_audioList.Select();\r
-            }\r
-        }\r
-        private void drp_audmix_SelectedIndexChanged(object sender, EventArgs e)\r
-        {\r
-            if ((drp_audioEncoder.Text.Contains("AAC")) && (drp_audioMix.Text == "6 Channel Discrete"))\r
-                setBitrate(384);\r
-            else if ((drp_audioEncoder.Text.Contains("AAC")) && (drp_audioMix.Text != "6 Channel Discrete"))\r
-                setBitrate(160);\r
+                    lbl_drc.Text = value.ToString();\r
 \r
-            // Update an item in the Audio list if required.\r
-            if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text = drp_audioMix.Text;\r
-                lv_audioList.Select();\r
-            }\r
-        }\r
-        private void drp_audsr_SelectedIndexChanged(object sender, EventArgs e)\r
-        {\r
-            // Update an item in the Audio list if required.\r
-            if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text = drp_audioSample.Text;\r
-                lv_audioList.Select();\r
+                    // Update an item in the Audio list if required.\r
+                    if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
+                    {\r
+                        lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text = value.ToString();\r
+                        lv_audioList.Select();\r
+                    }\r
+                    break;\r
             }\r
+\r
+            lv_audioList.Select();\r
         }\r
-        private void drp_audbit_SelectedIndexChanged(object sender, EventArgs e)\r
+        private void lv_audioList_SelectedIndexChanged(object sender, EventArgs e)\r
         {\r
-            // Update an item in the Audio list if required.\r
+            // Set the dropdown controls based on the selected item in the Audio List.\r
             if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
             {\r
-                if (drp_audioEncoder.Text.Contains("AC3"))\r
-                    drp_audioBitrate.SelectedItem = "Auto";\r
-                lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text = drp_audioBitrate.Text;\r
-                lv_audioList.Select();\r
-            }\r
-        }\r
-        private void tb_drc_Scroll(object sender, EventArgs e)\r
-        {\r
-            double value;\r
-            if (tb_drc.Value == 0) value = 0;\r
-            else\r
-                value = ((tb_drc.Value - 1) / 10.0) + 1;\r
-\r
-            lbl_drc.Text = value.ToString();\r
+                drp_audioTrack.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text;\r
+                drp_audioEncoder.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text;\r
+                drp_audioMix.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text;\r
+                drp_audioSample.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text;\r
+                drp_audioBitrate.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text;\r
+                double drcValue; int drcCalculated;\r
+                double.TryParse(lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text, out drcValue);\r
+                if (drcValue != 0)\r
+                    drcValue = ((drcValue * 10) + 1) - 10;\r
+                int.TryParse(drcValue.ToString(), out drcCalculated);\r
+                tb_drc.Value = drcCalculated;\r
+                lbl_drc.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text;\r
 \r
-            // Update an item in the Audio list if required.\r
-            if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text = value.ToString();\r
-                lv_audioList.Select();\r
+                AudioTrackGroup.Text = "Selected Track: " + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[0].Text;\r
             }\r
+            else\r
+                AudioTrackGroup.Text = "Selected Track: None (Click \"Add Track\" to add)";\r
         }\r
 \r
         // Track Controls\r
@@ -184,75 +137,21 @@ namespace Handbrake.Controls
         }\r
         private void btn_RemoveAudioTrack_Click(object sender, EventArgs e)\r
         {\r
-            RemoveAudioTrack();\r
+            RemoveTrack();\r
         }\r
 \r
         // Audio List Menu\r
         private void audioList_moveup_Click(object sender, EventArgs e)\r
         {\r
-            if (lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                ListViewItem item = lv_audioList.SelectedItems[0];\r
-                int index = item.Index;\r
-                index--;\r
-\r
-                if (lv_audioList.Items.Count > index && index >= 0)\r
-                {\r
-                    lv_audioList.Items.Remove(item);\r
-                    lv_audioList.Items.Insert(index, item);\r
-                    item.Selected = true;\r
-                    lv_audioList.Focus();\r
-                }\r
-            }\r
+            MoveTrack(true);\r
         }\r
         private void audioList_movedown_Click(object sender, EventArgs e)\r
         {\r
-            if (lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                ListViewItem item = lv_audioList.SelectedItems[0];\r
-                int index = item.Index;\r
-                index++;\r
-\r
-                if (index < lv_audioList.Items.Count)\r
-                {\r
-                    lv_audioList.Items.Remove(item);\r
-                    lv_audioList.Items.Insert(index, item);\r
-                    item.Selected = true;\r
-                    lv_audioList.Focus();\r
-                }\r
-            }\r
+            MoveTrack(false);\r
         }\r
         private void audioList_remove_Click(object sender, EventArgs e)\r
         {\r
-            RemoveAudioTrack();\r
-        }\r
-        private void RemoveAudioTrack()\r
-        {\r
-            // Remove the Item and reselect the control if the following conditions are met.\r
-            if (lv_audioList.SelectedItems.Count != 0)\r
-            {\r
-                // The Audio List is about to change so raise the event.\r
-                if (this.AudioListChanged != null)\r
-                    this.AudioListChanged(this, new EventArgs());\r
-\r
-                // Record the current selected index.\r
-                int currentPosition = lv_audioList.SelectedIndices[0];\r
-\r
-                lv_audioList.Items.RemoveAt(lv_audioList.SelectedIndices[0]);\r
-\r
-                // Now reslect the correct item and give focus to the audio list.\r
-                if (lv_audioList.Items.Count != 0)\r
-                {\r
-                    if (currentPosition <= (lv_audioList.Items.Count - 1))\r
-                        lv_audioList.Items[currentPosition].Selected = true;\r
-                    else if (currentPosition > (lv_audioList.Items.Count - 1))\r
-                        lv_audioList.Items[lv_audioList.Items.Count - 1].Selected = true;\r
-\r
-                    lv_audioList.Select();\r
-                }\r
-                // Regenerate the ID numers\r
-                reGenerateListIDs();\r
-            }\r
+            RemoveTrack();\r
         }\r
 \r
         // Public Functions\r
@@ -355,16 +254,57 @@ namespace Handbrake.Controls
         }\r
         public Boolean RequiresM4V()\r
         {\r
-            foreach (ListViewItem item in lv_audioList.Items)\r
+            return lv_audioList.Items.Cast<ListViewItem>().Any(item => item.SubItems[2].Text.Contains("AC3"));\r
+        }\r
+\r
+        // Helper Functions \r
+        private void RemoveTrack()\r
+        {\r
+            // Remove the Item and reselect the control if the following conditions are met.\r
+            if (lv_audioList.SelectedItems.Count != 0)\r
+            {\r
+                // The Audio List is about to change so raise the event.\r
+                if (this.AudioListChanged != null)\r
+                    this.AudioListChanged(this, new EventArgs());\r
+\r
+                // Record the current selected index.\r
+                int currentPosition = lv_audioList.SelectedIndices[0];\r
+\r
+                lv_audioList.Items.RemoveAt(lv_audioList.SelectedIndices[0]);\r
+\r
+                // Now reslect the correct item and give focus to the audio list.\r
+                if (lv_audioList.Items.Count != 0)\r
+                {\r
+                    if (currentPosition <= (lv_audioList.Items.Count - 1))\r
+                        lv_audioList.Items[currentPosition].Selected = true;\r
+                    else if (currentPosition > (lv_audioList.Items.Count - 1))\r
+                        lv_audioList.Items[lv_audioList.Items.Count - 1].Selected = true;\r
+\r
+                    lv_audioList.Select();\r
+                }\r
+                // Regenerate the ID numers\r
+                ReGenerateListIDs();\r
+            }\r
+        }\r
+        private void MoveTrack(bool up)\r
+        {\r
+            if (lv_audioList.SelectedIndices.Count == 0) return;\r
+\r
+            ListViewItem item = lv_audioList.SelectedItems[0];\r
+            int index = item.Index;\r
+\r
+            if (up) index--; else index++;\r
+\r
+            if (index < lv_audioList.Items.Count || (lv_audioList.Items.Count > index && index >= 0))\r
             {\r
-                if (item.SubItems[2].Text.Contains("AC3"))\r
-                    return true;\r
+                lv_audioList.Items.Remove(item);\r
+                lv_audioList.Items.Insert(index, item);\r
+                item.Selected = true;\r
+                lv_audioList.Focus();\r
             }\r
-            return false;\r
         }\r
 \r
-        // Helper Functions \r
-        private void reGenerateListIDs()\r
+        private void ReGenerateListIDs()\r
         {\r
             int i = 1;\r
             foreach (ListViewItem item in lv_audioList.Items)\r
@@ -373,8 +313,38 @@ namespace Handbrake.Controls
                 i++;\r
             }\r
         }\r
-        private void setBitrate(int max)\r
+        private void SetBitrate()\r
         {\r
+            int max = 0;\r
+            drp_audioBitrate.Items.Remove("Auto");\r
+            drp_audioBitrate.Items.Remove("192");\r
+            drp_audioBitrate.Items.Remove("224");\r
+            drp_audioBitrate.Items.Remove("256");\r
+            drp_audioBitrate.Items.Remove("320");\r
+\r
+            switch (drp_audioEncoder.Text)\r
+            {\r
+                case "AAC (faac)":\r
+                    max = drp_audioMix.Text.Contains("6 Channel") ? 384 : 160;\r
+                    break;\r
+                case "MP3 (lame)":\r
+                    max = 320;\r
+                    break;\r
+                case "Vorbis (vorbis)":\r
+                    max = 384;\r
+                    break;\r
+                case "AC3 Passthru":\r
+                    drp_audioBitrate.Items.Add("Auto");\r
+                    drp_audioBitrate.SelectedItem = "Auto";\r
+                    drp_audioSample.SelectedItem = "Auto";\r
+                    break;\r
+                case "DTS Passthru":\r
+                    drp_audioBitrate.Items.Add("Auto");\r
+                    drp_audioBitrate.SelectedItem = "Auto";\r
+                    drp_audioSample.SelectedItem = "Auto";\r
+                    break;\r
+            }\r
+\r
             if (max > 160)\r
             {\r
                 drp_audioBitrate.Items.Add("192");\r
@@ -394,44 +364,46 @@ namespace Handbrake.Controls
                 drp_audioBitrate.Items.Remove("320");\r
                 drp_audioBitrate.Items.Remove("384");\r
             }\r
+\r
             if (drp_audioBitrate.SelectedItem == null)\r
                 drp_audioBitrate.SelectedIndex = drp_audioBitrate.Items.Count - 1;\r
         }\r
-        private void setMixDown(Boolean aac)\r
+        private void SetMixDown()\r
         {\r
             drp_audioMix.Items.Clear();\r
-            drp_audioMix.Items.Add("Automatic");\r
-            if (aac)\r
-                drp_audioMix.Items.Add("Mono");\r
+            drp_audioMix.Items.Add("Mono");\r
             drp_audioMix.Items.Add("Stereo");\r
             drp_audioMix.Items.Add("Dolby Surround");\r
             drp_audioMix.Items.Add("Dolby Pro Logic II");\r
-            if (aac)\r
-                drp_audioMix.Items.Add("6 Channel Discrete");\r
-        }\r
-        private void lv_audioList_SelectedIndexChanged(object sender, EventArgs e)\r
-        {\r
-            // Set the dropdown controls based on the selected item in the Audio List.\r
-            if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)\r
-            {\r
-                drp_audioTrack.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text;\r
-                drp_audioEncoder.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text;\r
-                drp_audioMix.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text;\r
-                drp_audioSample.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text;\r
-                drp_audioBitrate.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text;\r
-                double drcValue; int drcCalculated;\r
-                double.TryParse(lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text, out drcValue);\r
-                if (drcValue == 0) drcCalculated = 0;\r
-                else\r
-                    drcValue = ((drcValue * 10) + 1) - 10;\r
-                int.TryParse(drcValue.ToString(), out drcCalculated);\r
-                tb_drc.Value = drcCalculated;\r
-                lbl_drc.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text;\r
+            drp_audioMix.Items.Add("6 Channel Discrete");\r
+            drp_audioMix.Items.Add("AC3 Passthru");\r
+            drp_audioMix.Items.Add("DTS Passthru");\r
 \r
-                AudioTrackGroup.Text = "Selected Track: " + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[0].Text;\r
+            drp_audioMix.SelectedItem = "Dolby Pro Logic II";\r
+\r
+            switch (drp_audioEncoder.Text)\r
+            {\r
+                case "AAC (faac)":\r
+                    drp_audioMix.Items.Remove("AC3 Passthru");\r
+                    drp_audioMix.Items.Remove("DTS Passthru");\r
+                    break;\r
+                case "MP3 (lame)":\r
+                    drp_audioMix.Items.Remove("Mono");\r
+                    drp_audioMix.Items.Remove("6 Channel Discrete");\r
+                    drp_audioMix.Items.Remove("AC3 Passthru");\r
+                    drp_audioMix.Items.Remove("DTS Passthru");\r
+                    break;\r
+                case "Vorbis (vorbis)":\r
+                    drp_audioMix.Items.Remove("AC3 Passthru");\r
+                    drp_audioMix.Items.Remove("DTS Passthru");\r
+                    break;\r
+                case "AC3 Passthru":\r
+                    drp_audioMix.SelectedItem = "AC3 Passthru";\r
+                    break;\r
+                case "DTS Passthru":\r
+                    drp_audioMix.SelectedItem = "DTS Passthru";\r
+                    break;\r
             }\r
-            else\r
-                AudioTrackGroup.Text = "Selected Track: None (Click \"Add Track\" to add)";\r
         }\r
     }\r
 }
\ No newline at end of file
index c5c56fcaf9a942b2a1dcec8b7e7c23117235d502..757536cedcb2ed03b2a5af9719480f8de31b61bf 100644 (file)
@@ -262,6 +262,6 @@ namespace Handbrake.Controls
         public void setGrayScale(bool value)\r
         {\r
             check_grayscale.CheckState = value ? CheckState.Checked : CheckState.Unchecked;\r
-        } \r
+        }\r
     }\r
 }\r
index 9a3b4269d4a544d290499f8efd0a033bd892be34..8beca3fe190d5967fb2f7a0c49ca85cc5bfaee55 100644 (file)
@@ -182,9 +182,9 @@ namespace Handbrake.EncodeQueue
                 writer.WriteLine(log);\r
                 writer.Flush();\r
                 writer.Close();\r
-            } catch (Exception exc)\r
+            } catch (Exception)\r
             {\r
-             \r
+                return;\r
             }\r
         }\r
 \r
index 65fe8b1695980846b8ef64258a2770e2bf8fb962..33a7c1267205051994c4b17e2903a38457849fcb 100644 (file)
@@ -96,7 +96,7 @@ namespace Handbrake.Functions
             mainWindow.PictureSettings.drp_anamorphic.SelectedIndex = presetQuery.AnamorphicMode;\r
 \r
             // Keep Aspect Ration Anamorphic Setting.\r
-            mainWindow.PictureSettings.check_KeepAR.CheckState = presetQuery.keepDisplayAsect ? CheckState.Checked : CheckState.Unchecked;\r
+            mainWindow.PictureSettings.check_KeepAR.CheckState = presetQuery.KeepDisplayAsect ? CheckState.Checked : CheckState.Unchecked;\r
 \r
             // Set the Width and height as Required.\r
             if (presetQuery.Width != 0)\r
@@ -127,9 +127,9 @@ namespace Handbrake.Functions
                 mainWindow.PictureSettings.check_KeepAR.CheckState = presetQuery.Height == 0 ? CheckState.Checked : CheckState.Unchecked;\r
 \r
             // Custom Anamorphic Controls\r
-            mainWindow.PictureSettings.updownDisplayWidth.Text = presetQuery.displayWidthValue.ToString();\r
-            mainWindow.PictureSettings.updownParHeight.Text = presetQuery.pixelAspectWidth.ToString();\r
-            mainWindow.PictureSettings.updownParWidth.Text = presetQuery.pixelAspectHeight.ToString();\r
+            mainWindow.PictureSettings.updownDisplayWidth.Text = presetQuery.DisplayWidthValue.ToString();\r
+            mainWindow.PictureSettings.updownParHeight.Text = presetQuery.PixelAspectWidth.ToString();\r
+            mainWindow.PictureSettings.updownParWidth.Text = presetQuery.PixelAspectHeight.ToString();\r
             mainWindow.PictureSettings.drp_modulus.SelectedItem = presetQuery.AnamorphicModulus;\r
 \r
             #endregion\r
index 78a73b52b94acec213ef8c40440bf4851057ac2d..60afe7bca3a0a58e2baf981c44e066371bef7ac2 100644 (file)
@@ -40,10 +40,10 @@ namespace Handbrake.Functions
         public string CropLeft { get; set; }\r
         public string CropRight { get; set; }\r
         public int AnamorphicMode { get; set; }\r
-        public Boolean keepDisplayAsect { get; set; }\r
-        public double displayWidthValue { get; set; }\r
-        public int pixelAspectWidth { get; set; }\r
-        public int pixelAspectHeight { get; set; }\r
+        public Boolean KeepDisplayAsect { get; set; }\r
+        public double DisplayWidthValue { get; set; }\r
+        public int PixelAspectWidth { get; set; }\r
+        public int PixelAspectHeight { get; set; }\r
         public int AnamorphicModulus { get; set; }\r
 \r
         // Video Filters\r
@@ -234,16 +234,16 @@ namespace Handbrake.Functions
                 else\r
                     thisQuery.AnamorphicMode = 0;\r
 \r
-                thisQuery.keepDisplayAsect = keepDisplayAsect.Success;\r
+                thisQuery.KeepDisplayAsect = keepDisplayAsect.Success;\r
 \r
                 if (displayWidth.Success)\r
-                    thisQuery.displayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));\r
+                    thisQuery.DisplayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));\r
 \r
                 if (pixelAspect.Success)\r
-                    thisQuery.pixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));\r
+                    thisQuery.PixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));\r
 \r
                 if (pixelAspect.Success && pixelAspect.Groups.Count >=3)\r
-                    thisQuery.pixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", ""));\r
+                    thisQuery.PixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", ""));\r
 \r
                 if (modulus.Success)\r
                     thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", ""));\r
@@ -375,11 +375,11 @@ namespace Handbrake.Functions
 \r
                     if (trackMixes != null)\r
                         if (trackMixes.Length >= (x + 1))                        // Audio Mix\r
-                            track.MixDown = getMixDown(trackMixes[x].Trim());\r
+                            track.MixDown = GetMixDown(trackMixes[x].Trim());\r
 \r
                     if (trackEncoders != null)\r
                         if (trackEncoders.Length >= (x + 1))                     // Audio Mix\r
-                            track.Encoder = getAudioEncoder(trackEncoders[x].Trim());\r
+                            track.Encoder = GetAudioEncoder(trackEncoders[x].Trim());\r
 \r
                     if (trackBitrates != null)\r
                         if (trackBitrates.Length >= (x + 1))                     // Audio Encoder\r
@@ -431,7 +431,7 @@ namespace Handbrake.Functions
 \r
             return thisQuery;\r
         }\r
-        private static string getMixDown(string mixdown)\r
+        private static string GetMixDown(string mixdown)\r
         {\r
             switch (mixdown.Trim())\r
             {\r
@@ -449,7 +449,7 @@ namespace Handbrake.Functions
                     return "Automatic";\r
             }\r
         }\r
-        private static string getAudioEncoder(string audioEnc)\r
+        private static string GetAudioEncoder(string audioEnc)\r
         {\r
             switch (audioEnc)\r
             {\r
index 723cbb1da64a18903b90f6f02299dac2ccd87b8a..8b39662bce3f1d90f05b069fceb71b4ec464165e 100644 (file)
@@ -130,7 +130,7 @@ namespace Handbrake.Presets
                         queryParsed.Width = int.Parse(value);\r
                         break;\r
                     case "PictureKeepRatio":\r
-                        queryParsed.keepDisplayAsect = value == "1";\r
+                        queryParsed.KeepDisplayAsect = value == "1";\r
                         break;\r
                     case "PicturePAR":\r
                         queryParsed.AnamorphicMode = int.Parse(value);\r