From fc3324c8fa6c0aaa37c89d8d0bf098092d705932 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 9 Apr 2016 14:46:54 +0100 Subject: WinGui: Use Mixdowns from LibHBand sanitise the choices. The GUI no longer shows invalid mixdowns. --- .../Interop/HandBrakeEncoderHelpers.cs | 16 +++++ .../Interop/Json/Presets/AudioList.cs | 2 +- .../Interop/Model/Encoding/Mixdown.cs | 68 ---------------------- 3 files changed, 17 insertions(+), 69 deletions(-) delete mode 100644 win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs (limited to 'win/CS/HandBrake.ApplicationServices/Interop') 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 @@ -391,6 +391,22 @@ namespace HandBrake.ApplicationServices.Interop return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0; } + /// + /// Determines if a mixdown is available for a given track and encoder. + /// + /// + /// The mixdown to evaluate. + /// + /// + /// The encoder to evaluate. + /// + /// channel layout of the source track + /// True if available. + public static bool MixdownIsSupported(HBMixdown mixdown, HBAudioEncoder encoder, int channelLayout) + { + return HBFunctions.hb_mixdown_is_supported(mixdown.Id, (uint)encoder.Id, (uint)channelLayout) > 0; + } + /// /// Determines if DRC can be applied to the given track with the given encoder. /// 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; } /// - /// Gets or sets the audio mixdown. + /// Gets or sets the audio mixdown. (ShortName) /// 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 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// Defines the Mixdown type. -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Interop.Model.Encoding -{ - using System.ComponentModel.DataAnnotations; - using HandBrake.ApplicationServices.Attributes; - - /// - /// The Audio Mixdown Enumeration - /// - 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, - } -} -- cgit v1.2.3