diff options
author | sr55 <[email protected]> | 2015-05-26 20:30:10 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-05-26 20:30:10 +0000 |
commit | 3ca17e6454929d52b65a6e712cb6a99d9e26c2de (patch) | |
tree | 52a4d8aafeffb787f6f17881a900687e61f88de7 /win/CS/HandBrakeWPF/ViewModels | |
parent | 6f6f447ca0b5453964d9f6c94cffed4a81e8d184 (diff) |
WinGui: Adding new dropdown to the Configure Audio Options. The new "Track Setting Default Behaviour" allows the choice of what settings are used for automatically added tracks.
1. All Preset tracks are cloned for each of the added languages tracks.
2. The first preset track is cloned for each of the added languages tracks.
3. Default 160kbit DPL2 AAC audio track for each of the added languages tracks.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7228 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index f568a5ddf..3424b4c09 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -119,6 +119,17 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Gets the audio track default behaviour mode list.
+ /// </summary>
+ public BindingList<AudioTrackDefaultsMode> AudioTrackDefaultBehaviourModeList
+ {
+ get
+ {
+ return new BindingList<AudioTrackDefaultsMode>(EnumHelper<AudioTrackDefaultsMode>.GetEnumList().ToList());
+ }
+ }
+
+ /// <summary>
/// Gets or sets AudioBitrates.
/// </summary>
public IEnumerable<int> AudioBitrates { get; set; }
@@ -240,7 +251,7 @@ namespace HandBrakeWPF.ViewModels public void Add()
{
// Add the first track if available.
- this.Add(null);
+ this.Add(null, false);
}
/// <summary>
@@ -455,14 +466,39 @@ namespace HandBrakeWPF.ViewModels /// <param name="sourceTrack">
/// The source track.
/// </param>
- private void Add(Audio sourceTrack)
+ /// <param name="useBehaviourTemplateMode">
+ /// The use Behaviour Template Mode.
+ /// </param>
+ private void Add(Audio sourceTrack, bool useBehaviourTemplateMode)
{
if (this.SourceTracks != null)
{
Audio track = sourceTrack ?? this.GetPreferredAudioTrack();
if (track != null)
{
- this.Task.AudioTracks.Add(new AudioTrack { ScannedTrack = track });
+ if (!useBehaviourTemplateMode)
+ {
+ this.Task.AudioTracks.Add(new AudioTrack { ScannedTrack = track });
+ return;
+ }
+
+ switch (this.AudioBehaviours.SelectedTrackDefaultBehaviour)
+ {
+ case AudioTrackDefaultsMode.None:
+ this.Task.AudioTracks.Add(new AudioTrack { ScannedTrack = track });
+ break;
+ case AudioTrackDefaultsMode.FirstTrack:
+ AudioTrack template = this.currentPreset.Task.AudioTracks.FirstOrDefault();
+ this.Task.AudioTracks.Add(template != null ? new AudioTrack(template, false) { ScannedTrack = track } : new AudioTrack { ScannedTrack = track });
+ break;
+ case AudioTrackDefaultsMode.AllTracks:
+ foreach (AudioTrack tmpl in this.currentPreset.Task.AudioTracks)
+ {
+ this.Task.AudioTracks.Add(tmpl != null ? new AudioTrack(tmpl, false) { ScannedTrack = track } : new AudioTrack { ScannedTrack = track });
+ }
+
+ break;
+ }
}
}
}
@@ -480,7 +516,7 @@ namespace HandBrakeWPF.ViewModels if (!found)
{
// If it doesn't, add it.
- this.Add(sourceTrack);
+ this.Add(sourceTrack, true);
}
}
}
@@ -510,7 +546,7 @@ namespace HandBrakeWPF.ViewModels // Step 3, Setup the tracks from the preset
foreach (AudioTrack track in this.currentPreset.Task.AudioTracks)
{
- this.Task.AudioTracks.Add(new AudioTrack(track) { ScannedTrack = this.GetPreferredAudioTrack() });
+ this.Task.AudioTracks.Add(new AudioTrack(track, false) { ScannedTrack = this.GetPreferredAudioTrack() });
}
// Step 4, Handle the default selection behaviour.
@@ -552,7 +588,7 @@ namespace HandBrakeWPF.ViewModels }
// If it doesn't, add it.
- this.Add(sourceTrack);
+ this.Add(sourceTrack, true);
}
}
}
@@ -570,7 +606,7 @@ namespace HandBrakeWPF.ViewModels if (!found)
{
// If it doesn't, add it.
- this.Add(sourceTrack);
+ this.Add(sourceTrack, true);
}
}
}
@@ -648,6 +684,7 @@ namespace HandBrakeWPF.ViewModels if (preset != null && preset.AudioTrackBehaviours != null)
{
this.AudioBehaviours.SelectedBehaviour = preset.AudioTrackBehaviours.SelectedBehaviour;
+ this.AudioBehaviours.SelectedTrackDefaultBehaviour = preset.AudioTrackBehaviours.SelectedTrackDefaultBehaviour;
foreach (string selectedItem in preset.AudioTrackBehaviours.SelectedLangauges)
{
|