From 9192276e8bfde8ac2ce798edf677be141ad5e9b5 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 20 Jun 2015 15:10:14 +0000 Subject: WinGui: Fetch Audio Bitrates, Bitrate Defaults, Samplerates from LibHB git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7305 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Interop/HandBrakeEncoderHelpers.cs | 272 ++++++++++----------- .../Interop/Model/Encoding/Mixdown.cs | 13 + 2 files changed, 149 insertions(+), 136 deletions(-) (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 69075a7f9..524b6b0ad 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -33,33 +33,33 @@ namespace HandBrake.ApplicationServices.Interop /// private static List videoEncoders; - /// - /// Video framerates in pts. - /// - private static List videoFramerates; - - /// - /// List of HandBrake mixdowns. + /// + /// Video framerates in pts. + /// + private static List videoFramerates; + + /// + /// List of HandBrake mixdowns. /// private static List mixdowns; - /// - /// List of HandBrake containers. - /// - private static List containers; - - /// - /// The audio bitrates. + /// + /// List of HandBrake containers. + /// + private static List containers; + + /// + /// The audio bitrates. /// private static List audioBitrates; - /// - /// Audio sample rates in Hz. - /// - private static List audioSampleRates; - - /// - /// Initializes static members of the HandBrakeEncoderHelpers class. + /// + /// Audio sample rates in Hz. + /// + private static List audioSampleRates; + + /// + /// Initializes static members of the HandBrakeEncoderHelpers class. /// static HandBrakeEncoderHelpers() { @@ -109,13 +109,13 @@ namespace HandBrake.ApplicationServices.Interop { videoFramerates = InteropUtilities.ToListFromIterator(HBFunctions.hb_video_framerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate); } - - return videoFramerates; - } - } - - /// - /// Gets a list of supported mixdowns. + + return videoFramerates; + } + } + + /// + /// Gets a list of supported mixdowns. /// public static List Mixdowns { @@ -257,73 +257,73 @@ namespace HandBrake.ApplicationServices.Interop public static HBContainer GetContainer(string shortName) { return Containers.SingleOrDefault(c => c.ShortName == shortName); - } - - /// - /// Returns true if the subtitle source type can be set to forced only. - /// - /// The subtitle source type (SSA, VobSub, etc) - /// True if the subtitle source type can be set to forced only. - public static bool SubtitleCanSetForcedOnly(int source) - { - return HBFunctions.hb_subtitle_can_force(source) > 0; - } - - /// - /// Returns true if the subtitle source type can be burned in. - /// - /// The subtitle source type (SSA, VobSub, etc) - /// True if the subtitle source type can be burned in. - public static bool SubtitleCanBurn(int source) - { - return HBFunctions.hb_subtitle_can_burn(source) > 0; - } - - /// - /// Returns true if the subtitle type can be passed through using the given muxer. - /// - /// The subtitle source type (SSA, VobSub, etc) - /// The ID of the muxer. - /// True if the subtitle type can be passed through with the given muxer. - public static bool SubtitleCanPassthrough(int subtitleSourceType, int muxer) - { - return HBFunctions.hb_subtitle_can_pass(subtitleSourceType, muxer) > 0; - } - - /// - /// Gets the subtitle source type's name. - /// - /// The subtitle source type (SSA, VobSub, etc). - /// The name of the subtitle source. - public static string GetSubtitleSourceName(int source) - { - switch ((hb_subtitle_s_subsource)source) - { - case hb_subtitle_s_subsource.CC608SUB: - return "CC608"; - case hb_subtitle_s_subsource.CC708SUB: - return "CC708"; - case hb_subtitle_s_subsource.SRTSUB: - return "SRT"; - case hb_subtitle_s_subsource.SSASUB: - return "SSA"; - case hb_subtitle_s_subsource.TX3GSUB: - return "TX3G"; - case hb_subtitle_s_subsource.UTF8SUB: - return "UTF8"; - case hb_subtitle_s_subsource.VOBSUB: - return "VobSub"; - case hb_subtitle_s_subsource.PGSSUB: - return "PGS"; - default: - return string.Empty; - } - } - - /// - /// Determines if the given encoder is compatible with the given track. - /// - /// + } + + /// + /// Returns true if the subtitle source type can be set to forced only. + /// + /// The subtitle source type (SSA, VobSub, etc) + /// True if the subtitle source type can be set to forced only. + public static bool SubtitleCanSetForcedOnly(int source) + { + return HBFunctions.hb_subtitle_can_force(source) > 0; + } + + /// + /// Returns true if the subtitle source type can be burned in. + /// + /// The subtitle source type (SSA, VobSub, etc) + /// True if the subtitle source type can be burned in. + public static bool SubtitleCanBurn(int source) + { + return HBFunctions.hb_subtitle_can_burn(source) > 0; + } + + /// + /// Returns true if the subtitle type can be passed through using the given muxer. + /// + /// The subtitle source type (SSA, VobSub, etc) + /// The ID of the muxer. + /// True if the subtitle type can be passed through with the given muxer. + public static bool SubtitleCanPassthrough(int subtitleSourceType, int muxer) + { + return HBFunctions.hb_subtitle_can_pass(subtitleSourceType, muxer) > 0; + } + + /// + /// Gets the subtitle source type's name. + /// + /// The subtitle source type (SSA, VobSub, etc). + /// The name of the subtitle source. + public static string GetSubtitleSourceName(int source) + { + switch ((hb_subtitle_s_subsource)source) + { + case hb_subtitle_s_subsource.CC608SUB: + return "CC608"; + case hb_subtitle_s_subsource.CC708SUB: + return "CC708"; + case hb_subtitle_s_subsource.SRTSUB: + return "SRT"; + case hb_subtitle_s_subsource.SSASUB: + return "SSA"; + case hb_subtitle_s_subsource.TX3GSUB: + return "TX3G"; + case hb_subtitle_s_subsource.UTF8SUB: + return "UTF8"; + case hb_subtitle_s_subsource.VOBSUB: + return "VobSub"; + case hb_subtitle_s_subsource.PGSSUB: + return "PGS"; + default: + return string.Empty; + } + } + + /// + /// Determines if the given encoder is compatible with the given track. + /// + /// /// The codec Id. /// /// @@ -368,13 +368,13 @@ namespace HandBrake.ApplicationServices.Interop /// /// /// True if the encoder supports the mixdown. - /// - public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder) - { - return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0; - } - - /// + /// + public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder) + { + return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0; + } + + /// /// Determines if DRC can be applied to the given track with the given encoder. /// /// @@ -489,15 +489,15 @@ namespace HandBrake.ApplicationServices.Interop int direction = 0; HBFunctions.hb_video_quality_get_limits((uint)encoder.Id, ref low, ref high, ref granularity, ref direction); - - return new VideoQualityLimits - { - Low = low, - High = high, - Granularity = granularity, - Ascending = direction == 0 - }; - } + + return new VideoQualityLimits + { + Low = low, + High = high, + Granularity = granularity, + Ascending = direction == 0 + }; + } /// /// Sanitizes an audio bitrate given the output codec, sample rate and mixdown. @@ -536,13 +536,13 @@ namespace HandBrake.ApplicationServices.Interop /// /// /// The default bitrate for these parameters. - /// - public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) - { - return HBFunctions.hb_audio_bitrate_get_default((uint)encoder.Id, sampleRate, mixdown.Id); - } - - /// + /// + public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) + { + return HBFunctions.hb_audio_bitrate_get_default((uint)encoder.Id, sampleRate, mixdown.Id); + } + + /// /// Gets limits on audio quality for a given encoder. /// /// @@ -556,15 +556,15 @@ namespace HandBrake.ApplicationServices.Interop float low = 0, high = 0, granularity = 0; int direction = 0; HBFunctions.hb_audio_quality_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction); - - return new RangeLimits - { - Low = low, - High = high, - Granularity = granularity, - Ascending = direction == 0 - }; - } + + return new RangeLimits + { + Low = low, + High = high, + Granularity = granularity, + Ascending = direction == 0 + }; + } /// /// Gets limits on audio compression for a given encoder. @@ -580,14 +580,14 @@ namespace HandBrake.ApplicationServices.Interop float low = 0, high = 0, granularity = 0; int direction = 0; HBFunctions.hb_audio_compression_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction); - - return new RangeLimits - { - Low = low, - High = high, - Granularity = granularity, - Ascending = direction == 0 - }; - } + + return new RangeLimits + { + Low = low, + High = high, + Granularity = granularity, + Ascending = direction == 0 + }; + } } } diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs index 53e4f87e2..05f554e6b 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs @@ -10,6 +10,7 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding { using System.ComponentModel.DataAnnotations; + using HandBrake.ApplicationServices.Attributes; /// /// The Audio Mixdown Enumeration @@ -17,39 +18,51 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding public enum Mixdown { [Display(Name = "Dolby Pro Logic II")] + [ShortName("dpl2")] DolbyProLogicII = 0, [Display(Name = "None")] + [ShortName("dpl2")] None, [Display(Name = "Automatic")] + [ShortName("dpl2")] 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