this.drp_audioBitrate = new System.Windows.Forms.ComboBox();\r
this.drp_audioSample = new System.Windows.Forms.ComboBox();\r
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);\r
- this.label1 = new System.Windows.Forms.Label();\r
- this.lbl_audioTrack = new System.Windows.Forms.Label();\r
this.audioList = new System.Windows.Forms.DataGridView();\r
this.ToolTips = new System.Windows.Forms.ToolTip(this.components);\r
this.btn_AdvancedAudio = new System.Windows.Forms.Button();\r
this.Bitrate = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
this.DRC = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
this.Gain = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
+ this.audioList_MoveToBottom = new System.Windows.Forms.ToolStripMenuItem();\r
+ this.audioList_MoveToTop = new System.Windows.Forms.ToolStripMenuItem();\r
this.audioMenu.SuspendLayout();\r
((System.ComponentModel.ISupportInitialize)(this.audioList)).BeginInit();\r
this.SuspendLayout();\r
// audioMenu\r
// \r
this.audioMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+ this.audioList_MoveToTop,\r
this.audioList_moveup,\r
this.audioList_movedown,\r
+ this.audioList_MoveToBottom,\r
this.toolStripSeparator2,\r
this.audioList_remove});\r
this.audioMenu.Name = "audioMenu";\r
- this.audioMenu.Size = new System.Drawing.Size(139, 76);\r
+ this.audioMenu.Size = new System.Drawing.Size(165, 142);\r
// \r
// audioList_moveup\r
// \r
this.audioList_moveup.Name = "audioList_moveup";\r
- this.audioList_moveup.Size = new System.Drawing.Size(138, 22);\r
+ this.audioList_moveup.Size = new System.Drawing.Size(164, 22);\r
this.audioList_moveup.Text = "Move Up";\r
this.audioList_moveup.Click += new System.EventHandler(this.AudioList_moveup_Click);\r
// \r
// audioList_movedown\r
// \r
this.audioList_movedown.Name = "audioList_movedown";\r
- this.audioList_movedown.Size = new System.Drawing.Size(138, 22);\r
+ this.audioList_movedown.Size = new System.Drawing.Size(164, 22);\r
this.audioList_movedown.Text = "Move Down";\r
this.audioList_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
this.audioList_movedown.Click += new System.EventHandler(this.AudioList_movedown_Click);\r
// toolStripSeparator2\r
// \r
this.toolStripSeparator2.Name = "toolStripSeparator2";\r
- this.toolStripSeparator2.Size = new System.Drawing.Size(135, 6);\r
+ this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6);\r
// \r
// audioList_remove\r
// \r
this.audioList_remove.Name = "audioList_remove";\r
- this.audioList_remove.Size = new System.Drawing.Size(138, 22);\r
+ this.audioList_remove.Size = new System.Drawing.Size(164, 22);\r
this.audioList_remove.Text = "Remove";\r
this.audioList_remove.Click += new System.EventHandler(this.AudioList_remove_Click);\r
// \r
"AC3 Passthru",\r
"AC3 (ffmpeg)",\r
"DTS Passthru"});\r
- this.drp_audioEncoder.Location = new System.Drawing.Point(191, 87);\r
+ this.drp_audioEncoder.Location = new System.Drawing.Point(191, 66);\r
this.drp_audioEncoder.Name = "drp_audioEncoder";\r
this.drp_audioEncoder.Size = new System.Drawing.Size(111, 21);\r
this.drp_audioEncoder.TabIndex = 52;\r
"Dolby Surround",\r
"Dolby Pro Logic II",\r
"6 Channel Discrete"});\r
- this.drp_audioMix.Location = new System.Drawing.Point(309, 87);\r
+ this.drp_audioMix.Location = new System.Drawing.Point(309, 66);\r
this.drp_audioMix.Name = "drp_audioMix";\r
this.drp_audioMix.Size = new System.Drawing.Size(147, 21);\r
this.drp_audioMix.TabIndex = 54;\r
this.drp_audioTrack.FormattingEnabled = true;\r
this.drp_audioTrack.Items.AddRange(new object[] {\r
"Automatic"});\r
- this.drp_audioTrack.Location = new System.Drawing.Point(16, 87);\r
+ this.drp_audioTrack.Location = new System.Drawing.Point(16, 66);\r
this.drp_audioTrack.Name = "drp_audioTrack";\r
this.drp_audioTrack.Size = new System.Drawing.Size(170, 21);\r
this.drp_audioTrack.TabIndex = 50;\r
"112",\r
"128",\r
"160"});\r
- this.drp_audioBitrate.Location = new System.Drawing.Point(534, 87);\r
+ this.drp_audioBitrate.Location = new System.Drawing.Point(534, 66);\r
this.drp_audioBitrate.Name = "drp_audioBitrate";\r
this.drp_audioBitrate.Size = new System.Drawing.Size(67, 21);\r
this.drp_audioBitrate.TabIndex = 58;\r
"32",\r
"24",\r
"22.05"});\r
- this.drp_audioSample.Location = new System.Drawing.Point(461, 87);\r
+ this.drp_audioSample.Location = new System.Drawing.Point(461, 66);\r
this.drp_audioSample.Name = "drp_audioSample";\r
this.drp_audioSample.Size = new System.Drawing.Size(67, 21);\r
this.drp_audioSample.TabIndex = 56;\r
this.AudioMenuRowHeightHack.ImageSize = new System.Drawing.Size(1, 18);\r
this.AudioMenuRowHeightHack.TransparentColor = System.Drawing.Color.Transparent;\r
// \r
- // label1\r
- // \r
- this.label1.AutoSize = true;\r
- this.label1.BackColor = System.Drawing.Color.Transparent;\r
- this.label1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.label1.Location = new System.Drawing.Point(13, 66);\r
- this.label1.Name = "label1";\r
- this.label1.Size = new System.Drawing.Size(94, 13);\r
- this.label1.TabIndex = 68;\r
- this.label1.Text = "Selected Track:";\r
- // \r
- // lbl_audioTrack\r
- // \r
- this.lbl_audioTrack.AutoSize = true;\r
- this.lbl_audioTrack.BackColor = System.Drawing.Color.Transparent;\r
- this.lbl_audioTrack.Location = new System.Drawing.Point(113, 66);\r
- this.lbl_audioTrack.Name = "lbl_audioTrack";\r
- this.lbl_audioTrack.Size = new System.Drawing.Size(32, 13);\r
- this.lbl_audioTrack.TabIndex = 69;\r
- this.lbl_audioTrack.Text = "None";\r
- // \r
// audioList\r
// \r
this.audioList.AllowUserToAddRows = false;\r
this.Gain});\r
this.audioList.ContextMenuStrip = this.audioMenu;\r
this.audioList.GridColor = System.Drawing.Color.White;\r
- this.audioList.Location = new System.Drawing.Point(16, 114);\r
+ this.audioList.Location = new System.Drawing.Point(16, 94);\r
this.audioList.Name = "audioList";\r
this.audioList.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;\r
this.audioList.RowHeadersVisible = false;\r
this.audioList.ShowCellToolTips = false;\r
this.audioList.ShowEditingIcon = false;\r
this.audioList.ShowRowErrors = false;\r
- this.audioList.Size = new System.Drawing.Size(685, 180);\r
+ this.audioList.Size = new System.Drawing.Size(685, 200);\r
this.audioList.TabIndex = 67;\r
this.ToolTips.SetToolTip(this.audioList, "The audio tracks to be encoded into the output file.");\r
this.audioList.SelectionChanged += new System.EventHandler(this.audioList_SelectionChanged);\r
this.btn_AdvancedAudio.BackColor = System.Drawing.Color.Transparent;\r
this.btn_AdvancedAudio.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
this.btn_AdvancedAudio.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
- this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 86);\r
+ this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 65);\r
this.btn_AdvancedAudio.Name = "btn_AdvancedAudio";\r
this.btn_AdvancedAudio.Size = new System.Drawing.Size(94, 23);\r
this.btn_AdvancedAudio.TabIndex = 70;\r
// \r
// Source\r
// \r
- this.Source.DataPropertyName = "SourceTrack";\r
+ this.Source.DataPropertyName = "TrackDisplay";\r
this.Source.FillWeight = 49.69727F;\r
this.Source.HeaderText = "Source";\r
this.Source.Name = "Source";\r
this.Gain.ReadOnly = true;\r
this.Gain.Width = 60;\r
// \r
+ // audioList_MoveToBottom\r
+ // \r
+ this.audioList_MoveToBottom.Name = "audioList_MoveToBottom";\r
+ this.audioList_MoveToBottom.Size = new System.Drawing.Size(164, 22);\r
+ this.audioList_MoveToBottom.Text = "Move To Bottom";\r
+ this.audioList_MoveToBottom.Click += new System.EventHandler(this.audioList_MoveToBottom_Click);\r
+ // \r
+ // audioList_MoveToTop\r
+ // \r
+ this.audioList_MoveToTop.Name = "audioList_MoveToTop";\r
+ this.audioList_MoveToTop.Size = new System.Drawing.Size(164, 22);\r
+ this.audioList_MoveToTop.Text = "Move to Top";\r
+ this.audioList_MoveToTop.Click += new System.EventHandler(this.audioList_MoveToTop_Click);\r
+ // \r
// AudioPanel\r
// \r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;\r
this.BackColor = System.Drawing.Color.Transparent;\r
- this.Controls.Add(this.label1);\r
- this.Controls.Add(this.lbl_audioTrack);\r
this.Controls.Add(this.drp_audioTrack);\r
this.Controls.Add(this.btn_AdvancedAudio);\r
this.Controls.Add(this.drp_audioSample);\r
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;\r
private System.Windows.Forms.ToolStripMenuItem audioList_remove;\r
internal System.Windows.Forms.ComboBox drp_audioBitrate;\r
- internal System.Windows.Forms.Label label1;\r
- internal System.Windows.Forms.Label lbl_audioTrack;\r
private System.Windows.Forms.DataGridView audioList;\r
private System.Windows.Forms.ToolTip ToolTips;\r
private System.Windows.Forms.Button btn_AdvancedAudio;\r
private System.Windows.Forms.DataGridViewTextBoxColumn Bitrate;\r
private System.Windows.Forms.DataGridViewTextBoxColumn DRC;\r
private System.Windows.Forms.DataGridViewTextBoxColumn Gain;\r
+ private System.Windows.Forms.ToolStripMenuItem audioList_MoveToTop;\r
+ private System.Windows.Forms.ToolStripMenuItem audioList_MoveToBottom;\r
}\r
}\r
using System;\r
using System.Collections.Generic;\r
using System.ComponentModel;\r
- using System.Globalization;\r
using System.Linq;\r
using System.Windows.Forms;\r
\r
\r
using Handbrake.ToolWindows;\r
\r
- using AudioTrack = HandBrake.ApplicationServices.Model.Encoding.AudioTrack;\r
-\r
/// <summary>\r
/// The AudioPanel Control\r
/// </summary>\r
public partial class AudioPanel : UserControl\r
{\r
- /**\r
- * TODO - There is a lot of old code in here that access the datagrid that can be refactored to work with \r
- * the new AudioTrack BindingList.\r
- */\r
-\r
- private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
+ #region Private Variables\r
+ private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();\r
private const string AC3Passthru = "AC3 Passthru";\r
private const string DTSPassthru = "DTS Passthru";\r
- AdvancedAudio advancedAudio = new AdvancedAudio();\r
-\r
- private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();\r
+ private AdvancedAudio advancedAudio = new AdvancedAudio();\r
+ #endregion\r
\r
#region Constructor and Events\r
\r
{\r
InitializeComponent();\r
\r
+ this.ScannedTracks = new BindingList<Audio>\r
+ {\r
+ Audio.NoneFound \r
+ };\r
+\r
this.audioList.AutoGenerateColumns = false;\r
this.audioList.DataSource = audioTracks;\r
\r
drp_audioMix.SelectedItem = "Dolby Pro Logic II";\r
drp_audioSample.SelectedIndex = 1;\r
\r
- \r
+ drp_audioTrack.DataSource = this.ScannedTracks;\r
}\r
\r
/// <summary>\r
\r
#region Properties\r
\r
+ public BindingList<Audio> ScannedTracks { get; set; }\r
+\r
/// <summary>\r
/// Gets the AudioTracks Collection\r
/// </summary>\r
- public IEnumerable<AudioTrack> AudioTracks\r
+ public BindingList<AudioTrack> AudioTracks\r
{\r
get\r
{\r
/// <returns>True if m4v is required</returns>\r
public bool RequiresM4V()\r
{\r
- return true;\r
+ return this.AudioTracks.Any(item => item.Encoder == AudioEncoder.Ac3Passthrough || item.Encoder == AudioEncoder.DtsPassthrough || item.Encoder == AudioEncoder.Ac3);\r
}\r
\r
/// <summary>\r
/// Load an arraylist of AudioTrack items into the list.\r
/// </summary>\r
- /// <param name="audioTracks">List of audio tracks</param>\r
- public void LoadTracks(List<AudioTrack> audioTracks)\r
+ /// <param name="tracks">List of audio tracks</param>\r
+ public void LoadTracks(List<AudioTrack> tracks)\r
{\r
ClearAudioList();\r
\r
- if (audioTracks == null)\r
+ if (tracks == null)\r
return;\r
\r
- foreach (AudioTrack track in audioTracks)\r
+ foreach (AudioTrack track in tracks)\r
{\r
this.audioTracks.Add(track);\r
}\r
if (selectedTitle.AudioTracks.Count == 0)\r
{\r
audioList.Rows.Clear();\r
- drp_audioTrack.Items.Clear();\r
- drp_audioTrack.Items.Add("None Found");\r
+ this.ScannedTracks.Clear();\r
+ this.ScannedTracks.Add(Audio.NoneFound);\r
+ this.drp_audioTrack.Refresh();\r
drp_audioTrack.SelectedIndex = 0;\r
return;\r
}\r
\r
// Setup the Audio track source dropdown with the new audio tracks.\r
- drp_audioTrack.Items.Clear();\r
- drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray());\r
+ this.ScannedTracks.Clear();\r
+ foreach (var item in selectedTitle.AudioTracks)\r
+ {\r
+ this.ScannedTracks.Add(item);\r
+ }\r
+ this.drp_audioTrack.Refresh();\r
+ drp_audioTrack.SelectedIndex = 0;\r
\r
// Add any tracks the preset has, if there is a preset and no audio tracks in the list currently\r
if (audioList.Rows.Count == 0 && preset != null)\r
case "drp_audioTrack":\r
if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)\r
{\r
- track.SourceTrack = drp_audioTrack.Text;\r
+ track.ScannedTrack = drp_audioTrack.SelectedItem as Audio;\r
\r
// If the track isn't AC3, and the encoder is, change it.\r
- if (track.Encoder == AudioEncoder.Ac3Passthrough && !track.SourceTrack.Contains("(AC3)"))\r
+ if (track.Encoder == AudioEncoder.Ac3Passthrough && !track.ScannedTrack.Format.Contains("AC3"))\r
{\r
// Switch to AAC\r
drp_audioEncoder.SelectedIndex = 0;\r
}\r
\r
// If the track isn't DTS, and the encoder is, change it.\r
- if (track.Encoder == AudioEncoder.DtsPassthrough && !track.SourceTrack.Contains("DTS"))\r
+ if (track.Encoder == AudioEncoder.DtsPassthrough && !track.ScannedTrack.Format.Contains("DTS"))\r
{\r
// Switch to AAC\r
drp_audioEncoder.SelectedIndex = 0;\r
}\r
\r
audioList.Refresh();\r
-\r
- if (audioList.SelectedRows.Count == 1)\r
- {\r
- AudioTrack item = audioList.SelectedRows[0].DataBoundItem as AudioTrack;\r
- if (item != null) lbl_audioTrack.Text = track.SourceTrack;\r
- }\r
}\r
\r
/// <summary>\r
AudioTrack track = audioList.SelectedRows[0].DataBoundItem as AudioTrack;\r
if (track != null)\r
{\r
- drp_audioTrack.SelectedItem = track.SourceTrack;\r
+ drp_audioTrack.SelectedItem = track.ScannedTrack;\r
drp_audioEncoder.SelectedItem = EnumHelper<AudioEncoder>.GetDescription(track.Encoder);\r
drp_audioMix.SelectedItem = EnumHelper<Mixdown>.GetDescription(track.MixDown);\r
drp_audioSample.SelectedItem = track.SampleRate;\r
drp_audioBitrate.SelectedItem = track.Bitrate;\r
- lbl_audioTrack.Text = track.SourceTrack;\r
\r
// Set the Advanced Control.\r
if (!advancedAudio.IsDisposed)\r
advancedAudio.Track = track;\r
}\r
}\r
- else\r
- lbl_audioTrack.Text = "(Click \"Add Track\" to add)";\r
-\r
}\r
\r
#endregion\r
// Create the Model\r
AudioTrack track = new AudioTrack\r
{\r
- SourceTrack = this.drp_audioTrack.Text,\r
+ ScannedTrack = this.drp_audioTrack.SelectedItem as Audio,\r
Encoder = EnumHelper<AudioEncoder>.GetValue(this.drp_audioEncoder.Text),\r
MixDown = EnumHelper<Mixdown>.GetValue(this.drp_audioMix.Text),\r
SampleRate = samplerate,\r
RemoveTrack();\r
}\r
\r
+ /// <summary>\r
+ /// Move to Top\r
+ /// </summary>\r
+ /// <param name="sender">The Sender</param>\r
+ /// <param name="e">The Event Args</param>\r
+ private void audioList_MoveToTop_Click(object sender, EventArgs e)\r
+ {\r
+ MoveTo(true);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Move to Bottom\r
+ /// </summary>\r
+ /// <param name="sender">The Sender</param>\r
+ /// <param name="e">The Event Args</param>\r
+ private void audioList_MoveToBottom_Click(object sender, EventArgs e)\r
+ {\r
+ this.MoveTo(false);\r
+ }\r
+\r
#endregion\r
\r
#region Private Functions\r
/// </summary>\r
private void AutomaticTrackSelection()\r
{\r
+ if (drp_audioTrack.SelectedItem.ToString() == Audio.NoneFound.Description)\r
+ {\r
+ this.AudioTracks.Clear();\r
+ return;\r
+ }\r
+\r
// Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options\r
if (Properties.Settings.Default.NativeLanguage == "Any")\r
{\r
{\r
if (this.drp_audioTrack.SelectedItem != null)\r
{\r
- track.SourceTrack = this.drp_audioTrack.SelectedItem.ToString();\r
+ track.ScannedTrack = this.drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
}\r
}\r
}\r
\r
if (drp_audioTrack.SelectedItem != null)\r
foreach (AudioTrack track in this.audioTracks)\r
- track.SourceTrack = drp_audioTrack.SelectedItem.ToString();\r
+ track.ScannedTrack =\r
+ drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
else\r
{\r
drp_audioTrack.SelectedIndex = 0;\r
if (drp_audioTrack.SelectedItem != null)\r
foreach (AudioTrack track in this.audioTracks)\r
- track.SourceTrack = drp_audioTrack.SelectedItem.ToString();\r
+ track.ScannedTrack = drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
}\r
\r
break;\r
\r
if (drp_audioTrack.SelectedItem != null)\r
foreach (AudioTrack track in this.audioTracks)\r
- track.SourceTrack = drp_audioTrack.SelectedItem.ToString();\r
+ track.ScannedTrack = drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
break;\r
}\r
}\r
if (audioList.SelectedRows.Count == 0) return;\r
\r
DataGridViewRow item = audioList.SelectedRows[0];\r
+ AudioTrack track = item.DataBoundItem as AudioTrack;\r
int index = item.Index;\r
\r
if (up) index--;\r
\r
if (index < audioList.Rows.Count || (audioList.Rows.Count > index && index >= 0))\r
{\r
- audioList.Rows.Remove(item);\r
- audioList.Rows.Insert(index, item);\r
- audioList.ClearSelection();\r
- item.Selected = true;\r
+ this.AudioTracks.Remove(track);\r
+ this.audioTracks.Insert(index, track);\r
+ this.audioList.ClearSelection();\r
+ this.audioList.Rows[index].Selected = true;\r
+ }\r
+ }\r
+\r
+ private void MoveTo(bool top)\r
+ {\r
+ if (audioList.SelectedRows.Count == 0) return;\r
+\r
+ DataGridViewRow item = audioList.SelectedRows[0];\r
+ AudioTrack track = item.DataBoundItem as AudioTrack;\r
+ int index = item.Index;\r
+\r
+ if (top) index = 0;\r
+ else index = this.audioList.Rows.Count - 1;\r
+\r
+ if (index < audioList.Rows.Count || (audioList.Rows.Count > index && index >= 0))\r
+ {\r
+ this.AudioTracks.Remove(track);\r
+ this.audioTracks.Insert(index, track);\r
+ this.audioList.ClearSelection();\r
+ this.audioList.Rows[index].Selected = true;\r
}\r
}\r
\r
\r
private void btn_AdvancedAudio_Click(object sender, EventArgs e)\r
{\r
+ if (audioList.SelectedRows.Count == 0)\r
+ {\r
+ MessageBox.Show(\r
+ "Please select an audio track.", "No Track Selected", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ return;\r
+ }\r
+\r
if (advancedAudio.IsDisposed)\r
{\r
advancedAudio = new AdvancedAudio { Track = this.audioList.SelectedRows[0].DataBoundItem as AudioTrack };\r
\r
advancedAudio.Show();\r
}\r
-\r
- \r
}\r
}
\ No newline at end of file
using System.IO;\r
using System.Linq;\r
using System.Security.Cryptography;\r
- using System.Text;\r
using System.Text.RegularExpressions;\r
- using System.Threading;\r
using System.Windows.Forms;\r
using System.Xml.Serialization;\r
\r
<Compile Include="Model\Preset.cs" />\r
<Compile Include="Model\QueueTask.cs" />\r
<Compile Include="Model\Encoding\SubtitleType.cs" />\r
- <Compile Include="Parsing\AudioTrack.cs" />\r
+ <Compile Include="Parsing\Audio.cs" />\r
<Compile Include="Parsing\Chapter.cs" />\r
<Compile Include="Parsing\Source.cs" />\r
<Compile Include="Parsing\Parser.cs" />\r
\r
namespace HandBrake.ApplicationServices.Model.Encoding\r
{\r
+ using HandBrake.ApplicationServices.Parsing;\r
+\r
/// <summary>\r
/// An Audio Track for the Audio Panel\r
/// </summary>\r
/// The DRC Value\r
/// </summary>\r
private double drc;\r
+\r
+ /// <summary>\r
+ /// The Scanned Audio Track\r
+ /// </summary>\r
+ private Audio scannedTrack;\r
#endregion\r
\r
/// <summary>\r
this.SampleRate = 48;\r
this.Bitrate = 160;\r
this.DRC = 1;\r
- this.SourceTrack = "Automatic";\r
+ this.ScannedTrack = new Audio();\r
}\r
\r
/// <summary>\r
{\r
get\r
{\r
- string[] tempSub = SourceTrack.Split(' ');\r
- int value;\r
- if (int.TryParse(tempSub[0], out value))\r
+ if (this.ScannedTrack != null)\r
{\r
- return value;\r
+ return this.ScannedTrack.TrackNumber;\r
}\r
+\r
return null;\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Gets or sets the Scanned Audio Tracks\r
+ /// </summary>\r
+ public Audio ScannedTrack\r
+ {\r
+ get\r
+ {\r
+ return this.scannedTrack;\r
+ }\r
+\r
+ set\r
+ {\r
+ this.scannedTrack = value;\r
+ this.OnPropertyChanged("ScannedTrack");\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the Display Value for this model.\r
+ /// </summary>\r
+ public string TrackDisplay\r
+ {\r
+ get\r
+ {\r
+ return this.ScannedTrack.ToString();\r
+ }\r
+ }\r
+\r
/// <summary>\r
/// Gets the The UI display value for sample rate\r
/// </summary>\r
{\r
get\r
{\r
- return SampleRate == 0 ? "Auto" : SampleRate.ToString();\r
+ return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();\r
}\r
}\r
\r
{\r
get\r
{\r
- return Bitrate == 0 ? "Auto" : Bitrate.ToString();\r
+ return this.Bitrate == 0 ? "Auto" : this.Bitrate.ToString();\r
}\r
}\r
\r
- /// <summary>\r
- /// Gets or sets the Source Track\r
- /// Used for display purposes only.\r
- /// </summary>\r
- public string SourceTrack { get; set; }\r
-\r
/// <summary>\r
/// Gets or sets Audio Mixdown\r
/// </summary>\r
{\r
return this.drc;\r
}\r
+\r
set\r
{\r
if (!object.Equals(value, this.drc))\r
{\r
return this.gain;\r
}\r
+\r
set\r
{\r
if (!object.Equals(value, this.gain))\r
/// <summary>\r
/// An object represending an AudioTrack associated with a Title, in a DVD\r
/// </summary>\r
- public class AudioTrack\r
+ public class Audio\r
{\r
/// <summary>\r
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.\r
+ /// Initializes a new instance of the <see cref="Audio"/> class.\r
/// </summary>\r
- public AudioTrack()\r
- { \r
+ public Audio()\r
+ {\r
}\r
\r
/// <summary>\r
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.\r
+ /// Initializes a new instance of the <see cref="Audio"/> class.\r
/// </summary>\r
/// <param name="trackNumber">\r
/// The track number.\r
/// <param name="bitrate">\r
/// The bitrate.\r
/// </param>\r
- public AudioTrack(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)\r
+ public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)\r
{\r
this.TrackNumber = trackNumber;\r
this.Language = language;\r
this.Bitrate = bitrate;\r
}\r
\r
+ /// <summary>\r
+ /// Gets A Dummy Not Found Track\r
+ /// </summary>\r
+ public static Audio NoneFound\r
+ {\r
+ get\r
+ {\r
+ return new Audio { Description = "None Found" };\r
+ }\r
+ }\r
+\r
/// <summary>\r
/// Gets or sets The track number of this Audio Track\r
/// </summary>\r
/// <returns>\r
/// An Audio Track obkect\r
/// </returns>\r
- public static AudioTrack Parse(StringReader output)\r
+ public static Audio Parse(StringReader output)\r
{\r
string audioTrack = output.ReadLine();\r
Match m = Regex.Match(audioTrack, @"^ \+ ([0-9]*), ([A-Za-z0-9,\s]*) \((.*)\) \((.*)\)");\r
\r
if (track.Success)\r
{\r
- var thisTrack = new AudioTrack\r
+ var thisTrack = new Audio\r
{\r
- TrackNumber = int.Parse(track.Groups[1].Value.Trim()), \r
- Language = track.Groups[2].Value, \r
+ TrackNumber = int.Parse(track.Groups[1].Value.Trim()),\r
+ Language = track.Groups[2].Value,\r
Format = m.Groups[3].Value,\r
- Description = subformat, \r
- SampleRate = int.Parse(samplerateVal), \r
+ Description = subformat,\r
+ SampleRate = int.Parse(samplerateVal),\r
Bitrate = int.Parse(bitrateVal),\r
LanguageCode = iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)\r
};\r
/// <returns>\r
/// An array of audio tracks\r
/// </returns>\r
- public static AudioTrack[] ParseList(StringReader output)\r
+ public static Audio[] ParseList(StringReader output)\r
{\r
- var tracks = new List<AudioTrack>();\r
+ var tracks = new List<Audio>();\r
while (true)\r
{\r
- AudioTrack thisTrack = Parse(output);\r
+ Audio thisTrack = Parse(output);\r
if (thisTrack != null)\r
tracks.Add(thisTrack);\r
else\r
/// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>\r
public override string ToString()\r
{\r
- if (Description == null)\r
- return string.Format("{0} {1} ({2})", TrackNumber, Language, Format);\r
+ if (this.Description == NoneFound.Description)\r
+ {\r
+ return this.Description;\r
+ }\r
+\r
+ if (this.Description == null)\r
+ {\r
+ return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.Format);\r
+ }\r
\r
- return string.Format("{0} {1} ({2}) ({3})", TrackNumber, Language, Format, Description);\r
+ return string.Format("{0} {1} ({2}) ({3})", this.TrackNumber, this.Language, this.Format, this.Description);\r
}\r
}\r
}
\ No newline at end of file
/// </summary>\r
public Title()\r
{\r
- this.AudioTracks = new List<AudioTrack>();\r
+ this.AudioTracks = new List<Audio>();\r
this.Chapters = new List<Chapter>();\r
this.Subtitles = new List<Subtitle>();\r
}\r
/// <summary>\r
/// Gets or sets a Collection of audio tracks associated with this Title\r
/// </summary>\r
- public List<AudioTrack> AudioTracks { get; set; }\r
+ public List<Audio> AudioTracks { get; set; }\r
\r
/// <summary>\r
/// Gets or sets a Collection of subtitles associated with this Title\r
\r
thisTitle.Chapters.AddRange(Chapter.ParseList(output));\r
\r
- thisTitle.AudioTracks.AddRange(AudioTrack.ParseList(output));\r
+ thisTitle.AudioTracks.AddRange(Audio.ParseList(output));\r
\r
thisTitle.Subtitles.AddRange(Subtitle.ParseList(output));\r
\r
using HandBrake.ApplicationServices.Services.Interfaces;\r
using HandBrake.Interop;\r
\r
- using AudioTrack = HandBrake.ApplicationServices.Parsing.AudioTrack;\r
+ using AudioTrack = HandBrake.ApplicationServices.Parsing.Audio;\r
using Cropping = HandBrake.ApplicationServices.Model.Encoding.Cropping;\r
using ScanProgressEventArgs = HandBrake.Interop.ScanProgressEventArgs;\r
using Size = System.Drawing.Size;\r
track.SampleRate = double.Parse(value);\r
break;\r
case "AudioTrack":\r
- track.SourceTrack = value;\r
+ //track.SourceTrack = value;\r
break;\r
case "AudioTrackDRCSlider":\r
track.DRC = double.Parse(value);\r
for (int x = 0; x < encoderCount; x++)\r
{\r
AudioTrack track = new AudioTrack();\r
- if (trackData != null)\r
- if (trackData.Length >= (x + 1)) // Audio Track\r
- track.SourceTrack = trackData[x].Trim();\r
+ //if (trackData != null)\r
+ // if (trackData.Length >= (x + 1)) // Audio Track\r
+ // track.ScannedTrack = trackData[x].Trim();\r
\r
if (trackMixes != null)\r
if (trackMixes.Length >= (x + 1)) // Audio Mix\r