summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/Controls/AudioPanel.Designer.cs33
-rw-r--r--win/CS/Controls/AudioPanel.cs271
-rw-r--r--win/CS/Controls/AudioPanel.resx3
-rw-r--r--win/CS/Functions/QueryGenerator.cs174
-rw-r--r--win/CS/HandBrake.ApplicationServices/Converters/EnumToDescConverter.cs24
-rw-r--r--win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs26
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs3
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs52
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs11
-rw-r--r--win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs3
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs9
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs2
-rw-r--r--win/CS/frmQueue.cs4
15 files changed, 309 insertions, 315 deletions
diff --git a/win/CS/Controls/AudioPanel.Designer.cs b/win/CS/Controls/AudioPanel.Designer.cs
index 43e5ba8ec..1ef05e377 100644
--- a/win/CS/Controls/AudioPanel.Designer.cs
+++ b/win/CS/Controls/AudioPanel.Designer.cs
@@ -59,7 +59,6 @@ namespace Handbrake.Controls
this.AudioTrackGroup = new System.Windows.Forms.GroupBox();
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);
this.audioList = new System.Windows.Forms.DataGridView();
- this.Track = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Source = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.AudioCodec = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Mixdown = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -87,7 +86,7 @@ namespace Handbrake.Controls
this.audioList_moveup.Name = "audioList_moveup";
this.audioList_moveup.Size = new System.Drawing.Size(138, 22);
this.audioList_moveup.Text = "Move Up";
- this.audioList_moveup.Click += new System.EventHandler(this.audioList_moveup_Click);
+ this.audioList_moveup.Click += new System.EventHandler(this.AudioList_moveup_Click);
//
// audioList_movedown
//
@@ -95,7 +94,7 @@ namespace Handbrake.Controls
this.audioList_movedown.Size = new System.Drawing.Size(138, 22);
this.audioList_movedown.Text = "Move Down";
this.audioList_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.audioList_movedown.Click += new System.EventHandler(this.audioList_movedown_Click);
+ this.audioList_movedown.Click += new System.EventHandler(this.AudioList_movedown_Click);
//
// toolStripSeparator2
//
@@ -107,7 +106,7 @@ namespace Handbrake.Controls
this.audioList_remove.Name = "audioList_remove";
this.audioList_remove.Size = new System.Drawing.Size(138, 22);
this.audioList_remove.Text = "Remove";
- this.audioList_remove.Click += new System.EventHandler(this.audioList_remove_Click);
+ this.audioList_remove.Click += new System.EventHandler(this.AudioList_remove_Click);
//
// btn_RemoveAudioTrack
//
@@ -120,7 +119,7 @@ namespace Handbrake.Controls
this.btn_RemoveAudioTrack.TabIndex = 64;
this.btn_RemoveAudioTrack.Text = "Remove";
this.btn_RemoveAudioTrack.UseVisualStyleBackColor = false;
- this.btn_RemoveAudioTrack.Click += new System.EventHandler(this.btn_RemoveAudioTrack_Click);
+ this.btn_RemoveAudioTrack.Click += new System.EventHandler(this.RemoveAudioTrack_Click);
//
// btn_addAudioTrack
//
@@ -133,7 +132,7 @@ namespace Handbrake.Controls
this.btn_addAudioTrack.TabIndex = 63;
this.btn_addAudioTrack.Text = "Add Track";
this.btn_addAudioTrack.UseVisualStyleBackColor = false;
- this.btn_addAudioTrack.Click += new System.EventHandler(this.btn_addAudioTrack_Click);
+ this.btn_addAudioTrack.Click += new System.EventHandler(this.AddAudioTrack_Click);
//
// lbl_drc
//
@@ -351,7 +350,6 @@ namespace Handbrake.Controls
this.audioList.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
this.audioList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.audioList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Track,
this.Source,
this.AudioCodec,
this.Mixdown,
@@ -374,32 +372,28 @@ namespace Handbrake.Controls
this.audioList.TabIndex = 67;
this.audioList.SelectionChanged += new System.EventHandler(this.audioList_SelectionChanged);
//
- // Track
- //
- this.Track.FillWeight = 304.2808F;
- this.Track.HeaderText = "Track";
- this.Track.Name = "Track";
- this.Track.ReadOnly = true;
- this.Track.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.Track.Width = 50;
- //
// Source
//
+ this.Source.DataPropertyName = "SourceTrack";
this.Source.FillWeight = 49.69727F;
this.Source.HeaderText = "Source";
this.Source.Name = "Source";
+ this.Source.ReadOnly = true;
this.Source.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.Source.Width = 150;
+ this.Source.Width = 170;
//
// AudioCodec
//
+ this.AudioCodec.DataPropertyName = "Encoder";
this.AudioCodec.HeaderText = "Audio Codec";
this.AudioCodec.Name = "AudioCodec";
this.AudioCodec.ReadOnly = true;
this.AudioCodec.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.AudioCodec.Width = 120;
//
// Mixdown
//
+ this.Mixdown.DataPropertyName = "Mixdown";
this.Mixdown.FillWeight = 49.69727F;
this.Mixdown.HeaderText = "Mixdown";
this.Mixdown.Name = "Mixdown";
@@ -409,6 +403,7 @@ namespace Handbrake.Controls
//
// Samplerate
//
+ this.Samplerate.DataPropertyName = "SampleRateDisplayValue";
this.Samplerate.FillWeight = 49.69727F;
this.Samplerate.HeaderText = "Samplerate";
this.Samplerate.Name = "Samplerate";
@@ -418,6 +413,7 @@ namespace Handbrake.Controls
//
// Bitrate
//
+ this.Bitrate.DataPropertyName = "BitRateDisplayValue";
this.Bitrate.FillWeight = 49.69727F;
this.Bitrate.HeaderText = "Bitrate";
this.Bitrate.Name = "Bitrate";
@@ -428,10 +424,12 @@ namespace Handbrake.Controls
// DRC
//
this.DRC.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.DRC.DataPropertyName = "DRC";
this.DRC.FillWeight = 96.36334F;
this.DRC.HeaderText = "DRC";
this.DRC.Name = "DRC";
this.DRC.ReadOnly = true;
+ this.DRC.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.DRC.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// AudioPanel
@@ -482,7 +480,6 @@ namespace Handbrake.Controls
private System.Windows.Forms.ToolStripMenuItem audioList_remove;
internal System.Windows.Forms.ComboBox drp_audioBitrate;
private System.Windows.Forms.DataGridView audioList;
- private System.Windows.Forms.DataGridViewTextBoxColumn Track;
private System.Windows.Forms.DataGridViewTextBoxColumn Source;
private System.Windows.Forms.DataGridViewTextBoxColumn AudioCodec;
private System.Windows.Forms.DataGridViewTextBoxColumn Mixdown;
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs
index 54e07af44..6ff6824c0 100644
--- a/win/CS/Controls/AudioPanel.cs
+++ b/win/CS/Controls/AudioPanel.cs
@@ -7,6 +7,7 @@ namespace Handbrake.Controls
{
using System;
using System.Collections.Generic;
+ using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
@@ -24,17 +25,29 @@ namespace Handbrake.Controls
/// </summary>
public partial class AudioPanel : UserControl
{
+ /**
+ * TODO - There is a lot of old code in here that access the datagrid that can be refactored to work with
+ * the new AudioTrack BindingList.
+ */
+
private static readonly CultureInfo Culture = new CultureInfo("en-US", false);
private const string AC3Passthru = "AC3 Passthru";
private const string DTSPassthru = "DTS Passthru";
+ private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();
+
+ #region Constructor and Events
+
/// <summary>
/// Initializes a new instance of the <see cref="AudioPanel"/> class.
- /// Create a new instance of the Audio Panel
/// </summary>
public AudioPanel()
{
InitializeComponent();
+
+ this.audioList.AutoGenerateColumns = false;
+ this.audioList.DataSource = audioTracks;
+
drp_audioMix.SelectedItem = "Dolby Pro Logic II";
drp_audioSample.SelectedIndex = 1;
}
@@ -44,16 +57,25 @@ namespace Handbrake.Controls
/// </summary>
public event EventHandler AudioListChanged;
- #region Public Methods
+ #endregion
+
+ #region Properties
+
/// <summary>
- /// Get the audio panel
+ /// Gets the AudioTracks Collection
/// </summary>
- /// <returns>A listview containing the audio tracks</returns>
- public DataGridView GetAudioPanel()
+ public IEnumerable<AudioTrack> AudioTracks
{
- return audioList;
+ get
+ {
+ return this.audioTracks;
+ }
}
+ #endregion
+
+ #region Public Methods
+
/// <summary>
/// Set the File Container. This funciton is used to limit the available options for each file container.
/// </summary>
@@ -65,29 +87,21 @@ namespace Handbrake.Controls
string oldval = drp_audioEncoder.Text;
drp_audioEncoder.Items.Clear();
- drp_audioEncoder.Items.Add("AAC (faac)");
- drp_audioEncoder.Items.Add("MP3 (lame)");
- drp_audioEncoder.Items.Add(AC3Passthru);
- drp_audioEncoder.Items.Add("AC3 (ffmpeg)");
+ drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDescription(AudioEncoder.Faac));
+ drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDescription(AudioEncoder.Lame));
+ drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDescription(AudioEncoder.Ac3Passthrough));
+ drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDescription(AudioEncoder.Ac3));
if (path.Contains("MKV"))
{
- drp_audioEncoder.Items.Add(DTSPassthru);
- drp_audioEncoder.Items.Add("Vorbis (vorbis)");
+ drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDescription(AudioEncoder.DtsPassthrough));
+ drp_audioEncoder.Items.Add(EnumHelper<AudioEncoder>.GetDescription(AudioEncoder.Vorbis));
}
if (!drp_audioEncoder.Text.Contains(oldval))
drp_audioEncoder.SelectedIndex = 0;
else
drp_audioEncoder.SelectedItem = oldval;
-
- // Make sure the table is updated with new audio codecs
- // Defaults to AAC encoding.
- foreach (DataGridViewRow row in audioList.Rows)
- {
- if (!drp_audioEncoder.Items.Contains(row.Cells[2].Value))
- row.Cells[2].Value = drp_audioEncoder.Items[0].ToString();
- }
}
/// <summary>
@@ -96,7 +110,7 @@ namespace Handbrake.Controls
/// <returns>True if m4v is required</returns>
public bool RequiresM4V()
{
- return this.audioList.Rows.Cast<DataGridViewRow>().Any(row => row.Cells[2].Value.ToString().Contains("AC3"));
+ return true;
}
/// <summary>
@@ -112,19 +126,13 @@ namespace Handbrake.Controls
foreach (AudioTrack track in audioTracks)
{
- DataGridViewRow newTrack = new DataGridViewRow();
- newTrack.CreateCells(audioList);
- newTrack.Cells[0].Value = GetNewID().ToString();
- newTrack.Cells[1].Value = "Automatic";
- newTrack.Cells[2].Value = EnumHelper.GetDescription(track.Encoder);
- newTrack.Cells[3].Value = EnumHelper.GetDescription(track.MixDown);
- newTrack.Cells[4].Value = (track.Encoder == AudioEncoder.Ac3Passthrough || track.Encoder == AudioEncoder.DtsPassthrough || track.SampleRate == 0.0) ? "Auto" : track.SampleRate.ToString();
- newTrack.Cells[5].Value = (track.Encoder == AudioEncoder.Ac3Passthrough || track.Encoder == AudioEncoder.DtsPassthrough) ? "Auto" : track.Bitrate.ToString();
- newTrack.Cells[6].Value = (track.Encoder == AudioEncoder.Ac3Passthrough || track.Encoder == AudioEncoder.DtsPassthrough) ? string.Empty : track.DRC.ToString();
- AddTrackForPreset(newTrack);
+ this.audioTracks.Add(track);
}
this.AutomaticTrackSelection();
+
+ if (this.AudioListChanged != null)
+ this.AudioListChanged(this, new EventArgs());
}
/// <summary>
@@ -153,16 +161,7 @@ namespace Handbrake.Controls
EncodeTask parsed = QueryParserUtility.Parse(preset.Query);
foreach (AudioTrack audioTrack in parsed.AudioTracks)
{
- DataGridViewRow newTrack = new DataGridViewRow();
- newTrack.CreateCells(audioList);
- newTrack.Cells[0].Value = GetNewID().ToString();
- newTrack.Cells[1].Value = (audioTrack.Track);
- newTrack.Cells[2].Value = (audioTrack.Encoder);
- newTrack.Cells[3].Value = (audioTrack.MixDown);
- newTrack.Cells[4].Value = (audioTrack.SampleRate);
- newTrack.Cells[5].Value = (audioTrack.Bitrate);
- newTrack.Cells[6].Value = (audioTrack.DRC);
- audioList.Rows.Add(newTrack);
+ this.audioTracks.Add(audioTrack);
}
}
@@ -184,6 +183,17 @@ namespace Handbrake.Controls
/// </param>
private void ControlChanged(object sender, EventArgs e)
{
+ if (audioList.SelectedRows.Count == 0)
+ {
+ return;
+ }
+
+ AudioTrack track = audioList.SelectedRows[0].DataBoundItem as AudioTrack;
+ if (track == null)
+ {
+ return;
+ }
+
Control ctl = (Control)sender;
switch (ctl.Name)
@@ -191,17 +201,17 @@ namespace Handbrake.Controls
case "drp_audioTrack":
if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
{
- audioList.SelectedRows[0].Cells[1].Value = drp_audioTrack.Text;
+ track.SourceTrack = drp_audioTrack.Text;
// If the track isn't AC3, and the encoder is, change it.
- if (audioList.SelectedRows[0].Cells[2].Value.ToString().Contains(AC3Passthru) && !audioList.SelectedRows[0].Cells[1].Value.ToString().Contains("(AC3)"))
+ if (track.Encoder == AudioEncoder.Ac3Passthrough && !track.SourceTrack.Contains("(AC3)"))
{
// Switch to AAC
drp_audioEncoder.SelectedIndex = 0;
}
// If the track isn't DTS, and the encoder is, change it.
- if (audioList.SelectedRows[0].Cells[2].Value.ToString().Contains(DTSPassthru) && !audioList.SelectedRows[0].Cells[1].Value.ToString().Contains("DTS"))
+ if (track.Encoder == AudioEncoder.DtsPassthrough && !track.SourceTrack.Contains("DTS"))
{
// Switch to AAC
drp_audioEncoder.SelectedIndex = 0;
@@ -225,23 +235,26 @@ namespace Handbrake.Controls
}
// Update an item in the Audio list if required.
- if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
- audioList.SelectedRows[0].Cells[2].Value = drp_audioEncoder.Text;
+ track.Encoder = EnumHelper<AudioEncoder>.GetValue(drp_audioEncoder.Text);
break;
case "drp_audioMix":
SetBitrate();
- if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
- audioList.SelectedRows[0].Cells[3].Value = drp_audioMix.Text;
+ track.MixDown = EnumHelper<Mixdown>.GetValue(drp_audioMix.Text);
+
break;
case "drp_audioSample":
- if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
- audioList.SelectedRows[0].Cells[4].Value = drp_audioSample.Text;
+
+ double samplerate;
+ double.TryParse(drp_audioSample.Text, out samplerate);
+ track.SampleRate = samplerate;
break;
case "drp_audioBitrate":
// Update an item in the Audio list if required.
- if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
- audioList.SelectedRows[0].Cells[5].Value = drp_audioBitrate.Text;
+ int bitrate;
+ int.TryParse(drp_audioBitrate.Text, out bitrate);
+
+ track.Bitrate = bitrate;
break;
case "tb_drc":
double value;
@@ -250,17 +263,13 @@ namespace Handbrake.Controls
value = ((tb_drc.Value - 1) / 10.0) + 1;
lbl_drc.Text = value.ToString();
-
- // Update an item in the Audio list if required.
- if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
- {
- audioList.SelectedRows[0].Cells[6].Value = value.ToString();
- audioList.Select();
- }
+ track.DRC = value;
+ audioList.Select();
+ audioList.Refresh();
break;
}
- audioList.Select();
+ audioList.Refresh();
}
/// <summary>
@@ -277,21 +286,24 @@ namespace Handbrake.Controls
// Set the dropdown controls based on the selected item in the Audio List.
if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
{
- drp_audioTrack.SelectedItem = audioList.SelectedRows[0].Cells[1].Value;
- drp_audioEncoder.SelectedItem = audioList.SelectedRows[0].Cells[2].Value;
- drp_audioMix.SelectedItem = audioList.SelectedRows[0].Cells[3].Value;
- drp_audioSample.SelectedItem = audioList.SelectedRows[0].Cells[4].Value;
- drp_audioBitrate.SelectedItem = audioList.SelectedRows[0].Cells[5].Value;
- double drcValue;
- int drcCalculated;
- double.TryParse(audioList.SelectedRows[0].Cells[6].Value.ToString(), out drcValue);
- if (drcValue != 0)
- drcValue = ((drcValue * 10) + 1) - 10;
- int.TryParse(drcValue.ToString(Culture), out drcCalculated);
- tb_drc.Value = drcCalculated;
- lbl_drc.Text = audioList.SelectedRows[0].Cells[6].Value.ToString();
-
- AudioTrackGroup.Text = "Selected Track: " + audioList.SelectedRows[0].Cells[0].Value;
+ AudioTrack track = audioList.SelectedRows[0].DataBoundItem as AudioTrack;
+ if (track != null)
+ {
+ drp_audioTrack.SelectedItem = track.SourceTrack;
+ drp_audioEncoder.SelectedItem = EnumHelper<AudioEncoder>.GetDescription(track.Encoder);
+ drp_audioMix.SelectedItem = EnumHelper<Mixdown>.GetDescription(track.MixDown);
+ drp_audioSample.SelectedItem = track.SampleRate;
+ drp_audioBitrate.SelectedItem = track.Bitrate;
+ double drcValue = 0;
+ int drcCalculated;
+ if (track.DRC != 0)
+ drcValue = ((track.DRC * 10) + 1) - 10;
+ int.TryParse(drcValue.ToString(Culture), out drcCalculated);
+ tb_drc.Value = drcCalculated;
+ lbl_drc.Text = track.DRC.ToString();
+
+ AudioTrackGroup.Text = "Selected Track: " + track.SourceTrack;
+ }
}
else
AudioTrackGroup.Text = "Selected Track: None (Click \"Add Track\" to add)";
@@ -310,7 +322,7 @@ namespace Handbrake.Controls
/// <param name="e">
/// The e.
/// </param>
- private void btn_addAudioTrack_Click(object sender, EventArgs e)
+ private void AddAudioTrack_Click(object sender, EventArgs e)
{
if (drp_audioTrack.Text == "None Found")
{
@@ -322,21 +334,30 @@ namespace Handbrake.Controls
return;
}
- double value = 0;
+ // Get Some Values
+ double drcValue = 0;
if (tb_drc.Value != 0)
- value = ((tb_drc.Value - 1) / 10.0) + 1;
-
- // Create a new row for the Audio list based on the currently selected items in the dropdown.
- DataGridViewRow newTrack = new DataGridViewRow();
- newTrack.CreateCells(audioList);
- newTrack.Cells[0].Value = GetNewID().ToString();
- newTrack.Cells[1].Value = drp_audioTrack.Text;
- newTrack.Cells[2].Value = drp_audioEncoder.Text;
- newTrack.Cells[3].Value = drp_audioMix.Text;
- newTrack.Cells[4].Value = drp_audioSample.Text;
- newTrack.Cells[5].Value = drp_audioBitrate.Text;
- newTrack.Cells[6].Value = value.ToString();
- audioList.Rows.Add(newTrack);
+ drcValue = ((tb_drc.Value - 1) / 10.0) + 1;
+
+ int bitrate;
+ double samplerate;
+
+ int.TryParse(drp_audioBitrate.Text, out bitrate);
+ double.TryParse(drp_audioSample.Text, out samplerate);
+
+ // Create the Model
+ AudioTrack track = new AudioTrack
+ {
+ SourceTrack = this.drp_audioTrack.Text,
+ Encoder = EnumHelper<AudioEncoder>.GetValue(this.drp_audioEncoder.Text),
+ MixDown = EnumHelper<Mixdown>.GetValue(this.drp_audioMix.Text),
+ SampleRate = samplerate,
+ Bitrate = bitrate,
+ Gain = 0,
+ DRC = drcValue
+ };
+
+ this.audioTracks.Add(track);
// The Audio List has changed to raise the event.
if (this.AudioListChanged != null)
@@ -357,7 +378,7 @@ namespace Handbrake.Controls
/// <param name="e">
/// The e.
/// </param>
- private void btn_RemoveAudioTrack_Click(object sender, EventArgs e)
+ private void RemoveAudioTrack_Click(object sender, EventArgs e)
{
RemoveTrack();
}
@@ -375,7 +396,7 @@ namespace Handbrake.Controls
/// <param name="e">
/// The e.
/// </param>
- private void audioList_moveup_Click(object sender, EventArgs e)
+ private void AudioList_moveup_Click(object sender, EventArgs e)
{
MoveTrack(true);
}
@@ -389,7 +410,7 @@ namespace Handbrake.Controls
/// <param name="e">
/// The e.
/// </param>
- private void audioList_movedown_Click(object sender, EventArgs e)
+ private void AudioList_movedown_Click(object sender, EventArgs e)
{
MoveTrack(false);
}
@@ -403,7 +424,7 @@ namespace Handbrake.Controls
/// <param name="e">
/// The e.
/// </param>
- private void audioList_remove_Click(object sender, EventArgs e)
+ private void AudioList_remove_Click(object sender, EventArgs e)
{
RemoveTrack();
}
@@ -412,18 +433,20 @@ namespace Handbrake.Controls
#region Private Functions
-
+ /// <summary>
+ /// Attempt to automatically select the correct audio tracks based on the users settings.
+ /// </summary>
private void AutomaticTrackSelection()
{
// Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options
if (Properties.Settings.Default.NativeLanguage == "Any")
{
drp_audioTrack.SelectedIndex = 0;
- foreach (DataGridViewRow item in audioList.Rows)
+ foreach (AudioTrack track in this.audioTracks)
{
if (this.drp_audioTrack.SelectedItem != null)
{
- item.Cells[1].Value = this.drp_audioTrack.SelectedItem.ToString();
+ track.SourceTrack = this.drp_audioTrack.SelectedItem.ToString();
}
}
}
@@ -449,14 +472,14 @@ namespace Handbrake.Controls
}
if (drp_audioTrack.SelectedItem != null)
- foreach (DataGridViewRow item in audioList.Rows)
- item.Cells[1].Value = drp_audioTrack.SelectedItem.ToString();
+ foreach (AudioTrack track in this.audioTracks)
+ track.SourceTrack = drp_audioTrack.SelectedItem.ToString();
else
{
drp_audioTrack.SelectedIndex = 0;
if (drp_audioTrack.SelectedItem != null)
- foreach (DataGridViewRow item in audioList.Rows)
- item.Cells[1].Value = drp_audioTrack.SelectedItem.ToString();
+ foreach (AudioTrack track in this.audioTracks)
+ track.SourceTrack = drp_audioTrack.SelectedItem.ToString();
}
break;
@@ -466,48 +489,25 @@ namespace Handbrake.Controls
drp_audioTrack.SelectedIndex = 0;
if (drp_audioTrack.SelectedItem != null)
- foreach (DataGridViewRow item in audioList.Rows)
- item.Cells[1].Value = drp_audioTrack.SelectedItem.ToString();
+ foreach (AudioTrack track in this.audioTracks)
+ track.SourceTrack = drp_audioTrack.SelectedItem.ToString();
break;
}
}
}
/// <summary>
- /// Add track for preset
- /// </summary>
- /// <param name="item">
- /// The item.
- /// </param>
- private void AddTrackForPreset(DataGridViewRow item)
- {
- audioList.Rows.Add(item);
- if (this.AudioListChanged != null)
- this.AudioListChanged(this, new EventArgs());
- }
-
- /// <summary>
/// Clear the audio list
/// </summary>
private void ClearAudioList()
{
- audioList.Rows.Clear();
+ this.audioTracks.Clear();
+
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
}
/// <summary>
- /// Get a new ID for the next audio track
- /// </summary>
- /// <returns>
- /// an int
- /// </returns>
- private int GetNewID()
- {
- return audioList.Rows.Count + 1;
- }
-
- /// <summary>
/// Remove an audio track from the list
/// </summary>
private void RemoveTrack()
@@ -535,8 +535,6 @@ namespace Handbrake.Controls
audioList.Select();
}
- // Regenerate the ID numers
- ReGenerateListIDs();
}
}
@@ -566,19 +564,6 @@ namespace Handbrake.Controls
}
/// <summary>
- /// Regenerate all the audio track id's on the audio list
- /// </summary>
- private void ReGenerateListIDs()
- {
- int i = 1;
- foreach (DataGridViewRow item in audioList.Rows)
- {
- item.Cells[0].Value = i.ToString();
- i++;
- }
- }
-
- /// <summary>
/// Set the bitrate dropdown
/// </summary>
private void SetBitrate()
diff --git a/win/CS/Controls/AudioPanel.resx b/win/CS/Controls/AudioPanel.resx
index ac50d9273..f114f8606 100644
--- a/win/CS/Controls/AudioPanel.resx
+++ b/win/CS/Controls/AudioPanel.resx
@@ -123,9 +123,6 @@
<metadata name="AudioMenuRowHeightHack.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>35, 17</value>
</metadata>
- <metadata name="Track.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>True</value>
- </metadata>
<metadata name="Source.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
diff --git a/win/CS/Functions/QueryGenerator.cs b/win/CS/Functions/QueryGenerator.cs
index 297b0ab44..e3f2e792c 100644
--- a/win/CS/Functions/QueryGenerator.cs
+++ b/win/CS/Functions/QueryGenerator.cs
@@ -9,9 +9,12 @@ namespace Handbrake.Functions
using System.Collections.Generic;
using System.Globalization;
using System.IO;
+ using System.Linq;
using System.Windows.Forms;
using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Functions;
+ using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -363,152 +366,53 @@ namespace Handbrake.Functions
private static string AudioSettingsQuery(frmMain mainWindow)
{
- string query = string.Empty;
-
- DataGridView audioTracks = mainWindow.AudioSettings.GetAudioPanel();
- List<string> tracks = new List<string>();
- List<string> codecs = new List<string>();
- List<string> mixdowns = new List<string>();
- List<string> samplerates = new List<string>();
- List<string> bitrates = new List<string>();
- List<string> drcs = new List<string>();
-
- // No Audio
- if (audioTracks.Rows.Count == 0)
- query += " -a none ";
-
- // Gather information about each audio track and store them in the declared lists.
- foreach (DataGridViewRow row in audioTracks.Rows)
+ // Queries for each option
+ string tracks = string.Empty;
+ string encoders = string.Empty;
+ string mixdowns = string.Empty;
+ string samplerates = string.Empty;
+ string bitrates = string.Empty;
+ string drvValues = string.Empty;
+ string gainValues = string.Empty;
+
+ // If we have no audio tracks, set the query to none
+ if (mainWindow.AudioSettings.AudioTracks.ToList().Count == 0)
{
- // Audio Track (-a)
- if (row.Cells[1].Value.ToString() == "Automatic")
- tracks.Add("1");
- else if (row.Cells[1].Value.ToString() != "None")
- {
- string[] tempSub = row.Cells[1].Value.ToString().Split(' ');
- tracks.Add(tempSub[0]);
- }
-
- // Audio Codec (-E)
- if (row.Cells[2].Value.ToString() != String.Empty)
- codecs.Add(GetAudioEncoder(row.Cells[2].Value.ToString()));
-
- // Audio Mixdown (-6)
- if (row.Cells[3].Value.ToString() != String.Empty)
- mixdowns.Add(GetMixDown(row.Cells[3].Value.ToString()));
-
- // Sample Rate (-R)
- if (row.Cells[4].Value.ToString() != String.Empty)
- samplerates.Add(row.Cells[4].Value.ToString());
-
- // Audio Bitrate (-B)
- if (row.Cells[5].Value.ToString() != String.Empty)
- bitrates.Add(row.Cells[5].Value.ToString().Replace("Auto", "auto"));
-
- // DRC (-D)
- if (row.Cells[6].Value.ToString() != String.Empty)
- drcs.Add(row.Cells[6].Value.ToString());
+ return " -a none";
}
- // Audio Track (-a)
- string audioItems = string.Empty;
- bool firstLoop = true;
-
- foreach (string item in tracks)
+ // Generate the sub queries
+ foreach (AudioTrack audioTrack in mainWindow.AudioSettings.AudioTracks)
{
- if (firstLoop)
- {
- audioItems = item;
- firstLoop = false;
- }
- else
- audioItems += "," + item;
- }
- if (audioItems.Trim() != String.Empty)
- query += " -a " + audioItems;
- firstLoop = true;
- audioItems = string.Empty; // Reset for another pass.
+ // Audio Track (-a)
+ string track = audioTrack.Track.HasValue ? audioTrack.Track.ToString() : "1"; // Default to "1"
+ tracks += string.IsNullOrEmpty(tracks) ? track : string.Format(",{0}", track);
- // Audio Codec (-E)
- foreach (string item in codecs)
- {
- if (firstLoop)
- {
- audioItems = item;
- firstLoop = false;
- }
- else
- audioItems += "," + item;
- }
- if (audioItems.Trim() != String.Empty)
- query += " -E " + audioItems;
- firstLoop = true;
- audioItems = string.Empty; // Reset for another pass.
+ // Audio Encoder (-E)
+ encoders += string.IsNullOrEmpty(encoders)
+ ? GetAudioEncoder(EnumHelper<AudioEncoder>.GetDescription(audioTrack.Encoder))
+ : string.Format(",{0}", GetAudioEncoder(EnumHelper<AudioEncoder>.GetDescription(audioTrack.Encoder)));
- // Audio Mixdown (-6)
- foreach (string item in mixdowns)
- {
- if (firstLoop)
- {
- audioItems = item;
- firstLoop = false;
- }
- else
- audioItems += "," + item;
- }
- if (audioItems.Trim() != String.Empty)
- query += " -6 " + audioItems;
- firstLoop = true;
- audioItems = string.Empty; // Reset for another pass.
+ // Audio Mixdowns (-6)
+ mixdowns += string.IsNullOrEmpty(mixdowns)
+ ? GetMixDown(EnumHelper<Mixdown>.GetDescription(audioTrack.MixDown))
+ : string.Format(",{0}", GetMixDown(EnumHelper<Mixdown>.GetDescription(audioTrack.MixDown)));
- // Sample Rate (-R)
- foreach (string item in samplerates)
- {
- if (firstLoop)
- {
- audioItems = item;
- firstLoop = false;
- }
- else
- audioItems += "," + item;
- }
- if (audioItems.Trim() != String.Empty)
- query += " -R " + audioItems;
- firstLoop = true;
- audioItems = string.Empty; // Reset for another pass.
+ // Audio Samplerates (-R)
+ string rate = audioTrack.SampleRate == 0 ? "Auto" : audioTrack.SampleRate.ToString(); // Default to "Auto"
+ samplerates += string.IsNullOrEmpty(samplerates) ? rate : string.Format(",{0}", rate);
- // Audio Bitrate (-B)
- foreach (string item in bitrates)
- {
- if (firstLoop)
- {
- audioItems = item;
- firstLoop = false;
- }
- else
- audioItems += "," + item;
- }
- if (audioItems.Trim() != String.Empty)
- query += " -B " + audioItems;
- firstLoop = true;
- audioItems = string.Empty; // Reset for another pass.
+ // Audio Bitrates (-B)
+ bitrates += string.IsNullOrEmpty(bitrates) ? audioTrack.Bitrate.ToString() : string.Format(",{0}", audioTrack.Bitrate);
- // DRC (-D)
- foreach (var itm in drcs)
- {
- string item = itm.ToString(new CultureInfo("en-US"));
- if (firstLoop)
- {
- audioItems = item;
- firstLoop = false;
- }
- else
- audioItems += "," + item;
+ // Audio DRC Values
+ drvValues += string.IsNullOrEmpty(drvValues) ? audioTrack.DRC.ToString() : string.Format(",{0}", audioTrack.DRC);
+
+ // Audio Gain Control
+ gainValues += string.IsNullOrEmpty(gainValues) ? audioTrack.Gain.ToString() : string.Format(",{0}", audioTrack.Gain);
}
- if (audioItems.Trim() != String.Empty)
- query += " -D " + audioItems;
- return query;
+ return string.Format(" -a {0} -E {1} -B {2} -6 {3} -R {4} -D {5} --gain={6}", tracks, encoders, bitrates, mixdowns, samplerates, drvValues, gainValues);
}
private static string ChapterMarkersQuery(frmMain mainWindow)
diff --git a/win/CS/HandBrake.ApplicationServices/Converters/EnumToDescConverter.cs b/win/CS/HandBrake.ApplicationServices/Converters/EnumToDescConverter.cs
new file mode 100644
index 000000000..a03a3f071
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Converters/EnumToDescConverter.cs
@@ -0,0 +1,24 @@
+namespace HandBrake.ApplicationServices.Converters
+{
+ using System.ComponentModel;
+ using System;
+
+ using HandBrake.ApplicationServices.Functions;
+
+ public class EnumToDescConveter : EnumConverter
+ {
+ public EnumToDescConveter(Type type)
+ : base(type)
+ {
+ }
+
+ public override object ConvertTo(
+ ITypeDescriptorContext context,
+ System.Globalization.CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ return EnumHelper<Enum>.GetDescription((Enum)value);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs
index 0bbc746d7..657434f31 100644
--- a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs
+++ b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs
@@ -12,7 +12,10 @@ namespace HandBrake.ApplicationServices.Functions
/// <summary>
/// Enum Helpers
/// </summary>
- public class EnumHelper
+ /// <typeparam name="T">
+ /// The Type Parameter
+ /// </typeparam>
+ public class EnumHelper<T>
{
/// <summary>
/// Get the description of an Enum
@@ -23,7 +26,7 @@ namespace HandBrake.ApplicationServices.Functions
/// <returns>
/// The Description string
/// </returns>
- public static string GetDescription(Enum value)
+ public static string GetDescription(T value)
{
FieldInfo fieldInfo = value.GetType().GetField(value.ToString());
DescriptionAttribute[] attributes =
@@ -31,5 +34,24 @@ namespace HandBrake.ApplicationServices.Functions
typeof(DescriptionAttribute), false);
return (attributes.Length > 0) ? attributes[0].Description : value.ToString();
}
+
+ /// <summary>
+ /// Get the Enumeration for a given Enum Description
+ /// </summary>
+ /// <param name="description">The String description</param>
+ /// <returns>The Enum Value</returns>
+ public static T GetValue(string description)
+ {
+ foreach (T val in Enum.GetValues(typeof(T)))
+ {
+ string currDescription = GetDescription(val);
+ if (currDescription == description)
+ {
+ return val;
+ }
+ }
+
+ throw new ArgumentOutOfRangeException("The Description for the enum was not recognized.");
+ }
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index fcfb2fe03..48a1eb08a 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -83,6 +83,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Converters\EnumToDescConverter.cs" />
<Compile Include="EventArgs\EncodeCompletedEventArgs.cs" />
<Compile Include="EventArgs\EncodeProgressEventArgs.cs" />
<Compile Include="EventArgs\QueueProgressEventArgs.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs
index 23d7d9e2f..716f539f8 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs
@@ -7,6 +7,9 @@ namespace HandBrake.ApplicationServices.Model.Encoding
{
using System.ComponentModel;
+ using HandBrake.ApplicationServices.Converters;
+
+ [TypeConverter(typeof(EnumToDescConveter))]
public enum AudioEncoder
{
[Description("AAC (faac)")]
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
index 440f72226..6e47d3421 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
@@ -16,17 +16,58 @@ namespace HandBrake.ApplicationServices.Model.Encoding
public AudioTrack()
{
// Default Values
- this.Track = 1;
+ this.Encoder = AudioEncoder.Faac;
this.MixDown = Mixdown.DolbyProLogicII;
this.SampleRate = 48;
this.Bitrate = 160;
this.DRC = 1;
+ this.SourceTrack = "Automatic";
}
/// <summary>
- /// Gets or sets Audio Track Name
+ /// Gets the Audio Track Name
/// </summary>
- public int Track { get; set; }
+ public int? Track
+ {
+ get
+ {
+ string[] tempSub = SourceTrack.Split(' ');
+ int value;
+ if (int.TryParse(tempSub[0], out value))
+ {
+ return value;
+ }
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the The UI display value for sample rate
+ /// </summary>
+ public string SampleRateDisplayValue
+ {
+ get
+ {
+ return SampleRate == 0 ? "Auto" : SampleRate.ToString();
+ }
+ }
+
+ /// <summary>
+ /// Gets the The UI display value for bit rate
+ /// </summary>
+ public string BitRateDisplayValue
+ {
+ get
+ {
+ return Bitrate == 0 ? "Auto" : Bitrate.ToString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the Source Track
+ /// Used for display purposes only.
+ /// </summary>
+ public string SourceTrack { get; set; }
/// <summary>
/// Gets or sets Audio Mixdown
@@ -52,5 +93,10 @@ namespace HandBrake.ApplicationServices.Model.Encoding
/// Gets or sets Dynamic Range Compression
/// </summary>
public double DRC { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Gain for the audio track
+ /// </summary>
+ public int Gain { get; set; }
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs
index 12611b454..8b0cc9005 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs
@@ -7,9 +7,12 @@ namespace HandBrake.ApplicationServices.Model.Encoding
{
using System.ComponentModel;
+ using HandBrake.ApplicationServices.Converters;
+
/// <summary>
/// The Mixdown Mode
/// </summary>
+ [TypeConverter(typeof(EnumToDescConveter))]
public enum Mixdown
{
[Description("Dolby Pro Logic II")]
@@ -28,6 +31,12 @@ namespace HandBrake.ApplicationServices.Model.Encoding
DolbySurround,
[Description("6 Channel Discrete")]
- SixChannelDiscrete
+ SixChannelDiscrete,
+
+ [Description("AC3 Passthru")]
+ Ac3Passthrough,
+
+ [Description("DTS Passthru")]
+ DtsPassthrough,
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs
index 1ac827037..5e7b89a10 100644
--- a/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs
+++ b/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs
@@ -5,6 +5,7 @@
namespace HandBrake.ApplicationServices.Parsing
{
+ using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
@@ -75,7 +76,7 @@ namespace HandBrake.ApplicationServices.Parsing
{
get
{
- return EnumHelper.GetDescription(this.SubtitleType);
+ return EnumHelper<Enum>.GetDescription(this.SubtitleType);
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
index 0a8aa72ec..752141bf0 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
@@ -68,7 +68,7 @@ namespace HandBrake.ApplicationServices.Utilities
track.SampleRate = double.Parse(value);
break;
case "AudioTrack":
- track.Track = int.Parse(value);
+ track.SourceTrack = value;
break;
case "AudioTrackDRCSlider":
track.DRC = double.Parse(value);
@@ -528,7 +528,7 @@ namespace HandBrake.ApplicationServices.Utilities
// Video Settings
AddEncodeElement(xmlWriter, "VideoAvgBitrate", "string", parsed.VideoBitrate.ToString());
- AddEncodeElement(xmlWriter, "VideoEncoder", "string", EnumHelper.GetDescription(parsed.VideoEncoder));
+ AddEncodeElement(xmlWriter, "VideoEncoder", "string", EnumHelper<Enum>.GetDescription(parsed.VideoEncoder));
AddEncodeElement(xmlWriter, "VideoFramerate", "string", parsed.Framerate.ToString());
AddEncodeElement(xmlWriter, "VideFrameratePFR", "integer", parsed.FramerateMode == FramerateMode.PFR ? "1" : "0");
AddEncodeElement(xmlWriter, "VideoGrayScale", "integer", parsed.Grayscale ? "1" : "0");
@@ -636,10 +636,10 @@ namespace HandBrake.ApplicationServices.Utilities
xmlWriter.WriteElementString("string", audioTrack.Bitrate.ToString());
xmlWriter.WriteElementString("key", "AudioEncoder");
- xmlWriter.WriteElementString("string", EnumHelper.GetDescription(audioTrack.Encoder));
+ xmlWriter.WriteElementString("string", EnumHelper<Enum>.GetDescription(audioTrack.Encoder));
xmlWriter.WriteElementString("key", "AudioMixdown");
- xmlWriter.WriteElementString("string", EnumHelper.GetDescription(audioTrack.MixDown));
+ xmlWriter.WriteElementString("string", EnumHelper<Enum>.GetDescription(audioTrack.MixDown));
xmlWriter.WriteElementString("key", "AudioSamplerate");
xmlWriter.WriteElementString("string", audioTrack.SampleRate.ToString());
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
index ce963188f..bd75880b9 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
@@ -136,7 +136,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
string query = string.Empty;
- query += string.Format(" -f {0} ", EnumHelper.GetDescription(task.OutputFormat).ToLower());
+ query += string.Format(" -f {0} ", EnumHelper<Enum>.GetDescription(task.OutputFormat).ToLower());
// These are output settings features
if (task.LargeFile)
@@ -373,7 +373,12 @@ namespace HandBrake.ApplicationServices.Utilities
// Gather information about each audio track and store them in the declared lists.
foreach (AudioTrack track in audioTracks)
{
- tracks.Add(track.Track);
+ if (track.Track == null)
+ {
+ continue;
+ }
+
+ tracks.Add(track.Track.Value);
// Audio Codec (-E)
codecs.Add(track.Encoder);
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
index 856114bb0..4d34ac937 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
@@ -359,7 +359,7 @@ namespace HandBrake.ApplicationServices.Utilities
AudioTrack track = new AudioTrack();
if (trackData != null)
if (trackData.Length >= (x + 1)) // Audio Track
- track.Track = int.Parse(trackData[x].Trim());
+ track.SourceTrack = trackData[x].Trim();
if (trackMixes != null)
if (trackMixes.Length >= (x + 1)) // Audio Mix
diff --git a/win/CS/frmQueue.cs b/win/CS/frmQueue.cs
index e5b2d68d7..ee9dae04f 100644
--- a/win/CS/frmQueue.cs
+++ b/win/CS/frmQueue.cs
@@ -372,7 +372,7 @@ namespace Handbrake
if (audio != string.Empty)
audio += ", " + track.Encoder;
else
- audio = EnumHelper.GetDescription(track.Encoder);
+ audio = EnumHelper<AudioEncoder>.GetDescription(track.Encoder);
}
item.SubItems.Add(audio); // Audio
@@ -429,7 +429,7 @@ namespace Handbrake
if (audio != string.Empty)
audio += ", " + track.Encoder;
else
- audio = EnumHelper.GetDescription(track.Encoder);
+ audio = EnumHelper<AudioEncoder>.GetDescription(track.Encoder);
}
// found query is a global varible