From ae9dbce961c2d87e5f52288c35fbf882de8430c7 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 20 Jun 2015 19:45:31 +0000 Subject: WinGui: Initial implementation of quality based encoding option. Please note, the preset version has been bumped so user presets will need to be re-created. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7306 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Interop/HandBrakeEncoderHelpers.cs | 89 ++++++++++++++++------ .../Interop/HbLib/HbFunctions.cs | 1 - .../Interop/Model/Encoding/AudioEncoder.cs | 89 ---------------------- 3 files changed, 67 insertions(+), 112 deletions(-) delete mode 100644 win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoder.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 524b6b0ad..cddfd3634 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -9,7 +9,6 @@ namespace HandBrake.ApplicationServices.Interop { - using System; using System.Collections.Generic; using System.Linq; @@ -45,7 +44,7 @@ namespace HandBrake.ApplicationServices.Interop /// /// List of HandBrake containers. - /// + /// private static List containers; /// @@ -262,8 +261,12 @@ namespace HandBrake.ApplicationServices.Interop /// /// 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. + /// + /// 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; @@ -272,8 +275,12 @@ namespace HandBrake.ApplicationServices.Interop /// /// 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. + /// + /// 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; @@ -282,9 +289,15 @@ namespace HandBrake.ApplicationServices.Interop /// /// 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. + /// + /// 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; @@ -293,8 +306,12 @@ namespace HandBrake.ApplicationServices.Interop /// /// Gets the subtitle source type's name. /// - /// The subtitle source type (SSA, VobSub, etc). - /// The name of the subtitle source. + /// + /// 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) @@ -492,9 +509,9 @@ namespace HandBrake.ApplicationServices.Interop return new VideoQualityLimits { - Low = low, - High = high, - Granularity = granularity, + Low = low, + High = high, + Granularity = granularity, Ascending = direction == 0 }; } @@ -551,7 +568,7 @@ namespace HandBrake.ApplicationServices.Interop /// /// Limits on the audio quality for the given encoder. /// - internal static RangeLimits GetAudioQualityLimits(int encoderId) + public static RangeLimits GetAudioQualityLimits(int encoderId) { float low = 0, high = 0, granularity = 0; int direction = 0; @@ -559,9 +576,9 @@ namespace HandBrake.ApplicationServices.Interop return new RangeLimits { - Low = low, - High = high, - Granularity = granularity, + Low = low, + High = high, + Granularity = granularity, Ascending = direction == 0 }; } @@ -575,7 +592,7 @@ namespace HandBrake.ApplicationServices.Interop /// /// Limits on the audio compression for the given encoder. /// - internal static RangeLimits GetAudioCompressionLimits(int encoderId) + public static RangeLimits GetAudioCompressionLimits(int encoderId) { float low = 0, high = 0, granularity = 0; int direction = 0; @@ -583,11 +600,39 @@ namespace HandBrake.ApplicationServices.Interop return new RangeLimits { - Low = low, - High = high, - Granularity = granularity, + Low = low, + High = high, + Granularity = granularity, Ascending = direction == 0 }; } + + /// + /// The get default quality. + /// + /// + /// The encoder. + /// + /// + /// The . + /// + public static double GetDefaultQuality(HBAudioEncoder encoder) + { + return HBFunctions.hb_audio_quality_get_default((uint)encoder.Id); + } + + /// + /// The get default audio compression. + /// + /// + /// The encoder. + /// + /// + /// The . + /// + public static double GetDefaultAudioCompression(HBAudioEncoder encoder) + { + return HBFunctions.hb_audio_compression_get_default((uint)encoder.Id); + } } } diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs index a1e93f28b..1b68df438 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs @@ -402,7 +402,6 @@ namespace HandBrake.ApplicationServices.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_image_close", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr hb_image_close(IntPtr image); - /* JSON API */ // char * hb_get_title_set_json(hb_handle_t * h); diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoder.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoder.cs deleted file mode 100644 index 3aef81c38..000000000 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoder.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// The audio encoder enumeration -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Interop.Model.Encoding -{ - using System.ComponentModel.DataAnnotations; - - using HandBrake.ApplicationServices.Attributes; - - /// - /// The audio encoder. - /// - public enum AudioEncoder - { - [Display(Name = "AAC (avcodec)")] - [ShortName("av_aac")] - ffaac, - - [Display(Name = "AAC (FDK)")] - [ShortName("fdk_aac")] - fdkaac, - - [Display(Name = "HE-AAC (FDK)")] - [ShortName("fdk_haac")] - fdkheaac, - - [Display(Name = "MP3")] - [ShortName("mp3")] - Lame, - - [Display(Name = "AC3")] - [ShortName("ac3")] - Ac3, - - [Display(Name = "Auto Passthru")] - [ShortName("copy")] - Passthrough, - - [Display(Name = "AC3 Passthru")] - [ShortName("copy:ac3")] - Ac3Passthrough, - - [Display(Name = "E-AC3 Passthru")] - [ShortName("copy:eac3")] - EAc3Passthrough, - - [Display(Name = "DTS Passthru")] - [ShortName("copy:dts")] - DtsPassthrough, - - [Display(Name = "DTS-HD Passthru")] - [ShortName("copy:dtshd")] - DtsHDPassthrough, - - [Display(Name = "TrueHD Passthru")] - [ShortName("copy:truehd")] - TrueHDPassthrough, - - [Display(Name = "AAC Passthru")] - [ShortName("copy:aac")] - AacPassthru, - - [Display(Name = "MP3 Passthru")] - [ShortName("copy:mp3")] - Mp3Passthru, - - [Display(Name = "Vorbis")] - [ShortName("vorbis")] - Vorbis, - - [Display(Name = "FLAC 16-bit")] - [ShortName("flac16")] - ffflac, - - [Display(Name = "FLAC 24-bit")] - [ShortName("flac24")] - ffflac24, - - [Display(Name = "FLAC Passthru")] - [ShortName("copy:flac")] - FlacPassthru, - } -} -- cgit v1.2.3