diff options
author | sr55 <[email protected]> | 2012-01-22 20:45:08 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-01-22 20:45:08 +0000 |
commit | dab8b3b4cfbe05f84bb89fb76252c68c41d3a06f (patch) | |
tree | 4153040ed252f0f5a13a9a8a50c9fd8c7289f2ac /win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | |
parent | 35018826f82041b6ed7bd6b445f07bd64cb178fd (diff) |
WinGui: (WPF) Further work on the Audio and Subtitle tabs along with the API & Utilities.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4418 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 77 |
1 files changed, 73 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index e20e3ae95..b27c14583 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -9,14 +9,19 @@ namespace HandBrakeWPF.ViewModels
{
+ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
+ using System.Linq;
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop.Model.Encoding;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -38,6 +43,10 @@ namespace HandBrakeWPF.ViewModels public AudioViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
this.AudioTracks = new ObservableCollection<AudioTrack>();
+ this.SampleRates = new ObservableCollection<string> { "Auto", "48", "44.1", "32", "24", "22.05" };
+ this.AudioBitrates = this.GetAppropiateBitrates(AudioEncoder.ffaac, Mixdown.DolbyProLogicII);
+ this.AudioEncoders = EnumHelper<AudioEncoder>.GetEnumList();
+ this.AudioMixdowns = EnumHelper<Mixdown>.GetEnumList();
}
/// <summary>
@@ -46,28 +55,88 @@ namespace HandBrakeWPF.ViewModels public ObservableCollection<AudioTrack> AudioTracks { get; set; }
/// <summary>
+ /// Gets or sets SourceTracks.
+ /// </summary>
+ public IEnumerable<Audio> SourceTracks { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioEncoders.
+ /// </summary>
+ public IEnumerable<AudioEncoder> AudioEncoders { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioMixdowns.
+ /// </summary>
+ public IEnumerable<Mixdown> AudioMixdowns { get; set; }
+
+ /// <summary>
+ /// Gets or sets SampleRates.
+ /// </summary>
+ public IEnumerable<string> SampleRates { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioBitrates.
+ /// </summary>
+ public IEnumerable<int> AudioBitrates { get; set; }
+
+ /// <summary>
/// Add an Audio Track
/// </summary>
public void Add()
{
- this.AudioTracks.Add(new AudioTrack());
+ if (SourceTracks != null)
+ {
+ Audio track = this.SourceTracks.FirstOrDefault();
+ if (track != null)
+ {
+ this.AudioTracks.Add(new AudioTrack { ScannedTrack = track });
+ }
+ }
}
/// <summary>
/// Remove the Selected Track
/// </summary>
- public void Remove()
+ /// <param name="track">
+ /// The track.
+ /// </param>
+ public void Remove(AudioTrack track)
{
+ this.AudioTracks.Remove(track);
}
/// <summary>
- /// Set the selected preset.
+ /// Set the Source Title
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- public void SetPreset(Preset preset)
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetSource(Title title, Preset preset, EncodeTask task)
+ {
+ this.SourceTracks = title.AudioTracks;
+ }
+
+ /// <summary>
+ /// Get Appropiate Bitrates for the selected encoder and mixdown.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder.
+ /// </param>
+ /// <param name="mixdown">
+ /// The mixdown.
+ /// </param>
+ /// <returns>
+ /// A List of valid audio bitrates
+ /// </returns>
+ private IEnumerable<int> GetAppropiateBitrates(AudioEncoder encoder, Mixdown mixdown)
{
+ return new ObservableCollection<int> { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160 };
}
}
}
|