diff options
15 files changed, 204 insertions, 118 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index c3f86fb4d..8d023b901 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -169,7 +169,6 @@ <Compile Include="Interop\Model\Encoding\HBMixdown.cs" />
<Compile Include="Interop\Model\Encoding\HBRate.cs" />
<Compile Include="Interop\Model\Encoding\HBVideoEncoder.cs" />
- <Compile Include="Interop\Model\Encoding\Mixdown.cs" />
<Compile Include="Interop\Model\Encoding\PictureRotation.cs" />
<Compile Include="Interop\Model\Encoding\ScaleMethod.cs" />
<Compile Include="Interop\Model\Encoding\VideoEncoder.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs index 67f1c5483..9de57c2be 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -392,6 +392,22 @@ namespace HandBrake.ApplicationServices.Interop }
/// <summary>
+ /// Determines if a mixdown is available for a given track and encoder.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The mixdown to evaluate.
+ /// </param>
+ /// <param name="encoder">
+ /// The encoder to evaluate.
+ /// </param>
+ /// <param name="channelLayout">channel layout of the source track</param>
+ /// <returns>True if available.</returns>
+ public static bool MixdownIsSupported(HBMixdown mixdown, HBAudioEncoder encoder, int channelLayout)
+ {
+ return HBFunctions.hb_mixdown_is_supported(mixdown.Id, (uint)encoder.Id, (uint)channelLayout) > 0;
+ }
+
+ /// <summary>
/// Determines if DRC can be applied to the given track with the given encoder.
/// </summary>
/// <param name="trackNumber">
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/AudioList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/AudioList.cs index d77825fa6..8ad95d173 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/AudioList.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/AudioList.cs @@ -35,7 +35,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Presets public string AudioEncoder { get; set; }
/// <summary>
- /// Gets or sets the audio mixdown.
+ /// Gets or sets the audio mixdown. (ShortName)
/// </summary>
public string AudioMixdown { get; set; }
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs deleted file mode 100644 index 66a2d4e1a..000000000 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs +++ /dev/null @@ -1,68 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="Mixdown.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// Defines the Mixdown type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Interop.Model.Encoding
-{
- using System.ComponentModel.DataAnnotations;
- using HandBrake.ApplicationServices.Attributes;
-
- /// <summary>
- /// The Audio Mixdown Enumeration
- /// </summary>
- public enum Mixdown
- {
- [Display(Name = "Dolby Pro Logic II")]
- [ShortName("dpl2")]
- DolbyProLogicII = 0,
-
- [Display(Name = "None")]
- [ShortName("none")]
- None,
-
- [Display(Name = "Automatic")]
- [ShortName("none")]
- Auto,
-
- [Display(Name = "Mono")]
- [ShortName("mono")]
- Mono,
-
- [Display(Name = "Mono (Left Only)")]
- [ShortName("left_only")]
- LeftOnly,
-
- [Display(Name = "Mono (Right Only)")]
- [ShortName("right_only")]
- RightOnly,
-
- [Display(Name = "Stereo")]
- [ShortName("stereo")]
- Stereo,
-
- [Display(Name = "Dolby Surround")]
- [ShortName("dpl1")]
- DolbySurround,
-
- [Display(Name = "5.1 Channels")]
- [ShortName("5point1")]
- FivePoint1Channels,
-
- [Display(Name = "6.1 Channels")]
- [ShortName("6point1")]
- SixPoint1Channels,
-
- [Display(Name = "7.1 Channels")]
- [ShortName("7point1")]
- SevenPoint1Channels,
-
- [Display(Name = "7.1 (5F/2R/LFE)")]
- [ShortName("5_2_lfe")]
- Five_2_LFE,
- }
-}
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownConverter.cs new file mode 100644 index 000000000..e1a371743 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownConverter.cs @@ -0,0 +1,61 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="AudioMixdownConverter.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the AudioMixdownConverter type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Audio +{ + using System.Globalization; + using System.Windows.Data; + using System; + + using HandBrake.ApplicationServices.Interop; + using HandBrake.ApplicationServices.Interop.Model.Encoding; + + /// <summary> + /// The audio mixdown converter. + /// Handles conversion between HBMixdown and it's shortname. + /// </summary> + public class AudioMixdownConverter : IValueConverter + { + /// <summary> + /// Converts a value. + /// </summary> + /// <returns> + /// A converted value. If the method returns null, the valid null value is used. + /// </returns> + /// <param name="value">The value produced by the binding source.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param> + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + string mixdown = value as string; + if (!string.IsNullOrEmpty(mixdown)) + { + return HandBrakeEncoderHelpers.GetMixdown(mixdown); + } + + return HandBrakeEncoderHelpers.GetMixdown("dpl2"); // Default + } + + /// <summary> + /// Converts a value. + /// </summary> + /// <returns> + /// A converted value. If the method returns null, the valid null value is used. + /// </returns> + /// <param name="value">The value that is produced by the binding target.</param><param name="targetType">The type to convert to.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param> + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + HBMixdown mixdown = value as HBMixdown; + if (mixdown != null) + { + return mixdown.ShortName; + } + + return "none"; + } + } +} diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownListConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownListConverter.cs new file mode 100644 index 000000000..cad01f88a --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownListConverter.cs @@ -0,0 +1,75 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="AudioMixdownListConverter.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the AudioMixdownListConverter type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Audio +{ + using System.Globalization; + using System.Windows.Data; + using System; + using System.ComponentModel; + + using HandBrake.ApplicationServices.Interop; + using HandBrake.ApplicationServices.Interop.Model.Encoding; + + using HandBrakeWPF.Services.Encode.Model.Models; + using HandBrakeWPF.Utilities; + + /// <summary> + /// The audio mixdown converter. + /// Returns the list of available mixdowns for the given track and encoder. + /// </summary> + public class AudioMixdownListConverter : IValueConverter + { + /// <summary> + /// Converts a value. + /// </summary> + /// <returns> + /// A converted value. If the method returns null, the valid null value is used. + /// </returns> + /// <param name="value">The value produced by the binding source.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param> + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + AudioTrack track = value as AudioTrack; + if (track != null && track.ScannedTrack != null) + { + HBAudioEncoder encoder = + HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(track.Encoder)); + + BindingList<HBMixdown> mixdowns = new BindingList<HBMixdown>(); + foreach (HBMixdown mixdown in HandBrakeEncoderHelpers.Mixdowns) + { + if (HandBrakeEncoderHelpers.MixdownIsSupported( + mixdown, + encoder, + track.ScannedTrack.ChannelLayout)) + { + mixdowns.Add(mixdown); + } + } + + return mixdowns; + } + + return value; + } + + /// <summary> + /// Converts a value. + /// </summary> + /// <returns> + /// A converted value. If the method returns null, the valid null value is used. + /// </returns> + /// <param name="value">The value that is produced by the binding target.</param><param name="targetType">The type to convert to.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param> + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + + return value; + } + } +} diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index a25cd1100..b803e1126 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -58,10 +58,6 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<VideoEncoder>.GetEnumDisplayValues(typeof(VideoEncoder));
}
- if (value is IEnumerable<Mixdown>)
- {
- return EnumHelper<Mixdown>.GetEnumDisplayValues(typeof(Mixdown));
- }
if (value is IEnumerable<PresetPictureSettingsMode>)
{
return EnumHelper<PresetPictureSettingsMode>.GetEnumDisplayValues(typeof(PresetPictureSettingsMode));
@@ -103,12 +99,7 @@ namespace HandBrakeWPF.Converters if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))
{
return EnumHelper<VideoEncoder>.GetDisplay((VideoEncoder)value);
- }
- if (targetType == typeof(Mixdown) || value.GetType() == typeof(Mixdown))
- {
- return EnumHelper<Mixdown>.GetDisplay((Mixdown)value);
- }
-
+ }
if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))
{
return EnumHelper<PresetPictureSettingsMode>.GetDisplay((PresetPictureSettingsMode)value);
@@ -183,10 +174,6 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<VideoEncoder>.GetValue(value.ToString());
}
- if (targetType == typeof(Mixdown) || value.GetType() == typeof(Mixdown))
- {
- return EnumHelper<Mixdown>.GetValue(value.ToString());
- }
if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))
{
return EnumHelper<PresetPictureSettingsMode>.GetValue(value.ToString());
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 797663f9b..4ba16c677 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -148,6 +148,8 @@ <Compile Include="Controls\AlertPanel.xaml.cs">
<DependentUpon>AlertPanel.xaml</DependentUpon>
</Compile>
+ <Compile Include="Converters\Audio\AudioMixdownListConverter.cs" />
+ <Compile Include="Converters\Audio\AudioMixdownConverter.cs" />
<Compile Include="Converters\Audio\AudioRateTypeConverter.cs" />
<Compile Include="Converters\Audio\AudioTrackDefaultBehaviourConverter.cs" />
<Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs index cd4fbb44f..ea90a50f3 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs @@ -339,7 +339,7 @@ namespace HandBrakeWPF.Services.Encode.Factories HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(item.Encoder)); Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder); - HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(EnumHelper<Mixdown>.GetShortName(item.MixDown)); + HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(item.MixDown); Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + item.MixDown); HBRate sampleRate = HandBrakeEncoderHelpers.AudioSampleRates.FirstOrDefault(s => s.Name == item.SampleRate.ToString(CultureInfo.InvariantCulture)); diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs index 87e6caaaa..b875df16c 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs @@ -34,7 +34,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models private double drc; private HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder encoder; private int gain; - private Mixdown mixDown; + private string mixDown; private double sampleRate; [NonSerialized] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -52,7 +52,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models { // Default Values this.Encoder = HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffaac; - this.MixDown = Mixdown.DolbyProLogicII; + this.MixDown = HandBrakeEncoderHelpers.Mixdowns.FirstOrDefault(m => m.ShortName == "dpl2")?.ShortName; this.SampleRate = 48; this.Bitrate = 160; this.DRC = 0; @@ -137,13 +137,13 @@ namespace HandBrakeWPF.Services.Encode.Model.Models } /// <summary> - /// Gets or sets Audio Mixdown + /// Gets or sets Audio Mixdown (ShortName) /// </summary> - public Mixdown MixDown + public string MixDown { get { - return this.IsPassthru ? Mixdown.Auto : this.mixDown; + return this.IsPassthru ? null : this.mixDown; } set @@ -151,7 +151,6 @@ namespace HandBrakeWPF.Services.Encode.Model.Models this.mixDown = value; this.NotifyOfPropertyChange(() => this.MixDown); this.SetupLimits(); - this.NotifyOfPropertyChange(() => this.TrackReference); } } @@ -173,8 +172,9 @@ namespace HandBrakeWPF.Services.Encode.Model.Models this.NotifyOfPropertyChange(() => this.IsBitrateVisible); this.NotifyOfPropertyChange(() => this.IsQualityVisible); this.NotifyOfPropertyChange(() => this.IsRateTypeVisible); - this.SetupLimits(); this.NotifyOfPropertyChange(() => this.TrackReference); + this.GetDefaultMixdownIfNull(); + this.SetupLimits(); // Refresh the available encoder rate types. this.NotifyOfPropertyChange(() => this.AudioEncoderRateTypes); @@ -200,7 +200,6 @@ namespace HandBrakeWPF.Services.Encode.Model.Models this.sampleRate = value; this.NotifyOfPropertyChange(() => this.SampleRate); this.SetupLimits(); - this.NotifyOfPropertyChange(() => this.TrackReference); } } @@ -283,18 +282,6 @@ namespace HandBrakeWPF.Services.Encode.Model.Models } /// <summary> - /// Gets AudioMixdownDisplayValue. - /// </summary> - [JsonIgnore] - public string AudioMixdownDisplayValue - { - get - { - return EnumHelper<Mixdown>.GetDisplay(this.MixDown); - } - } - - /// <summary> /// Gets the The UI display value for bit rate /// </summary> [JsonIgnore] @@ -369,6 +356,9 @@ namespace HandBrakeWPF.Services.Encode.Model.Models { this.scannedTrack = value; this.NotifyOfPropertyChange(() => this.ScannedTrack); + this.NotifyOfPropertyChange(() => this.TrackReference); + + this.GetDefaultMixdownIfNull(); } } @@ -550,7 +540,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models // Based on the users settings, find the high and low bitrates. HBAudioEncoder hbaenc = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder>.GetShortName(this.Encoder)); HBRate rate = HandBrakeEncoderHelpers.AudioSampleRates.FirstOrDefault(t => t.Name == this.SampleRate.ToString(CultureInfo.InvariantCulture)); - HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(EnumHelper<Mixdown>.GetShortName(this.MixDown)); + HBMixdown mixdown = this.mixDown != null ? HandBrakeEncoderHelpers.GetMixdown(this.mixDown) : HandBrakeEncoderHelpers.GetMixdown("dpl2"); BitrateLimits limits = HandBrakeEncoderHelpers.GetBitrateLimits(hbaenc, rate != null ? rate.Rate : 48000, mixdown); if (limits != null) @@ -632,6 +622,22 @@ namespace HandBrakeWPF.Services.Encode.Model.Models this.NotifyOfPropertyChange(() => this.EncoderQualityValues); } + /// <summary> + /// Set the default mixdown when the mixdown is null or "none" + /// </summary> + private void GetDefaultMixdownIfNull() + { + if ((this.mixDown == null || this.mixDown == "none" ) && this.ScannedTrack != null) + { + HBAudioEncoder aencoder = + HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.encoder)); + + HBMixdown mixdown = HandBrakeEncoderHelpers.GetDefaultMixdown(aencoder, (uint)this.ScannedTrack.ChannelLayout); + + this.MixDown = mixdown.ShortName; + } + } + #endregion } }
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index 7bcbc6a08..c8331076b 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -14,6 +14,7 @@ namespace HandBrakeWPF.Services.Presets.Factories using System.Globalization;
using System.Linq;
+ using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Json.Presets;
using HandBrake.ApplicationServices.Interop.Model;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
@@ -399,7 +400,7 @@ namespace HandBrakeWPF.Services.Presets.Factories // track.CompressionLevel = audioTrack.AudioCompressionLevel;
// track.AudioDitherMethod = audioTrack.AudioDitherMethod;
track.Encoder = EnumHelper<AudioEncoder>.GetValue(audioTrack.AudioEncoder);
- track.MixDown = EnumHelper<Mixdown>.GetValue(audioTrack.AudioMixdown);
+ track.MixDown = audioTrack.AudioMixdown;
// track.AudioNormalizeMixLevel = audioTrack.AudioNormalizeMixLevel;
track.SampleRate = audioTrack.AudioSamplerate == "auto" ? 0 : double.Parse(audioTrack.AudioSamplerate);
@@ -540,7 +541,7 @@ namespace HandBrakeWPF.Services.Presets.Factories AudioCompressionLevel = 0, // TODO
AudioDitherMethod = null, // TODO
AudioEncoder = EnumHelper<AudioEncoder>.GetShortName(item.Encoder),
- AudioMixdown = EnumHelper<Mixdown>.GetShortName(item.MixDown),
+ AudioMixdown = item.MixDown,
AudioNormalizeMixLevel = false, // TODO
AudioSamplerate = item.SampleRate == 0 ? "auto" : item.SampleRate.ToString(), // TODO check formatting.
AudioTrackDRCSlider = item.DRC,
diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index d72593cff..23d38af4e 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -384,7 +384,8 @@ namespace HandBrakeWPF.Services.Scan int currentAudioTrack = 1; foreach (SourceAudioTrack track in title.AudioList) { - converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate)); + + converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate, track.ChannelLayout)); currentAudioTrack++; } diff --git a/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs b/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs index 1f0a2af98..ca2841bee 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs @@ -48,8 +48,12 @@ namespace HandBrakeWPF.Services.Scan.Model /// <param name="bitrate"> /// The bitrate. /// </param> - public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate) + /// <param name="channelLayout"> + /// The channel Layout. + /// </param> + public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate, int channelLayout) { + this.ChannelLayout = channelLayout; this.TrackNumber = trackNumber; this.Language = language; this.LanguageCode = languageCode; @@ -95,6 +99,11 @@ namespace HandBrakeWPF.Services.Scan.Model public int Bitrate { get; set; } /// <summary> + /// Gets or sets the channel layout of the source track (mixdown) + /// </summary> + public int ChannelLayout { get; set; } + + /// <summary> /// Override of the ToString method to make this object easier to use in the UI /// </summary> /// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns> diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 8dba8fc89..04115d5b8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -76,7 +76,6 @@ namespace HandBrakeWPF.ViewModels }
this.AudioEncoders = EnumHelper<AudioEncoder>.GetEnumList();
- this.AudioMixdowns = EnumHelper<Mixdown>.GetEnumList();
this.SourceTracks = new List<Audio>();
}
@@ -100,11 +99,6 @@ namespace HandBrakeWPF.ViewModels 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 IList<string> SampleRates { get; set; }
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index ada1069ac..8620646da 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -22,6 +22,8 @@ <Conveters:BooleanToHiddenVisibilityConverter x:Key="boolToHiddenVisConverter" />
<Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />
<Audio:AudioRateTypeConverter x:Key="audioRateTypeConverter" />
+ <Audio:AudioMixdownConverter x:Key="audioMixdownConverter" />
+ <Audio:AudioMixdownListConverter x:Key="audioMixdownListConverter" />
</UserControl.Resources>
<Grid>
@@ -201,8 +203,9 @@ <TextBlock Grid.Row="0" Grid.Column="6" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Mixdown}"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<ComboBox Grid.Row="0" Grid.Column="7" Height="22" Width="120" Margin="5,0,5,0" HorizontalAlignment="Stretch"
- ItemsSource="{Binding DataContext.AudioMixdowns, Converter={StaticResource enumComboConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
- SelectedItem="{Binding MixDown, Converter={StaticResource enumComboConverter}}"
+ ItemsSource="{Binding TrackReference, Converter={StaticResource audioMixdownListConverter}}"
+ SelectedItem="{Binding MixDown, Converter={StaticResource audioMixdownConverter}}"
+ DisplayMemberPath="DisplayName"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
|