]> granicus.if.org Git - handbrake/commitdiff
WinGui: Use Mixdowns from LibHBand sanitise the choices. The GUI no longer shows...
authorsr55 <sr55.hb@outlook.com>
Sat, 9 Apr 2016 13:46:54 +0000 (14:46 +0100)
committersr55 <sr55.hb@outlook.com>
Sat, 9 Apr 2016 13:46:54 +0000 (14:46 +0100)
15 files changed:
win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/AudioList.cs
win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs [deleted file]
win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownConverter.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownListConverter.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
win/CS/HandBrakeWPF/HandBrakeWPF.csproj
win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs
win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs
win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
win/CS/HandBrakeWPF/Views/AudioView.xaml

index c3f86fb4d437aa988f7a1bbd130c7499878f0678..8d023b901761fd01dc68111474d0af1c64d9991d 100644 (file)
     <Compile Include="Interop\Model\Encoding\HBMixdown.cs" />\r
     <Compile Include="Interop\Model\Encoding\HBRate.cs" />\r
     <Compile Include="Interop\Model\Encoding\HBVideoEncoder.cs" />\r
-    <Compile Include="Interop\Model\Encoding\Mixdown.cs" />\r
     <Compile Include="Interop\Model\Encoding\PictureRotation.cs" />\r
     <Compile Include="Interop\Model\Encoding\ScaleMethod.cs" />\r
     <Compile Include="Interop\Model\Encoding\VideoEncoder.cs" />\r
index 67f1c5483b86dd8686f3b73ea7ec1578a71a94f4..9de57c2be86b1a613f4fff7fd3f26ab9f23cab34 100644 (file)
@@ -391,6 +391,22 @@ namespace HandBrake.ApplicationServices.Interop
             return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0;\r
         }\r
 \r
+        /// <summary>\r
+        /// Determines if a mixdown is available for a given track and encoder.\r
+        /// </summary>\r
+        /// <param name="mixdown">\r
+        /// The mixdown to evaluate.\r
+        /// </param>\r
+        /// <param name="encoder">\r
+        /// The encoder to evaluate.\r
+        /// </param>\r
+        /// <param name="channelLayout">channel layout of the source track</param>\r
+        /// <returns>True if available.</returns>\r
+        public static bool MixdownIsSupported(HBMixdown mixdown, HBAudioEncoder encoder, int channelLayout)\r
+        {\r
+            return HBFunctions.hb_mixdown_is_supported(mixdown.Id, (uint)encoder.Id, (uint)channelLayout) > 0;\r
+        }\r
+\r
         /// <summary>\r
         /// Determines if DRC can be applied to the given track with the given encoder.\r
         /// </summary>\r
index d77825fa6a79b9821af4676a362520b1e9fbe6dc..8ad95d173becd856dbbbb4de8482758f5bfce5db 100644 (file)
@@ -35,7 +35,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Presets
         public string AudioEncoder { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets the audio mixdown.\r
+        /// Gets or sets the audio mixdown. (ShortName)\r
         /// </summary>\r
         public string AudioMixdown { get; set; }\r
 \r
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 (file)
index 66a2d4e..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="Mixdown.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   Defines the Mixdown type.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Encoding\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-    using HandBrake.ApplicationServices.Attributes;\r
-\r
-    /// <summary>\r
-    /// The Audio Mixdown Enumeration\r
-    /// </summary>\r
-    public enum Mixdown\r
-    {\r
-        [Display(Name = "Dolby Pro Logic II")]\r
-        [ShortName("dpl2")]\r
-        DolbyProLogicII = 0,\r
-\r
-        [Display(Name = "None")]\r
-        [ShortName("none")]\r
-        None,\r
-\r
-        [Display(Name = "Automatic")]\r
-        [ShortName("none")]\r
-        Auto,\r
-\r
-        [Display(Name = "Mono")]\r
-        [ShortName("mono")]\r
-        Mono,\r
-\r
-        [Display(Name = "Mono (Left Only)")]\r
-        [ShortName("left_only")]\r
-        LeftOnly,\r
-\r
-        [Display(Name = "Mono (Right Only)")]\r
-        [ShortName("right_only")]\r
-        RightOnly,\r
-\r
-        [Display(Name = "Stereo")]\r
-        [ShortName("stereo")]\r
-        Stereo,\r
-\r
-        [Display(Name = "Dolby Surround")]\r
-        [ShortName("dpl1")]\r
-        DolbySurround,\r
-\r
-        [Display(Name = "5.1 Channels")]\r
-        [ShortName("5point1")]\r
-        FivePoint1Channels,\r
-\r
-        [Display(Name = "6.1 Channels")]\r
-        [ShortName("6point1")]\r
-        SixPoint1Channels,\r
-\r
-        [Display(Name = "7.1 Channels")]\r
-        [ShortName("7point1")]\r
-        SevenPoint1Channels,\r
-\r
-        [Display(Name = "7.1 (5F/2R/LFE)")]\r
-        [ShortName("5_2_lfe")]\r
-        Five_2_LFE,\r
-    }\r
-}\r
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioMixdownConverter.cs
new file mode 100644 (file)
index 0000000..e1a3717
--- /dev/null
@@ -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 (file)
index 0000000..cad01f8
--- /dev/null
@@ -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;
+        }
+    }
+}
index a25cd1100410178fb01090b18899e9328ebcff0f..b803e112628cdef0d75eb530f5fc8aade75a6cee 100644 (file)
@@ -58,10 +58,6 @@ namespace HandBrakeWPF.Converters
             {\r
                 return EnumHelper<VideoEncoder>.GetEnumDisplayValues(typeof(VideoEncoder));\r
             }\r
-            if (value is IEnumerable<Mixdown>)\r
-            {\r
-                return EnumHelper<Mixdown>.GetEnumDisplayValues(typeof(Mixdown));\r
-            }\r
             if (value is IEnumerable<PresetPictureSettingsMode>)\r
             {\r
                 return EnumHelper<PresetPictureSettingsMode>.GetEnumDisplayValues(typeof(PresetPictureSettingsMode));\r
@@ -103,12 +99,7 @@ namespace HandBrakeWPF.Converters
             if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))\r
             {\r
                 return EnumHelper<VideoEncoder>.GetDisplay((VideoEncoder)value);\r
-            }\r
-            if (targetType == typeof(Mixdown) || value.GetType() == typeof(Mixdown))\r
-            {\r
-                return EnumHelper<Mixdown>.GetDisplay((Mixdown)value);\r
-            }\r
-  \r
+            } \r
             if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))\r
             {\r
                 return EnumHelper<PresetPictureSettingsMode>.GetDisplay((PresetPictureSettingsMode)value);\r
@@ -183,10 +174,6 @@ namespace HandBrakeWPF.Converters
             {\r
                 return EnumHelper<VideoEncoder>.GetValue(value.ToString());\r
             }\r
-            if (targetType == typeof(Mixdown) || value.GetType() == typeof(Mixdown))\r
-            {\r
-                return EnumHelper<Mixdown>.GetValue(value.ToString());\r
-            }\r
             if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))\r
             {\r
                 return EnumHelper<PresetPictureSettingsMode>.GetValue(value.ToString());\r
index 797663f9b16d46f618240a989c8180e7a9c4c637..4ba16c6779d89a1e40a51ca2ac9b75a92c3051f1 100644 (file)
     <Compile Include="Controls\AlertPanel.xaml.cs">\r
       <DependentUpon>AlertPanel.xaml</DependentUpon>\r
     </Compile>\r
+    <Compile Include="Converters\Audio\AudioMixdownListConverter.cs" />\r
+    <Compile Include="Converters\Audio\AudioMixdownConverter.cs" />\r
     <Compile Include="Converters\Audio\AudioRateTypeConverter.cs" />\r
     <Compile Include="Converters\Audio\AudioTrackDefaultBehaviourConverter.cs" />\r
     <Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />\r
index cd4fbb44f71d1e24456693bf32a327bc99bf3bc5..ea90a50f3e6de1144cb34952c566be8be71c33c2 100644 (file)
@@ -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));
index 87e6caaaa6c1f24f83f2fdf722aa5b2adc3a2898..b875df16cdb5d2f88dbd47c2974f83be110bdd2e 100644 (file)
@@ -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);
             }
         }
 
@@ -282,18 +281,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>
@@ -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
index 7bcbc6a08043b1bd3a7a0e046db04451c1c5e47c..c8331076b77766ad8bdbb1f0e5616876d8613c7a 100644 (file)
@@ -14,6 +14,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
     using System.Globalization;\r
     using System.Linq;\r
 \r
+    using HandBrake.ApplicationServices.Interop;\r
     using HandBrake.ApplicationServices.Interop.Json.Presets;\r
     using HandBrake.ApplicationServices.Interop.Model;\r
     using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
@@ -399,7 +400,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
                     // track.CompressionLevel = audioTrack.AudioCompressionLevel;\r
                     // track.AudioDitherMethod = audioTrack.AudioDitherMethod;\r
                     track.Encoder = EnumHelper<AudioEncoder>.GetValue(audioTrack.AudioEncoder);\r
-                    track.MixDown = EnumHelper<Mixdown>.GetValue(audioTrack.AudioMixdown);\r
+                    track.MixDown = audioTrack.AudioMixdown;\r
 \r
                     // track.AudioNormalizeMixLevel = audioTrack.AudioNormalizeMixLevel;\r
                     track.SampleRate = audioTrack.AudioSamplerate == "auto" ? 0 : double.Parse(audioTrack.AudioSamplerate);\r
@@ -540,7 +541,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
                     AudioCompressionLevel = 0, // TODO\r
                     AudioDitherMethod = null,  // TODO\r
                     AudioEncoder = EnumHelper<AudioEncoder>.GetShortName(item.Encoder),\r
-                    AudioMixdown = EnumHelper<Mixdown>.GetShortName(item.MixDown),\r
+                    AudioMixdown = item.MixDown,\r
                     AudioNormalizeMixLevel = false, // TODO\r
                     AudioSamplerate = item.SampleRate == 0 ? "auto" : item.SampleRate.ToString(),  // TODO check formatting.\r
                     AudioTrackDRCSlider = item.DRC,\r
index d72593cff0741cc986840e8c13fe53f849429465..23d38af4ef77cc109b8e84c1abb886b8bdf87b15 100644 (file)
@@ -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++;
                 }
 
index 1f0a2af98203e39c2c5f77cd65e10733f9d31207..ca2841bee87b999717109e19a74a4f76de52fc24 100644 (file)
@@ -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;
@@ -94,6 +98,11 @@ namespace HandBrakeWPF.Services.Scan.Model
         /// </summary>
         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>
index 8dba8fc89c6f702d1aef1ac610860a63c29f0d0d..04115d5b87dc72821c1ae612d17c010b8ea75afc 100644 (file)
@@ -76,7 +76,6 @@ namespace HandBrakeWPF.ViewModels
             }\r
 \r
             this.AudioEncoders = EnumHelper<AudioEncoder>.GetEnumList();\r
-            this.AudioMixdowns = EnumHelper<Mixdown>.GetEnumList();\r
             this.SourceTracks = new List<Audio>();\r
         }\r
 \r
@@ -99,11 +98,6 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         public IEnumerable<AudioEncoder> AudioEncoders { get; set; }\r
 \r
-        /// <summary>\r
-        /// Gets or sets AudioMixdowns.\r
-        /// </summary>\r
-        public IEnumerable<Mixdown> AudioMixdowns { get; set; }\r
-\r
         /// <summary>\r
         /// Gets or sets SampleRates.\r
         /// </summary>\r
index ada1069ac94e9b88837bb7c7e9c4f32cdea031b6..8620646dae0436721a8f836e84e70098b56230bc 100644 (file)
@@ -22,6 +22,8 @@
         <Conveters:BooleanToHiddenVisibilityConverter x:Key="boolToHiddenVisConverter" />\r
         <Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />\r
         <Audio:AudioRateTypeConverter x:Key="audioRateTypeConverter" />\r
+        <Audio:AudioMixdownConverter x:Key="audioMixdownConverter" />\r
+        <Audio:AudioMixdownListConverter x:Key="audioMixdownListConverter" />\r
     </UserControl.Resources>\r
 \r
     <Grid>\r
                             <TextBlock Grid.Row="0" Grid.Column="6" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Mixdown}"\r
                                        Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />\r
                             <ComboBox Grid.Row="0" Grid.Column="7" Height="22" Width="120" Margin="5,0,5,0" HorizontalAlignment="Stretch"\r
-                                      ItemsSource="{Binding DataContext.AudioMixdowns, Converter={StaticResource enumComboConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"\r
-                                      SelectedItem="{Binding MixDown, Converter={StaticResource enumComboConverter}}"\r
+                                      ItemsSource="{Binding TrackReference,  Converter={StaticResource audioMixdownListConverter}}"\r
+                                      SelectedItem="{Binding MixDown, Converter={StaticResource audioMixdownConverter}}"\r
+                                      DisplayMemberPath="DisplayName"\r
                                       Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />\r
 \r
 \r