From 9c4ba8930b22f92f0d8b985eb77a96fca4a62d28 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 16 Jun 2013 16:00:15 +0000 Subject: WiWinGui: Remap the audio and video encoders. Hopefully this should also be backwards compatible with user presets, but it is recommended to re-create any user presets to that the new keys get picked up incase we drop the fallbacks in the future. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5591 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrakeInterop/Attributes/ShortName.cs | 35 +++++++++++++ .../HandBrakeInterop/Converters.cs | 9 +++- .../HandBrakeInterop/HandBrakeInterop.csproj | 1 + .../HandBrakeInterop/HbLib/NativeConstants.cs | 57 ++++++++++++---------- .../Model/Encoding/AudioEncoder.cs | 37 +++++++++++--- .../Model/Encoding/VideoEncoder.cs | 14 +++++- .../HandBrakeInterop/SourceData/AudioCodec.cs | 2 +- 7 files changed, 118 insertions(+), 37 deletions(-) create mode 100644 win/CS/HandBrake.Interop/HandBrakeInterop/Attributes/ShortName.cs (limited to 'win/CS/HandBrake.Interop') diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Attributes/ShortName.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Attributes/ShortName.cs new file mode 100644 index 000000000..cf32cb802 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Attributes/ShortName.cs @@ -0,0 +1,35 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// A Short Name for an enum value +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Attributes +{ + using System; + + /// + /// A Short Name for an enum value + /// + public class ShortName : Attribute + { + /// + /// Initializes a new instance of the class. + /// + /// + /// The short name. + /// + public ShortName(string shortName) + { + this.Name = shortName; + } + + /// + /// Gets or sets the short name. + /// + public string Name { get; set; } + } +} diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs index e7f172e32..4e04222ed 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs @@ -78,10 +78,12 @@ namespace HandBrake.Interop return NativeConstants.HB_ACODEC_AC3_PASS; case AudioEncoder.Ac3: return NativeConstants.HB_ACODEC_AC3; - case AudioEncoder.Faac: - return NativeConstants.HB_ACODEC_FAAC; case AudioEncoder.ffaac: return NativeConstants.HB_ACODEC_FFAAC; + case AudioEncoder.fdkaac: + return NativeConstants.HB_ACODEC_FDK_AAC; + case AudioEncoder.fdkheaac: + return NativeConstants.HB_ACODEC_FDK_HAAC; case AudioEncoder.AacPassthru: return NativeConstants.HB_ACODEC_AAC_PASS; case AudioEncoder.Lame: @@ -127,9 +129,12 @@ namespace HandBrake.Interop case NativeConstants.HB_ACODEC_FFAAC: case NativeConstants.HB_ACODEC_CA_AAC: case NativeConstants.HB_ACODEC_CA_HAAC: + case NativeConstants.HB_ACODEC_FDK_HAAC: // TODO Check this is correct + case NativeConstants.HB_ACODEC_FDK_AAC: // TODO Check this is correct return AudioCodec.Aac; case NativeConstants.HB_ACODEC_FFFLAC: return AudioCodec.Flac; + default: return AudioCodec.Other; } diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index 6de4a9adb..59fe341b5 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -124,6 +124,7 @@ + diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs index 23181e7fe..52d1d253e 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs @@ -12,38 +12,42 @@ namespace HandBrake.Interop.HbLib { public partial class NativeConstants { - public const uint HB_ACODEC_MASK = 0x00FFFF00; - public const uint HB_ACODEC_FAAC = 0x00000100; - public const uint HB_ACODEC_LAME = 0x00000200; - public const uint HB_ACODEC_VORBIS = 0x00000400; - public const uint HB_ACODEC_AC3 = 0x00000800; - public const uint HB_ACODEC_LPCM = 0x00001000; - public const uint HB_ACODEC_DCA = 0x00002000; - public const uint HB_ACODEC_CA_AAC = 0x00004000; - public const uint HB_ACODEC_CA_HAAC = 0x00008000; - public const uint HB_ACODEC_FFAAC = 0x00010000; - public const uint HB_ACODEC_FFMPEG = 0x00020000; - public const uint HB_ACODEC_DCA_HD = 0x00040000; - public const uint HB_ACODEC_MP3 = 0x00080000; - public const uint HB_ACODEC_FFFLAC = 0x00100000; - public const uint HB_ACODEC_FDK_AAC = 0x00400000; - public const uint HB_ACODEC_FDK_HAAC = 0x00800000; - public const uint HB_ACODEC_FF_MASK = 0x00FF2000; - public const uint HB_ACODEC_PASS_FLAG = 0x40000000; - public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA); - public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG); - public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_MP3 | HB_ACODEC_PASS_FLAG); - public const uint HB_ACODEC_AAC_PASS = (HB_ACODEC_FFAAC | HB_ACODEC_PASS_FLAG); - public const uint HB_ACODEC_AC3_PASS = (HB_ACODEC_AC3 | HB_ACODEC_PASS_FLAG); - public const uint HB_ACODEC_DCA_PASS = (HB_ACODEC_DCA | HB_ACODEC_PASS_FLAG); - public const uint HB_ACODEC_DCA_HD_PASS = (HB_ACODEC_DCA_HD | HB_ACODEC_PASS_FLAG); - public const uint HB_ACODEC_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG); + // Audio Encoders + public const uint HB_ACODEC_MASK = 0x00FFFF00; + public const uint HB_ACODEC_FAAC = 0x00000100; + public const uint HB_ACODEC_LAME = 0x00000200; + public const uint HB_ACODEC_VORBIS = 0x00000400; + public const uint HB_ACODEC_AC3 = 0x00000800; + public const uint HB_ACODEC_LPCM = 0x00001000; + public const uint HB_ACODEC_DCA = 0x00002000; + public const uint HB_ACODEC_CA_AAC = 0x00004000; + public const uint HB_ACODEC_CA_HAAC = 0x00008000; + public const uint HB_ACODEC_FFAAC = 0x00010000; + public const uint HB_ACODEC_FFMPEG = 0x00020000; + public const uint HB_ACODEC_DCA_HD = 0x00040000; + public const uint HB_ACODEC_MP3 = 0x00080000; + public const uint HB_ACODEC_FFFLAC = 0x00100000; + public const uint HB_ACODEC_FFFLAC24 = 0x00200000; + public const uint HB_ACODEC_FDK_AAC = 0x00400000; + public const uint HB_ACODEC_FDK_HAAC = 0x00800000; + public const uint HB_ACODEC_FF_MASK = 0x00FF2000; + public const uint HB_ACODEC_PASS_FLAG = 0x40000000; + public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA); + public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_MP3 | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_AAC_PASS = (HB_ACODEC_FFAAC | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_AC3_PASS = (HB_ACODEC_AC3 | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_DCA_PASS = (HB_ACODEC_DCA | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_DCA_HD_PASS = (HB_ACODEC_DCA_HD | HB_ACODEC_PASS_FLAG); + public const uint HB_ACODEC_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG); + // Subtitle Types public const int HB_SUBSTREAM_BD_TRUEHD = 0x72; public const int HB_SUBSTREAM_BD_AC3 = 0x76; public const int HB_SUBSTREAM_BD_DTSHD = 0x72; public const int HB_SUBSTREAM_BD_DTS = 0x71; + // Video Encoders public const int HB_VCODEC_MASK = 0x0000FF; public const int HB_VCODEC_X264 = 0x000001; public const int HB_VCODEC_THEORA = 0x000002; @@ -52,6 +56,7 @@ namespace HandBrake.Interop.HbLib public const int HB_VCODEC_FFMPEG_MPEG2 = 0x000020; public const int HB_VCODEC_FFMPEG_MASK = 0x0000F0; + // Muxers public const int HB_MUX_MASK = 0xFF0000; public const int HB_MUX_MP4 = 0x010000; public const int HB_MUX_MKV = 0x200000; diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs index 8fb242ac6..bc7b5bf20 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs @@ -11,48 +11,71 @@ namespace HandBrake.Interop.Model.Encoding { using System.ComponentModel.DataAnnotations; + using HandBrake.Interop.Attributes; + /// /// The audio encoder. /// public enum AudioEncoder { [Display(Name = "AAC (faac)")] - Faac = 0, + [ShortName("faac")] + faac = 0, - [Display(Name = "AAC (ffmpeg)")] + [Display(Name = "AAC (avcodec)")] + [ShortName("av_aac")] ffaac, - [Display(Name = "MP3 (lame)")] + [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 (ffmpeg)")] + [Display(Name = "AC3")] + [ShortName("ac3")] Ac3, [Display(Name = "Auto Passthru")] + [ShortName("copy")] Passthrough, [Display(Name = "AC3 Passthru")] + [ShortName("copy:ac3")] Ac3Passthrough, [Display(Name = "DTS Passthru")] + [ShortName("copy:dts")] DtsPassthrough, [Display(Name = "DTS-HD Passthru")] + [ShortName("copy:dtshd")] DtsHDPassthrough, [Display(Name = "AAC Passthru")] + [ShortName("copy:aac")] AacPassthru, [Display(Name = "MP3 Passthru")] + [ShortName("copy:mp3")] Mp3Passthru, - [Display(Name = "Vorbis (vorbis)")] + [Display(Name = "Vorbis")] + [ShortName("vorbis")] Vorbis, - [Display(Name = "FLAC (ffmpeg)")] + [Display(Name = "FLAC 16-bit")] + [ShortName("flac16")] ffflac, - [Display(Name = "FLAC (24-bit)")] + [Display(Name = "FLAC 24-bit")] + [ShortName("flac24")] ffflac24, } } diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs index 31cc3d599..e05f74419 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs @@ -2,24 +2,36 @@ // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // +// +// The video encoder. +// // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.Interop.Model.Encoding { using System.ComponentModel.DataAnnotations; - public enum VideoEncoder + using HandBrake.Interop.Attributes; + + /// + /// The video encoder. + /// + public enum VideoEncoder { [Display(Name = "H.264 (x264)")] + [ShortName("x264")] X264 = 0, [Display(Name = "MPEG-4 (FFmpeg)")] + [ShortName("mpeg4")] FFMpeg, [Display(Name = "MPEG-2 (FFmpeg)")] + [ShortName("mpeg2")] FFMpeg2, [Display(Name = "VP3 (Theora)")] + [ShortName("theora")] Theora } } diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs index dce947311..d24c9998b 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs @@ -48,6 +48,6 @@ namespace HandBrake.Interop.SourceData /// /// The flac. /// - Flac + Flac, } } \ No newline at end of file -- cgit v1.2.3