summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/Controls/AudioPanel.Designer.cs75
-rw-r--r--win/CS/Controls/AudioPanel.cs144
-rw-r--r--win/CS/Functions/Main.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs56
-rw-r--r--win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs (renamed from win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs)54
-rw-r--r--win/CS/HandBrake.ApplicationServices/Parsing/Title.cs6
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs6
10 files changed, 218 insertions, 131 deletions
diff --git a/win/CS/Controls/AudioPanel.Designer.cs b/win/CS/Controls/AudioPanel.Designer.cs
index dbc1e84c9..13a5c48ef 100644
--- a/win/CS/Controls/AudioPanel.Designer.cs
+++ b/win/CS/Controls/AudioPanel.Designer.cs
@@ -49,8 +49,6 @@ namespace Handbrake.Controls
this.drp_audioBitrate = new System.Windows.Forms.ComboBox();
this.drp_audioSample = new System.Windows.Forms.ComboBox();
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);
- this.label1 = new System.Windows.Forms.Label();
- this.lbl_audioTrack = new System.Windows.Forms.Label();
this.audioList = new System.Windows.Forms.DataGridView();
this.ToolTips = new System.Windows.Forms.ToolTip(this.components);
this.btn_AdvancedAudio = new System.Windows.Forms.Button();
@@ -61,6 +59,8 @@ namespace Handbrake.Controls
this.Bitrate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DRC = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Gain = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.audioList_MoveToBottom = new System.Windows.Forms.ToolStripMenuItem();
+ this.audioList_MoveToTop = new System.Windows.Forms.ToolStripMenuItem();
this.audioMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.audioList)).BeginInit();
this.SuspendLayout();
@@ -68,24 +68,26 @@ namespace Handbrake.Controls
// audioMenu
//
this.audioMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.audioList_MoveToTop,
this.audioList_moveup,
this.audioList_movedown,
+ this.audioList_MoveToBottom,
this.toolStripSeparator2,
this.audioList_remove});
this.audioMenu.Name = "audioMenu";
- this.audioMenu.Size = new System.Drawing.Size(139, 76);
+ this.audioMenu.Size = new System.Drawing.Size(165, 142);
//
// audioList_moveup
//
this.audioList_moveup.Name = "audioList_moveup";
- this.audioList_moveup.Size = new System.Drawing.Size(138, 22);
+ this.audioList_moveup.Size = new System.Drawing.Size(164, 22);
this.audioList_moveup.Text = "Move Up";
this.audioList_moveup.Click += new System.EventHandler(this.AudioList_moveup_Click);
//
// audioList_movedown
//
this.audioList_movedown.Name = "audioList_movedown";
- this.audioList_movedown.Size = new System.Drawing.Size(138, 22);
+ this.audioList_movedown.Size = new System.Drawing.Size(164, 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);
@@ -93,12 +95,12 @@ namespace Handbrake.Controls
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(135, 6);
+ this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6);
//
// audioList_remove
//
this.audioList_remove.Name = "audioList_remove";
- this.audioList_remove.Size = new System.Drawing.Size(138, 22);
+ this.audioList_remove.Size = new System.Drawing.Size(164, 22);
this.audioList_remove.Text = "Remove";
this.audioList_remove.Click += new System.EventHandler(this.AudioList_remove_Click);
//
@@ -150,7 +152,7 @@ namespace Handbrake.Controls
"AC3 Passthru",
"AC3 (ffmpeg)",
"DTS Passthru"});
- this.drp_audioEncoder.Location = new System.Drawing.Point(191, 87);
+ this.drp_audioEncoder.Location = new System.Drawing.Point(191, 66);
this.drp_audioEncoder.Name = "drp_audioEncoder";
this.drp_audioEncoder.Size = new System.Drawing.Size(111, 21);
this.drp_audioEncoder.TabIndex = 52;
@@ -168,7 +170,7 @@ namespace Handbrake.Controls
"Dolby Surround",
"Dolby Pro Logic II",
"6 Channel Discrete"});
- this.drp_audioMix.Location = new System.Drawing.Point(309, 87);
+ this.drp_audioMix.Location = new System.Drawing.Point(309, 66);
this.drp_audioMix.Name = "drp_audioMix";
this.drp_audioMix.Size = new System.Drawing.Size(147, 21);
this.drp_audioMix.TabIndex = 54;
@@ -181,7 +183,7 @@ namespace Handbrake.Controls
this.drp_audioTrack.FormattingEnabled = true;
this.drp_audioTrack.Items.AddRange(new object[] {
"Automatic"});
- this.drp_audioTrack.Location = new System.Drawing.Point(16, 87);
+ this.drp_audioTrack.Location = new System.Drawing.Point(16, 66);
this.drp_audioTrack.Name = "drp_audioTrack";
this.drp_audioTrack.Size = new System.Drawing.Size(170, 21);
this.drp_audioTrack.TabIndex = 50;
@@ -203,7 +205,7 @@ namespace Handbrake.Controls
"112",
"128",
"160"});
- this.drp_audioBitrate.Location = new System.Drawing.Point(534, 87);
+ this.drp_audioBitrate.Location = new System.Drawing.Point(534, 66);
this.drp_audioBitrate.Name = "drp_audioBitrate";
this.drp_audioBitrate.Size = new System.Drawing.Size(67, 21);
this.drp_audioBitrate.TabIndex = 58;
@@ -221,7 +223,7 @@ namespace Handbrake.Controls
"32",
"24",
"22.05"});
- this.drp_audioSample.Location = new System.Drawing.Point(461, 87);
+ this.drp_audioSample.Location = new System.Drawing.Point(461, 66);
this.drp_audioSample.Name = "drp_audioSample";
this.drp_audioSample.Size = new System.Drawing.Size(67, 21);
this.drp_audioSample.TabIndex = 56;
@@ -234,27 +236,6 @@ namespace Handbrake.Controls
this.AudioMenuRowHeightHack.ImageSize = new System.Drawing.Size(1, 18);
this.AudioMenuRowHeightHack.TransparentColor = System.Drawing.Color.Transparent;
//
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.BackColor = System.Drawing.Color.Transparent;
- this.label1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label1.Location = new System.Drawing.Point(13, 66);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(94, 13);
- this.label1.TabIndex = 68;
- this.label1.Text = "Selected Track:";
- //
- // lbl_audioTrack
- //
- this.lbl_audioTrack.AutoSize = true;
- this.lbl_audioTrack.BackColor = System.Drawing.Color.Transparent;
- this.lbl_audioTrack.Location = new System.Drawing.Point(113, 66);
- this.lbl_audioTrack.Name = "lbl_audioTrack";
- this.lbl_audioTrack.Size = new System.Drawing.Size(32, 13);
- this.lbl_audioTrack.TabIndex = 69;
- this.lbl_audioTrack.Text = "None";
- //
// audioList
//
this.audioList.AllowUserToAddRows = false;
@@ -273,7 +254,7 @@ namespace Handbrake.Controls
this.Gain});
this.audioList.ContextMenuStrip = this.audioMenu;
this.audioList.GridColor = System.Drawing.Color.White;
- this.audioList.Location = new System.Drawing.Point(16, 114);
+ this.audioList.Location = new System.Drawing.Point(16, 94);
this.audioList.Name = "audioList";
this.audioList.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
this.audioList.RowHeadersVisible = false;
@@ -283,7 +264,7 @@ namespace Handbrake.Controls
this.audioList.ShowCellToolTips = false;
this.audioList.ShowEditingIcon = false;
this.audioList.ShowRowErrors = false;
- this.audioList.Size = new System.Drawing.Size(685, 180);
+ this.audioList.Size = new System.Drawing.Size(685, 200);
this.audioList.TabIndex = 67;
this.ToolTips.SetToolTip(this.audioList, "The audio tracks to be encoded into the output file.");
this.audioList.SelectionChanged += new System.EventHandler(this.audioList_SelectionChanged);
@@ -293,7 +274,7 @@ namespace Handbrake.Controls
this.btn_AdvancedAudio.BackColor = System.Drawing.Color.Transparent;
this.btn_AdvancedAudio.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_AdvancedAudio.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 86);
+ this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 65);
this.btn_AdvancedAudio.Name = "btn_AdvancedAudio";
this.btn_AdvancedAudio.Size = new System.Drawing.Size(94, 23);
this.btn_AdvancedAudio.TabIndex = 70;
@@ -303,7 +284,7 @@ namespace Handbrake.Controls
//
// Source
//
- this.Source.DataPropertyName = "SourceTrack";
+ this.Source.DataPropertyName = "TrackDisplay";
this.Source.FillWeight = 49.69727F;
this.Source.HeaderText = "Source";
this.Source.Name = "Source";
@@ -369,12 +350,24 @@ namespace Handbrake.Controls
this.Gain.ReadOnly = true;
this.Gain.Width = 60;
//
+ // audioList_MoveToBottom
+ //
+ this.audioList_MoveToBottom.Name = "audioList_MoveToBottom";
+ this.audioList_MoveToBottom.Size = new System.Drawing.Size(164, 22);
+ this.audioList_MoveToBottom.Text = "Move To Bottom";
+ this.audioList_MoveToBottom.Click += new System.EventHandler(this.audioList_MoveToBottom_Click);
+ //
+ // audioList_MoveToTop
+ //
+ this.audioList_MoveToTop.Name = "audioList_MoveToTop";
+ this.audioList_MoveToTop.Size = new System.Drawing.Size(164, 22);
+ this.audioList_MoveToTop.Text = "Move to Top";
+ this.audioList_MoveToTop.Click += new System.EventHandler(this.audioList_MoveToTop_Click);
+ //
// AudioPanel
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.BackColor = System.Drawing.Color.Transparent;
- this.Controls.Add(this.label1);
- this.Controls.Add(this.lbl_audioTrack);
this.Controls.Add(this.drp_audioTrack);
this.Controls.Add(this.btn_AdvancedAudio);
this.Controls.Add(this.drp_audioSample);
@@ -411,8 +404,6 @@ namespace Handbrake.Controls
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem audioList_remove;
internal System.Windows.Forms.ComboBox drp_audioBitrate;
- internal System.Windows.Forms.Label label1;
- internal System.Windows.Forms.Label lbl_audioTrack;
private System.Windows.Forms.DataGridView audioList;
private System.Windows.Forms.ToolTip ToolTips;
private System.Windows.Forms.Button btn_AdvancedAudio;
@@ -423,5 +414,7 @@ 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.ToolStripMenuItem audioList_MoveToTop;
+ private System.Windows.Forms.ToolStripMenuItem audioList_MoveToBottom;
}
}
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs
index ed38c368f..471ac9d2f 100644
--- a/win/CS/Controls/AudioPanel.cs
+++ b/win/CS/Controls/AudioPanel.cs
@@ -8,7 +8,6 @@ namespace Handbrake.Controls
using System;
using System.Collections.Generic;
using System.ComponentModel;
- using System.Globalization;
using System.Linq;
using System.Windows.Forms;
@@ -20,24 +19,17 @@ namespace Handbrake.Controls
using Handbrake.ToolWindows;
- using AudioTrack = HandBrake.ApplicationServices.Model.Encoding.AudioTrack;
-
/// <summary>
/// The AudioPanel Control
/// </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);
+ #region Private Variables
+ private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();
private const string AC3Passthru = "AC3 Passthru";
private const string DTSPassthru = "DTS Passthru";
- AdvancedAudio advancedAudio = new AdvancedAudio();
-
- private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();
+ private AdvancedAudio advancedAudio = new AdvancedAudio();
+ #endregion
#region Constructor and Events
@@ -48,13 +40,18 @@ namespace Handbrake.Controls
{
InitializeComponent();
+ this.ScannedTracks = new BindingList<Audio>
+ {
+ Audio.NoneFound
+ };
+
this.audioList.AutoGenerateColumns = false;
this.audioList.DataSource = audioTracks;
drp_audioMix.SelectedItem = "Dolby Pro Logic II";
drp_audioSample.SelectedIndex = 1;
-
+ drp_audioTrack.DataSource = this.ScannedTracks;
}
/// <summary>
@@ -66,10 +63,12 @@ namespace Handbrake.Controls
#region Properties
+ public BindingList<Audio> ScannedTracks { get; set; }
+
/// <summary>
/// Gets the AudioTracks Collection
/// </summary>
- public IEnumerable<AudioTrack> AudioTracks
+ public BindingList<AudioTrack> AudioTracks
{
get
{
@@ -115,21 +114,21 @@ namespace Handbrake.Controls
/// <returns>True if m4v is required</returns>
public bool RequiresM4V()
{
- return true;
+ return this.AudioTracks.Any(item => item.Encoder == AudioEncoder.Ac3Passthrough || item.Encoder == AudioEncoder.DtsPassthrough || item.Encoder == AudioEncoder.Ac3);
}
/// <summary>
/// Load an arraylist of AudioTrack items into the list.
/// </summary>
- /// <param name="audioTracks">List of audio tracks</param>
- public void LoadTracks(List<AudioTrack> audioTracks)
+ /// <param name="tracks">List of audio tracks</param>
+ public void LoadTracks(List<AudioTrack> tracks)
{
ClearAudioList();
- if (audioTracks == null)
+ if (tracks == null)
return;
- foreach (AudioTrack track in audioTracks)
+ foreach (AudioTrack track in tracks)
{
this.audioTracks.Add(track);
}
@@ -150,15 +149,21 @@ namespace Handbrake.Controls
if (selectedTitle.AudioTracks.Count == 0)
{
audioList.Rows.Clear();
- drp_audioTrack.Items.Clear();
- drp_audioTrack.Items.Add("None Found");
+ this.ScannedTracks.Clear();
+ this.ScannedTracks.Add(Audio.NoneFound);
+ this.drp_audioTrack.Refresh();
drp_audioTrack.SelectedIndex = 0;
return;
}
// Setup the Audio track source dropdown with the new audio tracks.
- drp_audioTrack.Items.Clear();
- drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray());
+ this.ScannedTracks.Clear();
+ foreach (var item in selectedTitle.AudioTracks)
+ {
+ this.ScannedTracks.Add(item);
+ }
+ this.drp_audioTrack.Refresh();
+ drp_audioTrack.SelectedIndex = 0;
// Add any tracks the preset has, if there is a preset and no audio tracks in the list currently
if (audioList.Rows.Count == 0 && preset != null)
@@ -206,17 +211,17 @@ namespace Handbrake.Controls
case "drp_audioTrack":
if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
{
- track.SourceTrack = drp_audioTrack.Text;
+ track.ScannedTrack = drp_audioTrack.SelectedItem as Audio;
// If the track isn't AC3, and the encoder is, change it.
- if (track.Encoder == AudioEncoder.Ac3Passthrough && !track.SourceTrack.Contains("(AC3)"))
+ if (track.Encoder == AudioEncoder.Ac3Passthrough && !track.ScannedTrack.Format.Contains("AC3"))
{
// Switch to AAC
drp_audioEncoder.SelectedIndex = 0;
}
// If the track isn't DTS, and the encoder is, change it.
- if (track.Encoder == AudioEncoder.DtsPassthrough && !track.SourceTrack.Contains("DTS"))
+ if (track.Encoder == AudioEncoder.DtsPassthrough && !track.ScannedTrack.Format.Contains("DTS"))
{
// Switch to AAC
drp_audioEncoder.SelectedIndex = 0;
@@ -264,12 +269,6 @@ namespace Handbrake.Controls
}
audioList.Refresh();
-
- if (audioList.SelectedRows.Count == 1)
- {
- AudioTrack item = audioList.SelectedRows[0].DataBoundItem as AudioTrack;
- if (item != null) lbl_audioTrack.Text = track.SourceTrack;
- }
}
/// <summary>
@@ -289,21 +288,17 @@ namespace Handbrake.Controls
AudioTrack track = audioList.SelectedRows[0].DataBoundItem as AudioTrack;
if (track != null)
{
- drp_audioTrack.SelectedItem = track.SourceTrack;
+ drp_audioTrack.SelectedItem = track.ScannedTrack;
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;
- lbl_audioTrack.Text = track.SourceTrack;
// Set the Advanced Control.
if (!advancedAudio.IsDisposed)
advancedAudio.Track = track;
}
}
- else
- lbl_audioTrack.Text = "(Click \"Add Track\" to add)";
-
}
#endregion
@@ -341,7 +336,7 @@ namespace Handbrake.Controls
// Create the Model
AudioTrack track = new AudioTrack
{
- SourceTrack = this.drp_audioTrack.Text,
+ ScannedTrack = this.drp_audioTrack.SelectedItem as Audio,
Encoder = EnumHelper<AudioEncoder>.GetValue(this.drp_audioEncoder.Text),
MixDown = EnumHelper<Mixdown>.GetValue(this.drp_audioMix.Text),
SampleRate = samplerate,
@@ -422,6 +417,26 @@ namespace Handbrake.Controls
RemoveTrack();
}
+ /// <summary>
+ /// Move to Top
+ /// </summary>
+ /// <param name="sender">The Sender</param>
+ /// <param name="e">The Event Args</param>
+ private void audioList_MoveToTop_Click(object sender, EventArgs e)
+ {
+ MoveTo(true);
+ }
+
+ /// <summary>
+ /// Move to Bottom
+ /// </summary>
+ /// <param name="sender">The Sender</param>
+ /// <param name="e">The Event Args</param>
+ private void audioList_MoveToBottom_Click(object sender, EventArgs e)
+ {
+ this.MoveTo(false);
+ }
+
#endregion
#region Private Functions
@@ -431,6 +446,12 @@ namespace Handbrake.Controls
/// </summary>
private void AutomaticTrackSelection()
{
+ if (drp_audioTrack.SelectedItem.ToString() == Audio.NoneFound.Description)
+ {
+ this.AudioTracks.Clear();
+ return;
+ }
+
// Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options
if (Properties.Settings.Default.NativeLanguage == "Any")
{
@@ -439,7 +460,7 @@ namespace Handbrake.Controls
{
if (this.drp_audioTrack.SelectedItem != null)
{
- track.SourceTrack = this.drp_audioTrack.SelectedItem.ToString();
+ track.ScannedTrack = this.drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;
}
}
}
@@ -466,13 +487,14 @@ namespace Handbrake.Controls
if (drp_audioTrack.SelectedItem != null)
foreach (AudioTrack track in this.audioTracks)
- track.SourceTrack = drp_audioTrack.SelectedItem.ToString();
+ track.ScannedTrack =
+ drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;
else
{
drp_audioTrack.SelectedIndex = 0;
if (drp_audioTrack.SelectedItem != null)
foreach (AudioTrack track in this.audioTracks)
- track.SourceTrack = drp_audioTrack.SelectedItem.ToString();
+ track.ScannedTrack = drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;
}
break;
@@ -483,7 +505,7 @@ namespace Handbrake.Controls
if (drp_audioTrack.SelectedItem != null)
foreach (AudioTrack track in this.audioTracks)
- track.SourceTrack = drp_audioTrack.SelectedItem.ToString();
+ track.ScannedTrack = drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;
break;
}
}
@@ -542,6 +564,7 @@ namespace Handbrake.Controls
if (audioList.SelectedRows.Count == 0) return;
DataGridViewRow item = audioList.SelectedRows[0];
+ AudioTrack track = item.DataBoundItem as AudioTrack;
int index = item.Index;
if (up) index--;
@@ -549,10 +572,30 @@ namespace Handbrake.Controls
if (index < audioList.Rows.Count || (audioList.Rows.Count > index && index >= 0))
{
- audioList.Rows.Remove(item);
- audioList.Rows.Insert(index, item);
- audioList.ClearSelection();
- item.Selected = true;
+ this.AudioTracks.Remove(track);
+ this.audioTracks.Insert(index, track);
+ this.audioList.ClearSelection();
+ this.audioList.Rows[index].Selected = true;
+ }
+ }
+
+ private void MoveTo(bool top)
+ {
+ if (audioList.SelectedRows.Count == 0) return;
+
+ DataGridViewRow item = audioList.SelectedRows[0];
+ AudioTrack track = item.DataBoundItem as AudioTrack;
+ int index = item.Index;
+
+ if (top) index = 0;
+ else index = this.audioList.Rows.Count - 1;
+
+ if (index < audioList.Rows.Count || (audioList.Rows.Count > index && index >= 0))
+ {
+ this.AudioTracks.Remove(track);
+ this.audioTracks.Insert(index, track);
+ this.audioList.ClearSelection();
+ this.audioList.Rows[index].Selected = true;
}
}
@@ -683,6 +726,13 @@ namespace Handbrake.Controls
private void btn_AdvancedAudio_Click(object sender, EventArgs e)
{
+ if (audioList.SelectedRows.Count == 0)
+ {
+ MessageBox.Show(
+ "Please select an audio track.", "No Track Selected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+
if (advancedAudio.IsDisposed)
{
advancedAudio = new AdvancedAudio { Track = this.audioList.SelectedRows[0].DataBoundItem as AudioTrack };
@@ -690,7 +740,5 @@ namespace Handbrake.Controls
advancedAudio.Show();
}
-
-
}
} \ No newline at end of file
diff --git a/win/CS/Functions/Main.cs b/win/CS/Functions/Main.cs
index a4098cad6..ae13e3f18 100644
--- a/win/CS/Functions/Main.cs
+++ b/win/CS/Functions/Main.cs
@@ -11,9 +11,7 @@ namespace Handbrake.Functions
using System.IO;
using System.Linq;
using System.Security.Cryptography;
- using System.Text;
using System.Text.RegularExpressions;
- using System.Threading;
using System.Windows.Forms;
using System.Xml.Serialization;
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 65a1b3e5f..dd44f6d9c 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -120,7 +120,7 @@
<Compile Include="Model\Preset.cs" />
<Compile Include="Model\QueueTask.cs" />
<Compile Include="Model\Encoding\SubtitleType.cs" />
- <Compile Include="Parsing\AudioTrack.cs" />
+ <Compile Include="Parsing\Audio.cs" />
<Compile Include="Parsing\Chapter.cs" />
<Compile Include="Parsing\Source.cs" />
<Compile Include="Parsing\Parser.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
index 159beb8e8..b9ecca97d 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
@@ -5,6 +5,8 @@
namespace HandBrake.ApplicationServices.Model.Encoding
{
+ using HandBrake.ApplicationServices.Parsing;
+
/// <summary>
/// An Audio Track for the Audio Panel
/// </summary>
@@ -20,6 +22,11 @@ namespace HandBrake.ApplicationServices.Model.Encoding
/// The DRC Value
/// </summary>
private double drc;
+
+ /// <summary>
+ /// The Scanned Audio Track
+ /// </summary>
+ private Audio scannedTrack;
#endregion
/// <summary>
@@ -33,7 +40,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
this.SampleRate = 48;
this.Bitrate = 160;
this.DRC = 1;
- this.SourceTrack = "Automatic";
+ this.ScannedTrack = new Audio();
}
/// <summary>
@@ -43,24 +50,51 @@ namespace HandBrake.ApplicationServices.Model.Encoding
{
get
{
- string[] tempSub = SourceTrack.Split(' ');
- int value;
- if (int.TryParse(tempSub[0], out value))
+ if (this.ScannedTrack != null)
{
- return value;
+ return this.ScannedTrack.TrackNumber;
}
+
return null;
}
}
/// <summary>
+ /// Gets or sets the Scanned Audio Tracks
+ /// </summary>
+ public Audio ScannedTrack
+ {
+ get
+ {
+ return this.scannedTrack;
+ }
+
+ set
+ {
+ this.scannedTrack = value;
+ this.OnPropertyChanged("ScannedTrack");
+ }
+ }
+
+ /// <summary>
+ /// Gets the Display Value for this model.
+ /// </summary>
+ public string TrackDisplay
+ {
+ get
+ {
+ return this.ScannedTrack.ToString();
+ }
+ }
+
+ /// <summary>
/// Gets the The UI display value for sample rate
/// </summary>
public string SampleRateDisplayValue
{
get
{
- return SampleRate == 0 ? "Auto" : SampleRate.ToString();
+ return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();
}
}
@@ -71,17 +105,11 @@ namespace HandBrake.ApplicationServices.Model.Encoding
{
get
{
- return Bitrate == 0 ? "Auto" : Bitrate.ToString();
+ return this.Bitrate == 0 ? "Auto" : this.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
/// </summary>
public Mixdown MixDown { get; set; }
@@ -110,6 +138,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
{
return this.drc;
}
+
set
{
if (!object.Equals(value, this.drc))
@@ -129,6 +158,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
{
return this.gain;
}
+
set
{
if (!object.Equals(value, this.gain))
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs
index 0597f4d1b..14f807c6c 100644
--- a/win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs
+++ b/win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs
@@ -12,17 +12,17 @@ namespace HandBrake.ApplicationServices.Parsing
/// <summary>
/// An object represending an AudioTrack associated with a Title, in a DVD
/// </summary>
- public class AudioTrack
+ public class Audio
{
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref="Audio"/> class.
/// </summary>
- public AudioTrack()
- {
+ public Audio()
+ {
}
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref="Audio"/> class.
/// </summary>
/// <param name="trackNumber">
/// The track number.
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// <param name="bitrate">
/// The bitrate.
/// </param>
- public AudioTrack(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)
+ public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)
{
this.TrackNumber = trackNumber;
this.Language = language;
@@ -57,6 +57,17 @@ namespace HandBrake.ApplicationServices.Parsing
}
/// <summary>
+ /// Gets A Dummy Not Found Track
+ /// </summary>
+ public static Audio NoneFound
+ {
+ get
+ {
+ return new Audio { Description = "None Found" };
+ }
+ }
+
+ /// <summary>
/// Gets or sets The track number of this Audio Track
/// </summary>
public int TrackNumber { get; set; }
@@ -100,7 +111,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// <returns>
/// An Audio Track obkect
/// </returns>
- public static AudioTrack Parse(StringReader output)
+ public static Audio Parse(StringReader output)
{
string audioTrack = output.ReadLine();
Match m = Regex.Match(audioTrack, @"^ \+ ([0-9]*), ([A-Za-z0-9,\s]*) \((.*)\) \((.*)\)");
@@ -115,13 +126,13 @@ namespace HandBrake.ApplicationServices.Parsing
if (track.Success)
{
- var thisTrack = new AudioTrack
+ var thisTrack = new Audio
{
- TrackNumber = int.Parse(track.Groups[1].Value.Trim()),
- Language = track.Groups[2].Value,
+ TrackNumber = int.Parse(track.Groups[1].Value.Trim()),
+ Language = track.Groups[2].Value,
Format = m.Groups[3].Value,
- Description = subformat,
- SampleRate = int.Parse(samplerateVal),
+ Description = subformat,
+ SampleRate = int.Parse(samplerateVal),
Bitrate = int.Parse(bitrateVal),
LanguageCode = iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)
};
@@ -140,12 +151,12 @@ namespace HandBrake.ApplicationServices.Parsing
/// <returns>
/// An array of audio tracks
/// </returns>
- public static AudioTrack[] ParseList(StringReader output)
+ public static Audio[] ParseList(StringReader output)
{
- var tracks = new List<AudioTrack>();
+ var tracks = new List<Audio>();
while (true)
{
- AudioTrack thisTrack = Parse(output);
+ Audio thisTrack = Parse(output);
if (thisTrack != null)
tracks.Add(thisTrack);
else
@@ -160,10 +171,17 @@ namespace HandBrake.ApplicationServices.Parsing
/// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>
public override string ToString()
{
- if (Description == null)
- return string.Format("{0} {1} ({2})", TrackNumber, Language, Format);
+ if (this.Description == NoneFound.Description)
+ {
+ return this.Description;
+ }
+
+ if (this.Description == null)
+ {
+ return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.Format);
+ }
- return string.Format("{0} {1} ({2}) ({3})", TrackNumber, Language, Format, Description);
+ return string.Format("{0} {1} ({2}) ({3})", this.TrackNumber, this.Language, this.Format, this.Description);
}
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
index 2f08eb19e..98c2f02f2 100644
--- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
+++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
@@ -30,7 +30,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// </summary>
public Title()
{
- this.AudioTracks = new List<AudioTrack>();
+ this.AudioTracks = new List<Audio>();
this.Chapters = new List<Chapter>();
this.Subtitles = new List<Subtitle>();
}
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// <summary>
/// Gets or sets a Collection of audio tracks associated with this Title
/// </summary>
- public List<AudioTrack> AudioTracks { get; set; }
+ public List<Audio> AudioTracks { get; set; }
/// <summary>
/// Gets or sets a Collection of subtitles associated with this Title
@@ -193,7 +193,7 @@ namespace HandBrake.ApplicationServices.Parsing
thisTitle.Chapters.AddRange(Chapter.ParseList(output));
- thisTitle.AudioTracks.AddRange(AudioTrack.ParseList(output));
+ thisTitle.AudioTracks.AddRange(Audio.ParseList(output));
thisTitle.Subtitles.AddRange(Subtitle.ParseList(output));
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index 6f200e447..1d93162a1 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -16,7 +16,7 @@ namespace HandBrake.ApplicationServices.Services
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop;
- using AudioTrack = HandBrake.ApplicationServices.Parsing.AudioTrack;
+ using AudioTrack = HandBrake.ApplicationServices.Parsing.Audio;
using Cropping = HandBrake.ApplicationServices.Model.Encoding.Cropping;
using ScanProgressEventArgs = HandBrake.Interop.ScanProgressEventArgs;
using Size = System.Drawing.Size;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
index 752141bf0..86cae01b5 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.SourceTrack = value;
+ //track.SourceTrack = value;
break;
case "AudioTrackDRCSlider":
track.DRC = double.Parse(value);
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
index 62de5d6d6..ce558107e 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
@@ -361,9 +361,9 @@ namespace HandBrake.ApplicationServices.Utilities
for (int x = 0; x < encoderCount; x++)
{
AudioTrack track = new AudioTrack();
- if (trackData != null)
- if (trackData.Length >= (x + 1)) // Audio Track
- track.SourceTrack = trackData[x].Trim();
+ //if (trackData != null)
+ // if (trackData.Length >= (x + 1)) // Audio Track
+ // track.ScannedTrack = trackData[x].Trim();
if (trackMixes != null)
if (trackMixes.Length >= (x + 1)) // Audio Mix