summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--win/CS/Functions/PresetLoader.cs24
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs74
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Preset.cs7
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs14
-rw-r--r--win/CS/frmAddPreset.cs3
-rw-r--r--win/CS/frmMain.cs13
10 files changed, 385 insertions, 27 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
diff --git a/win/CS/Functions/PresetLoader.cs b/win/CS/Functions/PresetLoader.cs
index de4058210..5da368ac1 100644
--- a/win/CS/Functions/PresetLoader.cs
+++ b/win/CS/Functions/PresetLoader.cs
@@ -37,10 +37,10 @@ namespace Handbrake.Functions
/// The encode task.
/// </param>
public static void LoadPreset(frmMain mainWindow, EncodeTask encodeTask)
- {
- Preset preset = new Preset { Name = "Unknown", Task = encodeTask };
- LoadPreset(mainWindow, preset);
- }
+ {
+ Preset preset = new Preset { Name = "Unknown", Task = encodeTask };
+ LoadPreset(mainWindow, preset);
+ }
/// <summary>
/// This function takes in a Query which has been parsed by QueryParser and
@@ -52,10 +52,14 @@ namespace Handbrake.Functions
/// <param name="preset">
/// The preset.
/// </param>
- public static void LoadPreset(frmMain mainWindow, Preset preset)
+ public static void LoadPreset(frmMain mainWindow, Preset preset)
{
// Send the query from the file to the Query Parser class
EncodeTask presetQuery = preset.Task ?? QueryParserUtility.Parse(preset.Query);
+ if (preset.Task == null)
+ {
+ preset.Task = presetQuery;
+ }
#region Source
@@ -165,9 +169,9 @@ namespace Handbrake.Functions
mainWindow.PictureSettings.text_height.Value = presetQuery.MaxHeight.Value;
}
- mainWindow.PictureSettings.PresetMaximumResolution = new Size(
- presetQuery.MaxWidth.HasValue ? presetQuery.MaxWidth.Value : 0,
- presetQuery.MaxHeight.HasValue ? presetQuery.MaxHeight.Value : 0);
+ mainWindow.PictureSettings.PresetMaximumResolution = new Size(
+ presetQuery.MaxWidth.HasValue ? presetQuery.MaxWidth.Value : 0,
+ presetQuery.MaxHeight.HasValue ? presetQuery.MaxHeight.Value : 0);
// Case where both height and max height are 0 - For built-in presets
if (presetQuery.MaxHeight == 0 && presetQuery.Height == 0)
@@ -242,7 +246,7 @@ namespace Handbrake.Functions
mainWindow.text_bitrate.Text = presetQuery.VideoBitrate.ToString();
mainWindow.check_2PassEncode.CheckState = presetQuery.TwoPass ? CheckState.Checked : CheckState.Unchecked;
mainWindow.check_turbo.CheckState = presetQuery.TurboFirstPass ? CheckState.Checked : CheckState.Unchecked;
- }
+ }
if (presetQuery.Framerate != null)
{
@@ -289,7 +293,7 @@ namespace Handbrake.Functions
#region Audio
- mainWindow.AudioSettings.LoadTracks(presetQuery.AudioTracks);
+ mainWindow.AudioSettings.LoadTracks(preset);
#endregion
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index a4b34ba80..2cb6ab738 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -102,6 +102,7 @@
<Compile Include="Functions\Win32.cs" />
<Compile Include="Functions\Win7.cs" />
<Compile Include="Model\DriveInformation.cs" />
+ <Compile Include="Model\Encoding\AllowedPassthru.cs" />
<Compile Include="Model\Encoding\AudioTrack.cs" />
<Compile Include="Model\Encoding\ChapterMarker.cs" />
<Compile Include="Model\Encoding\FramerateMode.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs
new file mode 100644
index 000000000..748cfbdc4
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs
@@ -0,0 +1,74 @@
+/* AllowedPassthru.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
+{
+ using Interop.Model.Encoding;
+
+ /// <summary>
+ /// Allowed Passthru Options
+ /// </summary>
+ public class AllowedPassthru
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AllowedPassthru"/> class.
+ /// </summary>
+ public AllowedPassthru()
+ {
+ this.AudioAllowAACPass = true;
+ this.AudioAllowAC3Pass = true;
+ this.AudioAllowDTSHDPass = true;
+ this.AudioAllowDTSPass = true;
+ this.AudioAllowMP3Pass = true;
+ this.AudioEncoderFallback = AudioEncoder.Ac3;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AllowedPassthru"/> class.
+ /// </summary>
+ /// <param name="initialValue">
+ /// The initial Value.
+ /// </param>
+ public AllowedPassthru(bool initialValue)
+ {
+ this.AudioAllowAACPass = initialValue;
+ this.AudioAllowAC3Pass = initialValue;
+ this.AudioAllowDTSHDPass = initialValue;
+ this.AudioAllowDTSPass = initialValue;
+ this.AudioAllowMP3Pass = initialValue;
+ this.AudioEncoderFallback = AudioEncoder.Ac3;
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AudioAllowAACPass.
+ /// </summary>
+ public bool AudioAllowAACPass { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AudioAllowAC3Pass.
+ /// </summary>
+ public bool AudioAllowAC3Pass { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AudioAllowDTSHDPass.
+ /// </summary>
+ public bool AudioAllowDTSHDPass { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AudioAllowDTSPass.
+ /// </summary>
+ public bool AudioAllowDTSPass { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AudioAllowMP3Pass.
+ /// </summary>
+ public bool AudioAllowMP3Pass { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioEncoderFallback.
+ /// </summary>
+ public AudioEncoder AudioEncoderFallback { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs
index a3bd673f3..2ec668b56 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs
@@ -5,6 +5,8 @@
namespace HandBrake.ApplicationServices.Model
{
+ using Encoding;
+
/// <summary>
/// A Preset for encoding with.
/// </summary>
@@ -61,6 +63,11 @@ namespace HandBrake.ApplicationServices.Model
public EncodeTask Task { get; set; }
/// <summary>
+ /// Gets or sets AudioPassthruSettings.
+ /// </summary>
+ public AllowedPassthru AudioPassthruSettings { get; set; }
+
+ /// <summary>
/// Override the ToString Method
/// </summary>
/// <returns>
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index 30487f15c..5672838e8 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -3,6 +3,9 @@
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
+using HandBrake.ApplicationServices.Model.Encoding;
+using HandBrake.ApplicationServices.Utilities;
+
namespace HandBrake.ApplicationServices.Services
{
using System;
@@ -290,11 +293,7 @@ namespace HandBrake.ApplicationServices.Services
Regex r = new Regex("(: )"); // Split on hyphens.
string[] presetName = r.Split(line);
- bool pic = false;
- if (presetName[2].Contains("crop"))
- {
- pic = true;
- }
+ bool pic = presetName[2].Contains("crop");
Preset newPreset = new Preset
{
@@ -304,9 +303,12 @@ namespace HandBrake.ApplicationServices.Services
Version = this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
CropSettings = pic,
Description = string.Empty, // Maybe one day we will populate this.
- IsBuildIn = true
+ IsBuildIn = true,
+ Task = QueryParserUtility.Parse(presetName[2])
};
+ newPreset.AudioPassthruSettings = new AllowedPassthru(false); // We don't want to override the built-in preset
+
if (newPreset.Name == "Normal")
{
newPreset.IsDefault = true;
diff --git a/win/CS/frmAddPreset.cs b/win/CS/frmAddPreset.cs
index 67bfcaf5f..da3b1baf4 100644
--- a/win/CS/frmAddPreset.cs
+++ b/win/CS/frmAddPreset.cs
@@ -87,7 +87,8 @@ namespace Handbrake
Name = this.txt_preset_name.Text,
Query = query,
CropSettings = pictureSettingsMode != QueryPictureSettingsMode.None,
- Description = string.Empty
+ Description = string.Empty,
+ AudioPassthruSettings = mainWindow.AudioSettings.PassthruSettings
};
if (presetCode.Add(preset))
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs
index a8780aa85..a3e867997 100644
--- a/win/CS/frmMain.cs
+++ b/win/CS/frmMain.cs
@@ -3,6 +3,8 @@
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
+using HandBrake.ApplicationServices.Model.Encoding;
+
namespace Handbrake
{
using System;
@@ -861,7 +863,9 @@ namespace Handbrake
{
Name = parsed.PresetName,
Query = QueryGenerator.GenerateFullQuery(this).Query,
- CropSettings = parsed.UsesPictureSettings
+ CropSettings = parsed.UsesPictureSettings,
+ Task = parsed,
+ AudioPassthruSettings = new AllowedPassthru(false), // TODO at a future point, support this.
};
presetHandler.Update(preset);
@@ -870,11 +874,13 @@ namespace Handbrake
else
{
- Preset preset = new Preset
+ Preset preset = new Preset
{
Name = parsed.PresetName,
Query = QueryGenerator.GenerateFullQuery(this).Query,
CropSettings = parsed.UsesPictureSettings,
+ Task = parsed,
+ AudioPassthruSettings = new AllowedPassthru(false), // TODO at a future point, support this.
};
if (presetHandler.Add(preset))
@@ -2220,7 +2226,8 @@ namespace Handbrake
// Now load the preset
PresetLoader.LoadPreset(this, preset);
- this.AudioSettings.LoadTracks(queueEdit.Task.AudioTracks);
+ preset.Task = queueEdit.Task;
+ this.AudioSettings.LoadTracks(preset);
// Set the destination path);
this.text_destination.Text = queueEdit.Destination;