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