summaryrefslogtreecommitdiffstats
path: root/win/CS/Controls
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-01-07 18:55:26 +0000
committersr55 <[email protected]>2012-01-07 18:55:26 +0000
commit2fcd31e9ef0795d6d3a0c0201ba2e7650d0c4909 (patch)
tree4b39dcee89139608bd3a01a9fffe803fd3bf5dfd /win/CS/Controls
parent10537c3510c8c492e420a2b6c7b628584aaa5d8d (diff)
WinGui: Control over automatic passthru options on the Audio Panel.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4401 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/Controls')
-rw-r--r--win/CS/Controls/AudioPanel.Designer.cs129
-rw-r--r--win/CS/Controls/AudioPanel.cs136
-rw-r--r--win/CS/Controls/AudioPanel.resx11
3 files changed, 269 insertions, 7 deletions
diff --git a/win/CS/Controls/AudioPanel.Designer.cs b/win/CS/Controls/AudioPanel.Designer.cs
index 4498f650b..69c990dee 100644
--- a/win/CS/Controls/AudioPanel.Designer.cs
+++ b/win/CS/Controls/AudioPanel.Designer.cs
@@ -59,6 +59,7 @@ namespace Handbrake.Controls
this.DRC = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Gain = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ToolTips = new System.Windows.Forms.ToolTip(this.components);
+ this.drp_passthruFallback = new System.Windows.Forms.ComboBox();
this.btn_AdvancedAudio = new System.Windows.Forms.Button();
this.btn_addAudioTrack = new wyDay.Controls.SplitButton();
this.AddTrackMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
@@ -66,10 +67,18 @@ namespace Handbrake.Controls
this.btn_RemoveTrack = new wyDay.Controls.SplitButton();
this.RemoveTrackMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnu_ClearAll = new System.Windows.Forms.ToolStripMenuItem();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.check_dtshd = new System.Windows.Forms.CheckBox();
+ this.check_dts = new System.Windows.Forms.CheckBox();
+ this.check_ac3 = new System.Windows.Forms.CheckBox();
+ this.check_aac = new System.Windows.Forms.CheckBox();
+ this.check_mp3 = new System.Windows.Forms.CheckBox();
this.audioMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.audioList)).BeginInit();
this.AddTrackMenu.SuspendLayout();
this.RemoveTrackMenu.SuspendLayout();
+ this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// audioMenu
@@ -337,6 +346,22 @@ namespace Handbrake.Controls
this.Gain.ReadOnly = true;
this.Gain.Width = 60;
//
+ // ToolTips
+ //
+ this.ToolTips.AutomaticDelay = 1500;
+ //
+ // drp_passthruFallback
+ //
+ this.drp_passthruFallback.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.drp_passthruFallback.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.drp_passthruFallback.FormattingEnabled = true;
+ this.drp_passthruFallback.Location = new System.Drawing.Point(327, 15);
+ this.drp_passthruFallback.Name = "drp_passthruFallback";
+ this.drp_passthruFallback.Size = new System.Drawing.Size(111, 19);
+ this.drp_passthruFallback.TabIndex = 75;
+ this.ToolTips.SetToolTip(this.drp_passthruFallback, "The Audio Encoder that will be used, if there is no suitable passthru option.");
+ this.drp_passthruFallback.SelectedIndexChanged += new System.EventHandler(this.drp_passthruFallback_SelectedIndexChanged);
+ //
// btn_AdvancedAudio
//
this.btn_AdvancedAudio.BackColor = System.Drawing.Color.Transparent;
@@ -409,10 +434,104 @@ namespace Handbrake.Controls
this.mnu_ClearAll.Text = "Clear All";
this.mnu_ClearAll.Click += new System.EventHandler(this.Mnu_clear_all_click);
//
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.drp_passthruFallback);
+ this.groupBox1.Controls.Add(this.check_dtshd);
+ this.groupBox1.Controls.Add(this.check_dts);
+ this.groupBox1.Controls.Add(this.check_ac3);
+ this.groupBox1.Controls.Add(this.check_aac);
+ this.groupBox1.Controls.Add(this.check_mp3);
+ this.groupBox1.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.groupBox1.Location = new System.Drawing.Point(256, 19);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(445, 40);
+ this.groupBox1.TabIndex = 74;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Auto Passthru";
+ this.ToolTips.SetToolTip(this.groupBox1, resources.GetString("groupBox1.ToolTip"));
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label1.Location = new System.Drawing.Point(279, 18);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(42, 11);
+ this.label1.TabIndex = 76;
+ this.label1.Text = "Fallback:";
+ //
+ // check_dtshd
+ //
+ this.check_dtshd.AutoSize = true;
+ this.check_dtshd.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_dtshd.Location = new System.Drawing.Point(214, 17);
+ this.check_dtshd.Name = "check_dtshd";
+ this.check_dtshd.Size = new System.Drawing.Size(60, 15);
+ this.check_dtshd.TabIndex = 4;
+ this.check_dtshd.Text = "DTS-HD";
+ this.ToolTips.SetToolTip(this.check_dtshd, "Allow DTS-HD Passthru");
+ this.check_dtshd.UseVisualStyleBackColor = true;
+ this.check_dtshd.CheckedChanged += new System.EventHandler(this.autoPassthru_CheckedChanged);
+ //
+ // check_dts
+ //
+ this.check_dts.AutoSize = true;
+ this.check_dts.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_dts.Location = new System.Drawing.Point(163, 17);
+ this.check_dts.Name = "check_dts";
+ this.check_dts.Size = new System.Drawing.Size(43, 15);
+ this.check_dts.TabIndex = 3;
+ this.check_dts.Text = "DTS";
+ this.ToolTips.SetToolTip(this.check_dts, "Allow DTS Passthru");
+ this.check_dts.UseVisualStyleBackColor = true;
+ this.check_dts.CheckedChanged += new System.EventHandler(this.autoPassthru_CheckedChanged);
+ //
+ // check_ac3
+ //
+ this.check_ac3.AutoSize = true;
+ this.check_ac3.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_ac3.Location = new System.Drawing.Point(111, 17);
+ this.check_ac3.Name = "check_ac3";
+ this.check_ac3.Size = new System.Drawing.Size(43, 15);
+ this.check_ac3.TabIndex = 2;
+ this.check_ac3.Text = "AC3";
+ this.ToolTips.SetToolTip(this.check_ac3, "Allow AC3 Passthru");
+ this.check_ac3.UseVisualStyleBackColor = true;
+ this.check_ac3.CheckedChanged += new System.EventHandler(this.autoPassthru_CheckedChanged);
+ //
+ // check_aac
+ //
+ this.check_aac.AutoSize = true;
+ this.check_aac.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_aac.Location = new System.Drawing.Point(58, 17);
+ this.check_aac.Name = "check_aac";
+ this.check_aac.Size = new System.Drawing.Size(45, 15);
+ this.check_aac.TabIndex = 1;
+ this.check_aac.Text = "AAC";
+ this.ToolTips.SetToolTip(this.check_aac, "Allow AAC Passthru");
+ this.check_aac.UseVisualStyleBackColor = true;
+ this.check_aac.CheckedChanged += new System.EventHandler(this.autoPassthru_CheckedChanged);
+ //
+ // check_mp3
+ //
+ this.check_mp3.AutoSize = true;
+ this.check_mp3.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_mp3.Location = new System.Drawing.Point(6, 17);
+ this.check_mp3.Name = "check_mp3";
+ this.check_mp3.Size = new System.Drawing.Size(43, 15);
+ this.check_mp3.TabIndex = 0;
+ this.check_mp3.Text = "MP3";
+ this.ToolTips.SetToolTip(this.check_mp3, "Allow MP3 Passthru");
+ this.check_mp3.UseVisualStyleBackColor = true;
+ this.check_mp3.CheckedChanged += new System.EventHandler(this.autoPassthru_CheckedChanged);
+ //
// AudioPanel
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.BackColor = System.Drawing.Color.Transparent;
+ this.Controls.Add(this.groupBox1);
this.Controls.Add(this.drp_audioTrack);
this.Controls.Add(this.btn_AdvancedAudio);
this.Controls.Add(this.drp_audioSample);
@@ -430,6 +549,8 @@ namespace Handbrake.Controls
((System.ComponentModel.ISupportInitialize)(this.audioList)).EndInit();
this.AddTrackMenu.ResumeLayout(false);
this.RemoveTrackMenu.ResumeLayout(false);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -467,5 +588,13 @@ namespace Handbrake.Controls
private System.Windows.Forms.DataGridViewTextBoxColumn Bitrate;
private System.Windows.Forms.DataGridViewTextBoxColumn DRC;
private System.Windows.Forms.DataGridViewTextBoxColumn Gain;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.CheckBox check_dtshd;
+ private System.Windows.Forms.CheckBox check_dts;
+ private System.Windows.Forms.CheckBox check_ac3;
+ private System.Windows.Forms.CheckBox check_aac;
+ private System.Windows.Forms.CheckBox check_mp3;
+ private System.Windows.Forms.Label label1;
+ internal System.Windows.Forms.ComboBox drp_passthruFallback;
}
}
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs
index 61b908299..69d4fb065 100644
--- a/win/CS/Controls/AudioPanel.cs
+++ b/win/CS/Controls/AudioPanel.cs
@@ -78,6 +78,10 @@ namespace Handbrake.Controls
drp_audioEncoder.SelectedItem = "AAC (faac)";
drp_audioTrack.DataSource = this.ScannedTracks;
+
+ // Setup Auto-Passthru Settings
+ this.PassthruSettings = new AllowedPassthru();
+ this.SetPassthruSettings(this.PassthruSettings);
}
/// <summary>
@@ -105,6 +109,11 @@ namespace Handbrake.Controls
}
}
+ /// <summary>
+ /// Gets or sets PassthruSettings.
+ /// </summary>
+ public AllowedPassthru PassthruSettings { get; set; }
+
#endregion
#region Public Methods
@@ -118,6 +127,7 @@ namespace Handbrake.Controls
public void SetContainer(string path)
{
string oldval = drp_audioEncoder.Text;
+ string fallbackOldVal = drp_passthruFallback.Text;
drp_audioEncoder.Items.Clear();
drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.Faac));
@@ -130,16 +140,31 @@ namespace Handbrake.Controls
drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.DtsPassthrough));
drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.DtsHDPassthrough));
+ drp_passthruFallback.Items.Clear();
+ drp_passthruFallback.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.Faac));
+ drp_passthruFallback.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.ffaac));
+ drp_passthruFallback.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.Lame));
+ drp_passthruFallback.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.Ac3));
+
if (path.Contains("MKV"))
{
drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.Vorbis));
drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.ffflac));
+
+ drp_passthruFallback.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.Vorbis));
+ drp_passthruFallback.Items.Add(EnumHelper<AudioEncoder>.GetDisplay(AudioEncoder.ffflac));
}
+
if (!drp_audioEncoder.Items.Contains(oldval))
drp_audioEncoder.SelectedIndex = 0;
else
drp_audioEncoder.SelectedItem = oldval;
+
+ if (!drp_passthruFallback.Items.Contains(fallbackOldVal))
+ drp_passthruFallback.SelectedIndex = 3;
+ else
+ drp_passthruFallback.SelectedItem = fallbackOldVal;
}
/// <summary>
@@ -154,11 +179,17 @@ namespace Handbrake.Controls
/// <summary>
/// Load an arraylist of AudioTrack items into the list.
/// </summary>
- /// <param name="tracks">List of audio tracks</param>
- public void LoadTracks(ObservableCollection<AudioTrack> tracks)
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ public void LoadTracks(Preset preset)
{
ClearAudioList();
+ ObservableCollection<AudioTrack> tracks = preset.Task.AudioTracks;
+ this.PassthruSettings = preset.AudioPassthruSettings ?? new AllowedPassthru(false);
+ this.SetPassthruSettings(this.PassthruSettings);
+
if (tracks == null || (drp_audioTrack.SelectedItem != null && drp_audioTrack.SelectedItem.ToString() == AudioHelper.NoneFound.Description))
return;
@@ -195,6 +226,10 @@ namespace Handbrake.Controls
this.AudioTracks.Clear();
this.ScannedTracks.Clear();
+ // Setup the passthru options
+ this.PassthruSettings = preset.AudioPassthruSettings ?? new AllowedPassthru(false);
+ this.SetPassthruSettings(this.PassthruSettings);
+
if (selectedTitle.AudioTracks.Count == 0)
{
this.ScannedTracks.Add(AudioHelper.NoneFound);
@@ -1043,31 +1078,66 @@ namespace Handbrake.Controls
/// </returns>
private AudioEncoder GetCompatiblePassthru(AudioTrack track)
{
- if (track.ScannedTrack.Format.Contains("AC3"))
+ if (track.ScannedTrack.Format.Contains("AC3") && this.check_ac3.Checked)
{
return AudioEncoder.Ac3Passthrough;
}
- if (track.ScannedTrack.Format.Contains("DTS"))
+ if (track.ScannedTrack.Format.Contains("DTS") && this.check_dts.Checked)
+ {
+ return AudioEncoder.DtsPassthrough;
+ }
+
+ if (track.ScannedTrack.Format.Contains("DTS-HD") && this.check_dtshd.Checked)
{
return AudioEncoder.DtsPassthrough;
}
- if (track.ScannedTrack.Format.Contains("aac"))
+ if (track.ScannedTrack.Format.Contains("aac") && this.check_aac.Checked)
{
return AudioEncoder.AacPassthru;
}
- if (track.ScannedTrack.Format.Contains("mp3"))
+ if (track.ScannedTrack.Format.Contains("mp3") && this.check_mp3.Checked)
{
return AudioEncoder.Mp3Passthru;
}
- return AudioEncoder.Faac;
+ return EnumHelper<AudioEncoder>.GetValue(drp_passthruFallback.SelectedItem.ToString());
+ }
+
+ /// <summary>
+ /// Setup the Passthru Settings Panel
+ /// </summary>
+ /// <param name="settings">
+ /// The settings.
+ /// </param>
+ private void SetPassthruSettings(AllowedPassthru settings)
+ {
+ if (settings == null)
+ {
+ settings = this.PassthruSettings;
+ }
+
+ this.check_aac.Checked = settings.AudioAllowAACPass;
+ this.check_mp3.Checked = settings.AudioAllowMP3Pass;
+ this.check_ac3.Checked = settings.AudioAllowAC3Pass;
+ this.check_dts.Checked = settings.AudioAllowDTSPass;
+ this.check_dtshd.Checked = settings.AudioAllowDTSHDPass;
+ this.drp_passthruFallback.SelectedItem = EnumHelper<AudioEncoder>.GetDisplay(settings.AudioEncoderFallback);
}
#endregion
+ /// <summary>
+ /// Open the Advanced Audio Settings UI
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
private void btn_AdvancedAudio_Click(object sender, EventArgs e)
{
if (audioList.SelectedRows.Count == 0)
@@ -1084,5 +1154,57 @@ namespace Handbrake.Controls
advancedAudio.Show();
}
+
+ /// <summary>
+ /// Handle changes in the Checked Passthru Options
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EventArgs.
+ /// </param>
+ private void autoPassthru_CheckedChanged(object sender, EventArgs e)
+ {
+ if (sender == this.check_mp3)
+ {
+ this.PassthruSettings.AudioAllowMP3Pass = this.check_mp3.Checked;
+ }
+
+ if (sender == this.check_aac)
+ {
+ this.PassthruSettings.AudioAllowAACPass = this.check_aac.Checked;
+ }
+
+ if (sender == this.check_ac3)
+ {
+ this.PassthruSettings.AudioAllowAC3Pass = this.check_ac3.Checked;
+ }
+
+ if (sender == this.check_dts)
+ {
+ this.PassthruSettings.AudioAllowDTSPass = this.check_dts.Checked;
+ }
+
+ if (sender == this.check_dtshd)
+ {
+ this.PassthruSettings.AudioAllowDTSHDPass = this.check_dtshd.Checked;
+ }
+ }
+
+ /// <summary>
+ /// Set the fallback encoder
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void drp_passthruFallback_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ this.PassthruSettings.AudioEncoderFallback =
+ EnumHelper<AudioEncoder>.GetValue(drp_passthruFallback.SelectedItem.ToString());
+ }
}
} \ No newline at end of file
diff --git a/win/CS/Controls/AudioPanel.resx b/win/CS/Controls/AudioPanel.resx
index 25b4515c9..2bb8ba780 100644
--- a/win/CS/Controls/AudioPanel.resx
+++ b/win/CS/Controls/AudioPanel.resx
@@ -161,4 +161,15 @@ and alter its settings after adding them.</value>
<metadata name="RemoveTrackMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>561, 16</value>
</metadata>
+ <data name="groupBox1.ToolTip" xml:space="preserve">
+ <value>Controls the behaviour of the Audio Codec dropdown when passthru options are selected.
+
+When an incorrect passthru option is selected, it will try to fall back to the correct one if the
+format checkbox in the "Auto Passthru" section is checked.
+
+If there is no suitable passthru option, it will use the "Fallkback" encoder.
+
+These settings are global to all Audio Tracks.
+These settings are stored in the presets.</value>
+ </data>
</root> \ No newline at end of file