diff options
Diffstat (limited to 'win/CS/HandBrake.Interop')
3 files changed, 69 insertions, 0 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs index d728809e3..83390faa0 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs @@ -211,6 +211,13 @@ namespace HandBrake.Interop.Interop return AudioEncoders.SingleOrDefault(e => e.Id == codecId); } + public static HBAudioEncoder GetAutoPassthruEncoder(int inputCodec, int copyMask, int fallback, int muxer) + { + int encoder = HBFunctions.hb_autopassthru_get_encoder(inputCodec, copyMask, fallback, muxer); + + return GetAudioEncoder(encoder); + } + /// <summary> /// Gets the video encoder with the specified short name. /// </summary> @@ -659,5 +666,52 @@ namespace HandBrake.Interop.Interop { return hbFunctions.hb_audio_compression_get_default((uint)encoder.Id); } + + public static uint BuildCopyMask(bool audioAllowMP3Pass, bool audioAllowAACPass, bool audioAllowAC3Pass, bool audioAllowDTSPass, bool audioAllowDTSHDPass, bool audioAllowEac3Pass, bool audioAllowFlacPass, bool audioAllowTruehdPass) + { + uint mask = 0; + + if (audioAllowMP3Pass) + { + mask |= NativeConstants.HB_ACODEC_MP3_PASS; + } + + if (audioAllowAACPass) + { + mask |= NativeConstants.HB_ACODEC_AAC_PASS; + } + + if (audioAllowAC3Pass) + { + mask |= NativeConstants.HB_ACODEC_AC3_PASS; + } + + if (audioAllowDTSPass) + { + mask |= NativeConstants.HB_ACODEC_DCA_PASS; + } + + if (audioAllowDTSHDPass) + { + mask |= NativeConstants.HB_ACODEC_DCA_HD_PASS; + } + + if (audioAllowEac3Pass) + { + mask |= NativeConstants.HB_ACODEC_EAC3_PASS; + } + + if (audioAllowFlacPass) + { + mask |= NativeConstants.HB_ACODEC_FLAC_PASS; + } + + if (audioAllowTruehdPass) + { + mask |= NativeConstants.HB_ACODEC_TRUEHD_PASS; + } + + return mask; + } } } diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs index 26dfd3d8d..742f63aea 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs @@ -162,6 +162,9 @@ namespace HandBrake.Interop.Interop.HbLib [DllImport("hb", EntryPoint = "hb_audio_can_apply_drc2", CallingConvention = CallingConvention.Cdecl)] public static extern int hb_audio_can_apply_drc2(IntPtr handle, int title_index, int audio_index, int encoder); + [DllImport("hb", EntryPoint = "hb_autopassthru_get_encoder", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_autopassthru_get_encoder(int in_codec, int copy_mask, int fallback, int muxer); + [DllImport("hb", EntryPoint = "hb_mixdown_is_supported", CallingConvention = CallingConvention.Cdecl)] public static extern int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout); diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs index 3e0e7f012..b0e5d876d 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs @@ -24,6 +24,18 @@ namespace HandBrake.Interop.Interop.HbLib public const uint HB_ACODEC_PASS_FLAG = 0x40000000; public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_AC3 | HB_ACODEC_DCA | HB_ACODEC_DCA_HD | HB_ACODEC_FFAAC | HB_ACODEC_FFEAC3 | HB_ACODEC_FFFLAC | HB_ACODEC_MP3 | HB_ACODEC_FFTRUEHD); + public const uint HB_ACODEC_MASK = 0x07FFFF01; + public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_PASS_MASK); + public const uint HB_ACODEC_ANY = (HB_ACODEC_PASS_FLAG | HB_ACODEC_MASK); + public const uint HB_ACODEC_AAC_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFAAC); + public const uint HB_ACODEC_AC3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_AC3); + public const uint HB_ACODEC_DCA_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_DCA); + public const uint HB_ACODEC_DCA_HD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_DCA_HD); + public const uint HB_ACODEC_EAC3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFEAC3); + public const uint HB_ACODEC_FLAC_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFFLAC); + public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_MP3); + public const uint HB_ACODEC_TRUEHD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD); + // VideoEncoders public const uint HB_VCODEC_QSV_H264 = 0x0000100; public const uint HB_VCODEC_QSV_H265 = 0x0000200; |