diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs | 164 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 19 |
2 files changed, 126 insertions, 57 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs index a79902099..70de20c67 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs @@ -10,9 +10,12 @@ namespace HandBrakeWPF.ViewModels { using System.Collections.Generic; + using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; + using HandBrake.ApplicationServices.Interop; + using HandBrake.ApplicationServices.Interop.Model.Encoding; using HandBrake.ApplicationServices.Utilities; using HandBrakeWPF.Model.Audio; @@ -30,7 +33,6 @@ namespace HandBrakeWPF.ViewModels private BindingList<string> availableLanguages; private AudioBehaviours audioBehaviours; private EncodeTask task; - #region Constructors and Destructors /// <summary> @@ -47,6 +49,13 @@ namespace HandBrakeWPF.ViewModels this.SelectedLangaugesToMove = new BindingList<string>(); this.AvailableLanguages = new BindingList<string>(); this.AudioEncoders = EnumHelper<AudioEncoder>.GetEnumList(); + this.Mixdowns = new BindingList<HBMixdown>(HandBrakeEncoderHelpers.Mixdowns); + + this.SampleRates = new ObservableCollection<string> { "Auto" }; + foreach (var item in HandBrakeEncoderHelpers.AudioSampleRates) + { + this.SampleRates.Add(item.Name); + } this.Setup((Preset)null, task); } @@ -76,9 +85,20 @@ namespace HandBrakeWPF.ViewModels } /// <summary> - /// Gets or sets AudioEncoders. + /// Gets or sets the list of audio tracks we will use as templates for generating tracks for a given source. /// </summary> - public IEnumerable<AudioEncoder> AudioEncoders { get; set; } + public BindingList<AudioBehaviourTrack> BehaviourTracks + { + get + { + return this.AudioBehaviours.BehaviourTracks; + } + set + { + this.AudioBehaviours.BehaviourTracks = value; + this.NotifyOfPropertyChange(() => this.BehaviourTracks); + } + } /// <summary> /// Gets the audio behaviours. @@ -102,45 +122,6 @@ namespace HandBrakeWPF.ViewModels } /// <summary> - /// Gets the audio behaviour modes. - /// </summary> - public BindingList<AudioBehaviourModes> AudioBehaviourModeList - { - get - { - return new BindingList<AudioBehaviourModes>(EnumHelper<AudioBehaviourModes>.GetEnumList().ToList()); - } - } - - /// <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 AvailableLanguages. - /// </summary> - public BindingList<string> AvailableLanguages - { - get - { - return this.availableLanguages; - } - - private set - { - this.availableLanguages = value; - this.NotifyOfPropertyChange("AvailableLanguages"); - } - } - - /// <summary> /// Gets SelectedLangauges. /// </summary> public BindingList<string> SelectedAvailableToMove { get; private set; } @@ -308,9 +289,100 @@ namespace HandBrakeWPF.ViewModels #endregion + #region Data Properties + + /// <summary> + /// Gets the audio behaviour modes. + /// </summary> + public BindingList<AudioBehaviourModes> AudioBehaviourModeList + { + get + { + return new BindingList<AudioBehaviourModes>(EnumHelper<AudioBehaviourModes>.GetEnumList().ToList()); + } + } + + /// <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 AvailableLanguages. + /// </summary> + public BindingList<string> AvailableLanguages + { + get + { + return this.availableLanguages; + } + + private set + { + this.availableLanguages = value; + this.NotifyOfPropertyChange("AvailableLanguages"); + } + } + + /// <summary> + /// Gets or sets AudioEncoders. + /// </summary> + public IEnumerable<AudioEncoder> AudioEncoders { get; set; } + + /// <summary> + /// Gets or sets AudioEncoders. + /// </summary> + public IEnumerable<HBMixdown> Mixdowns { get; set; } + + + /// <summary> + /// Gets or sets AudioBitrates. + /// </summary> + public IEnumerable<int> AudioBitrates { get; set; } + + /// <summary> + /// Gets or sets SampleRates. + /// </summary> + public IList<string> SampleRates { get; set; } + + #endregion + #region Public Methods /// <summary> + /// Add a new behaviour track. + /// </summary> + public void AddTrack() + { + this.BehaviourTracks.AddNew(); + } + + /// <summary> + /// Clear all the behaviour tracks + /// </summary> + public void ClearTracks() + { + this.BehaviourTracks.Clear(); + } + + /// <summary> + /// Remove the Selected Track + /// </summary> + /// <param name="track"> + /// The track. + /// </param> + public void RemoveTrack(AudioBehaviourTrack track) + { + this.BehaviourTracks.Remove(track); + } + + /// <summary> /// Audio List Move Left /// </summary> public void LanguageMoveRight() @@ -376,8 +448,7 @@ namespace HandBrakeWPF.ViewModels public void Setup(Preset preset, EncodeTask task) { // Reset - this.AudioBehaviours.SelectedBehaviour = AudioBehaviourModes.None; - this.AudioBehaviours.SelectedLangauges.Clear(); + this.AudioBehaviours = new AudioBehaviours(); // Setup for this Encode Task. this.Task = task; @@ -403,6 +474,11 @@ namespace HandBrakeWPF.ViewModels this.AudioBehaviours.SelectedBehaviour = behaviours.SelectedBehaviour; this.AudioBehaviours.SelectedTrackDefaultBehaviour = behaviours.SelectedTrackDefaultBehaviour; + foreach (AudioBehaviourTrack item in preset.AudioTrackBehaviours.BehaviourTracks) + { + this.AudioBehaviours.BehaviourTracks.Add(new AudioBehaviourTrack(item)); + } + foreach (string selectedItem in behaviours.SelectedLangauges) { this.AvailableLanguages.Remove(selectedItem); diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 86f8b36d2..2706e8e83 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -79,11 +79,6 @@ namespace HandBrakeWPF.ViewModels public IAudioDefaultsViewModel AudioDefaultsViewModel { get; set; }
/// <summary>
- /// Gets or sets AudioBitrates.
- /// </summary>
- public IEnumerable<int> AudioBitrates { get; set; }
-
- /// <summary>
/// Gets or sets AudioEncoders.
/// </summary>
public IEnumerable<AudioEncoder> AudioEncoders { get; set; }
@@ -343,13 +338,13 @@ namespace HandBrakeWPF.ViewModels 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 });
+ AudioBehaviourTrack template = this.currentPreset.AudioTrackBehaviours.BehaviourTracks.FirstOrDefault();
+ this.Task.AudioTracks.Add(template != null ? new AudioTrack(template) { ScannedTrack = track } : new AudioTrack { ScannedTrack = track });
break;
case AudioTrackDefaultsMode.AllTracks:
- foreach (AudioTrack tmpl in this.currentPreset.Task.AudioTracks)
+ foreach (AudioBehaviourTrack tmpl in this.currentPreset.AudioTrackBehaviours.BehaviourTracks)
{
- this.Task.AudioTracks.Add(tmpl != null ? new AudioTrack(tmpl, false) { ScannedTrack = track } : new AudioTrack { ScannedTrack = track });
+ this.Task.AudioTracks.Add(tmpl != null ? new AudioTrack(tmpl) { ScannedTrack = track } : new AudioTrack { ScannedTrack = track });
}
break;
@@ -399,9 +394,9 @@ namespace HandBrakeWPF.ViewModels }
// Step 3, Setup the tracks from the preset
- foreach (AudioTrack track in this.currentPreset.Task.AudioTracks)
+ foreach (AudioBehaviourTrack track in this.currentPreset.AudioTrackBehaviours.BehaviourTracks)
{
- this.Task.AudioTracks.Add(new AudioTrack(track, false) { ScannedTrack = this.GetPreferredAudioTrack() });
+ this.Task.AudioTracks.Add(new AudioTrack(track) { ScannedTrack = this.GetPreferredAudioTrack() });
}
// Step 4, Handle the default selection behaviour.
@@ -517,8 +512,6 @@ namespace HandBrakeWPF.ViewModels return trackList;
}
-
-
#endregion
}
}
\ No newline at end of file |