1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
|
/* AudioPanel.cs $
This file is part of the HandBrake source code.
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
namespace Handbrake.Controls
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Utilities;
using Handbrake.ToolWindows;
/// <summary>
/// The AudioPanel Control
/// </summary>
public partial class AudioPanel : UserControl
{
#region Private Variables
private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();
private const string AC3Passthru = "AC3 Passthru";
private const string DTSPassthru = "DTS Passthru";
private AdvancedAudio advancedAudio = new AdvancedAudio();
#endregion
#region Constructor and Events
/// <summary>
/// Initializes a new instance of the <see cref="AudioPanel"/> class.
/// </summary>
public AudioPanel()
{
InitializeComponent();
this.ScannedTracks = new BindingList<Audio>
{
AudioHelper.NoneFound
};
this.audioList.AutoGenerateColumns = false;
this.audioList.DataSource = audioTracks;
drp_audioMix.SelectedItem = "Dolby Pro Logic II";
drp_audioSample.SelectedIndex = 1;
drp_audioBitrate.SelectedItem = "160";
drp_audioEncoder.SelectedItem = "AAC (faac)";
drp_audioTrack.DataSource = this.ScannedTracks;
}
/// <summary>
/// The audio list has changed
/// </summary>
public event EventHandler AudioListChanged;
#endregion
#region Properties
public BindingList<Audio> ScannedTracks { get; set; }
/// <summary>
/// Gets the AudioTracks Collection
/// </summary>
public BindingList<AudioTrack> AudioTracks
{
get
{
return this.audioTracks;
}
}
/// <summary>
/// Gets the Estimated Bitrate for Tracks and Passthru Tracks
/// Returns a Size object (Encoded Tracks, Passthru Trask)
/// </summary>
public Size EstimatedBitrate
{
get
{
int encodedTracks = 0;
int passthruTracks = 0;
foreach (AudioTrack track in this.AudioTracks)
{
if (track.Encoder == AudioEncoder.Ac3Passthrough || track.Encoder == AudioEncoder.DtsPassthrough)
{
passthruTracks += track.ScannedTrack.Bitrate;
}
else
{
encodedTracks += track.Bitrate;
}
}
return new Size(encodedTracks, passthruTracks);
}
}
#endregion
#region Public Methods
/// <summary>
/// Set the File Container. This funciton is used to limit the available options for each file container.
/// </summary>
/// <param name="path">
/// the file path
/// </param>
public void SetContainer(string path)
{
string oldval = drp_audioEncoder.Text;
drp_audioEncoder.Items.Clear();
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(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;
}
/// <summary>
/// Checks if the settings used required the .m4v (rather than .mp4) extension
/// </summary>
/// <returns>True if m4v is required</returns>
public bool RequiresM4V()
{
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="tracks">List of audio tracks</param>
public void LoadTracks(List<AudioTrack> tracks)
{
ClearAudioList();
if (tracks == null)
return;
foreach (AudioTrack track in tracks)
{
if (track.Encoder == AudioEncoder.Ac3Passthrough)
{
track.MixDown = HandBrake.ApplicationServices.Model.Encoding.Mixdown.Ac3Passthrough;
track.Bitrate = 0;
}
if (track.Encoder == AudioEncoder.DtsPassthrough)
{
track.MixDown = HandBrake.ApplicationServices.Model.Encoding.Mixdown.DtsPassthrough;
track.Bitrate = 0;
}
this.audioTracks.Add(track);
}
this.AutomaticTrackSelection();
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
}
/// <summary>
/// Set the Track list dropdown from the parsed title captured during the scan
/// </summary>
/// <param name="selectedTitle">The selected title</param>
/// <param name="preset">A preset</param>
public void SetTrackListFromPreset(Title selectedTitle, Preset preset)
{
if (selectedTitle.AudioTracks.Count == 0)
{
audioList.Rows.Clear();
this.ScannedTracks.Clear();
this.ScannedTracks.Add(AudioHelper.NoneFound);
this.drp_audioTrack.Refresh();
drp_audioTrack.SelectedIndex = 0;
return;
}
// Setup the Audio track source dropdown with the new audio tracks.
this.ScannedTracks.Clear();
this.drp_audioTrack.SelectedItem = null;
foreach (var item in selectedTitle.AudioTracks)
{
this.ScannedTracks.Add(item);
}
drp_audioTrack.SelectedItem = this.ScannedTracks.FirstOrDefault();
this.drp_audioTrack.Refresh();
// 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)
{
EncodeTask parsed = QueryParserUtility.Parse(preset.Query);
foreach (AudioTrack audioTrack in parsed.AudioTracks)
{
audioTrack.ScannedTrack = drp_audioTrack.SelectedItem as Audio;
this.audioTracks.Add(audioTrack);
}
}
this.AutomaticTrackSelection();
}
#endregion
#region Control and ListView
/// <summary>
/// one of the controls has changed. Event handler
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </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)
{
case "drp_audioTrack":
if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0 && drp_audioTrack.SelectedItem != null)
{
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.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.ScannedTrack.Format.Contains("DTS"))
{
// Switch to AAC
drp_audioEncoder.SelectedIndex = 0;
}
}
break;
case "drp_audioEncoder":
SetMixDown(EnumHelper<Mixdown>.GetDescription(track.MixDown));
// Configure the widgets with values
if (drp_audioEncoder.Text.Contains(AC3Passthru) || drp_audioEncoder.Text.Contains(DTSPassthru))
{
drp_audioMix.Enabled = drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = false;
track.Gain = 0;
track.DRC = 0;
}
else
{
drp_audioMix.Enabled = drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = true;
}
// Update an item in the Audio list if required.
track.Encoder = EnumHelper<AudioEncoder>.GetValue(drp_audioEncoder.Text);
break;
case "drp_audioMix":
SetBitrate(track.Bitrate);
if (drp_audioMix.SelectedItem != null)
{
track.MixDown = EnumHelper<Mixdown>.GetValue(drp_audioMix.Text);
}
break;
case "drp_audioSample":
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.
int bitrate;
int.TryParse(drp_audioBitrate.Text, out bitrate);
track.Bitrate = bitrate;
break;
}
audioList.Refresh();
}
/// <summary>
/// The Audio List selected index changed event handler
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void audioList_SelectionChanged(object sender, EventArgs e)
{
// Set the dropdown controls based on the selected item in the Audio List.
if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)
{
AudioTrack track = audioList.SelectedRows[0].DataBoundItem as AudioTrack;
if (track != null)
{
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.SampleRateDisplayValue;
drp_audioBitrate.SelectedItem = track.BitRateDisplayValue;
// Set the Advanced Control.
if (!advancedAudio.IsDisposed)
advancedAudio.Track = track;
}
}
}
#endregion
#region Track Controls
/// <summary>
/// The Add Audio Track button event handler
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void AddAudioTrack_Click(object sender, EventArgs e)
{
if (drp_audioTrack.Text == "None Found")
{
MessageBox.Show(
"Your source appears to have no audio tracks, or no tracks in a format that HandBrake supports.",
"Warning",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return;
}
// Get Some Values
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
{
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,
Bitrate = bitrate,
Gain = 0,
DRC = 0,
};
this.audioTracks.Add(track);
// The Audio List has changed to raise the event.
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
// Select the newly added track and select the control
audioList.ClearSelection();
audioList.Rows[audioList.Rows.Count - 1].Selected = true;
audioList.Select();
}
/// <summary>
/// The Remove Track button event handler
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void RemoveAudioTrack_Click(object sender, EventArgs e)
{
RemoveTrack();
if (this.AudioTracks.Count == 0)
{
drp_audioMix.Enabled =
drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = true;
}
}
#endregion
#region Audio List Menu
/// <summary>
/// The Audio List Move Up menu item
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void AudioList_moveup_Click(object sender, EventArgs e)
{
MoveTrack(true);
}
/// <summary>
/// The audio list move down menu item
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void AudioList_movedown_Click(object sender, EventArgs e)
{
MoveTrack(false);
}
/// <summary>
/// The audio list remove menu item
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void AudioList_remove_Click(object sender, EventArgs e)
{
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
/// <summary>
/// Attempt to automatically select the correct audio tracks based on the users settings.
/// </summary>
private void AutomaticTrackSelection()
{
if (drp_audioTrack.SelectedItem.ToString() == AudioHelper.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")
{
drp_audioTrack.SelectedIndex = 0;
foreach (AudioTrack track in this.audioTracks)
{
if (this.drp_audioTrack.SelectedItem != null)
{
track.ScannedTrack = this.drp_audioTrack.SelectedItem as Audio;
}
}
}
else
{
int mode = Properties.Settings.Default.DubMode;
switch (mode)
{
case 1:
case 3:
// Dub Foreign Language Audio
// Select the prefered language audio, or the first track if it doesn't exist.
int i = 0;
foreach (object item in drp_audioTrack.Items)
{
if (item.ToString().Contains(Properties.Settings.Default.NativeLanguage))
{
drp_audioTrack.SelectedIndex = i;
break;
}
i++;
}
if (drp_audioTrack.SelectedItem != null)
foreach (AudioTrack track in this.audioTracks)
track.ScannedTrack =
drp_audioTrack.SelectedItem as Audio;
else
{
drp_audioTrack.SelectedIndex = 0;
if (drp_audioTrack.SelectedItem != null)
foreach (AudioTrack track in this.audioTracks)
track.ScannedTrack = drp_audioTrack.SelectedItem as Audio;
}
break;
case 2:
default:
// Select the first track which is hopefully the default and foreign track.
drp_audioTrack.SelectedIndex = 0;
if (drp_audioTrack.SelectedItem != null)
foreach (AudioTrack track in this.audioTracks)
track.ScannedTrack = drp_audioTrack.SelectedItem as Audio;
break;
}
}
}
/// <summary>
/// Clear the audio list
/// </summary>
private void ClearAudioList()
{
this.audioTracks.Clear();
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
}
/// <summary>
/// Remove an audio track from the list
/// </summary>
private void RemoveTrack()
{
// Remove the Item and reselect the control if the following conditions are met.
if (audioList.SelectedRows.Count != 0)
{
// The Audio List is about to change so raise the event.
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
// Record the current selected index.
int currentPosition = audioList.SelectedRows[0].Index;
audioList.Rows.Remove(audioList.SelectedRows[0]);
// Now reslect the correct item and give focus to the audio list.
if (audioList.Rows.Count != 0)
{
audioList.ClearSelection();
if (currentPosition <= (audioList.Rows.Count - 1))
audioList.Rows[currentPosition].Selected = true;
else if (currentPosition > (audioList.Rows.Count - 1))
audioList.Rows[audioList.Rows.Count - 1].Selected = true;
audioList.Select();
}
}
}
/// <summary>
/// Move an audio track up or down the audio list
/// </summary>
/// <param name="up">
/// The up.
/// </param>
private void MoveTrack(bool up)
{
if (audioList.SelectedRows.Count == 0) return;
DataGridViewRow item = audioList.SelectedRows[0];
AudioTrack track = item.DataBoundItem as AudioTrack;
int index = item.Index;
if (up) index--;
else index++;
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;
}
}
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;
}
}
/// <summary>
/// Set the bitrate dropdown
/// </summary>
/// <param name="currentValue">
/// The current Value.
/// </param>
private void SetBitrate(int currentValue)
{
int max = 0;
string defaultRate = "160";
// Remove defaults
drp_audioBitrate.Items.Remove("Auto");
drp_audioBitrate.Items.Remove("192");
drp_audioBitrate.Items.Remove("224");
drp_audioBitrate.Items.Remove("256");
drp_audioBitrate.Items.Remove("320");
drp_audioBitrate.Items.Remove("384");
drp_audioBitrate.Items.Remove("448");
drp_audioBitrate.Items.Remove("640");
drp_audioBitrate.Items.Remove("768");
// Find Max and Defaults based on encoders
switch (drp_audioEncoder.Text)
{
case "AAC (faac)":
max = drp_audioMix.Text.Contains("6 Channel") ? 768 : 320;
defaultRate = "160";
break;
case "MP3 (lame)":
max = 320;
defaultRate = "160";
break;
case "Vorbis (vorbis)":
defaultRate = "160";
max = 384;
break;
case "AC3 (ffmpeg)":
defaultRate = "640";
max = 640;
break;
case AC3Passthru:
drp_audioBitrate.Items.Add("Auto");
defaultRate = "Auto";
drp_audioSample.SelectedItem = "Auto";
break;
case DTSPassthru:
drp_audioBitrate.Items.Add("Auto");
defaultRate = "Auto";
drp_audioSample.SelectedItem = "Auto";
break;
}
// Re-add appropiate options
if (max > 160)
{
drp_audioBitrate.Items.Add("192");
drp_audioBitrate.Items.Add("224");
drp_audioBitrate.Items.Add("256");
drp_audioBitrate.Items.Add("320");
}
if (max > 320)
{
drp_audioBitrate.Items.Add("384");
}
if (max >= 640)
{
drp_audioBitrate.Items.Add("448");
drp_audioBitrate.Items.Add("640");
}
if (max == 768)
{
drp_audioBitrate.Items.Add("768");
}
// Set the Current Value, or default value if the value is out of bounds
if (currentValue <= max && currentValue != 0)
{
drp_audioBitrate.SelectedItem = currentValue.ToString();
}
else
{
drp_audioBitrate.SelectedItem = defaultRate;
}
}
/// <summary>
/// Set the mixdown dropdown
/// </summary>
/// <param name="currentMixdown">
/// The current Mixdown.
/// </param>
private void SetMixDown(string currentMixdown)
{
drp_audioMix.Items.Clear();
drp_audioMix.Items.Add("Mono");
drp_audioMix.Items.Add("Stereo");
drp_audioMix.Items.Add("Dolby Surround");
drp_audioMix.Items.Add("Dolby Pro Logic II");
drp_audioMix.Items.Add("6 Channel Discrete");
drp_audioMix.Items.Add(AC3Passthru);
drp_audioMix.Items.Add(DTSPassthru);
switch (drp_audioEncoder.Text)
{
case "AAC (faac)":
drp_audioMix.Items.Remove(AC3Passthru);
drp_audioMix.Items.Remove(DTSPassthru);
drp_audioMix.SelectedItem = currentMixdown ?? "Dolby Pro Logic II";
break;
case "MP3 (lame)":
drp_audioMix.Items.Remove("6 Channel Discrete");
drp_audioMix.Items.Remove(AC3Passthru);
drp_audioMix.Items.Remove(DTSPassthru);
drp_audioMix.SelectedItem = currentMixdown ?? "Dolby Pro Logic II";
break;
case "Vorbis (vorbis)":
drp_audioMix.Items.Remove(AC3Passthru);
drp_audioMix.Items.Remove(DTSPassthru);
drp_audioMix.SelectedItem = currentMixdown ?? "Dolby Pro Logic II";
break;
case "AC3 (ffmpeg)":
drp_audioMix.Items.Remove(AC3Passthru);
drp_audioMix.Items.Remove(DTSPassthru);
drp_audioMix.SelectedItem = currentMixdown ?? "Dolby Pro Logic II";
break;
case "AC3 Passthru":
drp_audioMix.SelectedItem = AC3Passthru;
break;
case "DTS Passthru":
drp_audioMix.SelectedItem = DTSPassthru;
break;
}
if (drp_audioMix.SelectedItem == null)
{
drp_audioMix.SelectedItem = "Dolby Pro Logic II";
}
}
#endregion
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 };
}
advancedAudio.Show();
}
}
}
|