lavc/audiotoolboxdec: add eac3 decoder
authorRodger Combs <rodger.combs@gmail.com>
Thu, 31 Mar 2016 01:55:32 +0000 (20:55 -0500)
committerRodger Combs <rodger.combs@gmail.com>
Sat, 2 Apr 2016 08:03:13 +0000 (03:03 -0500)
This is added in 10.11, so we add a #define when building against older SDKs.

The decoder actually supports 7.1-channel eac3, but since the parser only
reports 6 channels, we end up decoding the 5.1 downmix (same as the internal
decoder) for now.

configure
libavcodec/Makefile
libavcodec/allcodecs.c
libavcodec/audiotoolboxdec.c

index e8c4a7b..94a66d8 100755 (executable)
--- a/configure
+++ b/configure
@@ -2650,6 +2650,7 @@ ac3_at_decoder_deps="audiotoolbox"
 adpcm_ima_qt_at_decoder_deps="audiotoolbox"
 alac_at_decoder_deps="audiotoolbox"
 amr_nb_at_decoder_deps="audiotoolbox"
+eac3_at_decoder_deps="audiotoolbox"
 gsm_ms_at_decoder_deps="audiotoolbox"
 ilbc_at_decoder_deps="audiotoolbox"
 mp1_at_decoder_deps="audiotoolbox"
index 8c14268..801cccd 100644 (file)
@@ -806,6 +806,7 @@ OBJS-$(CONFIG_AC3_AT_DECODER)             += audiotoolboxdec.o
 OBJS-$(CONFIG_ADPCM_IMA_QT_AT_DECODER)    += audiotoolboxdec.o
 OBJS-$(CONFIG_ALAC_AT_DECODER)            += audiotoolboxdec.o
 OBJS-$(CONFIG_AMR_NB_AT_DECODER)          += audiotoolboxdec.o
+OBJS-$(CONFIG_EAC3_AT_DECODER)            += audiotoolboxdec.o
 OBJS-$(CONFIG_GSM_MS_AT_DECODER)          += audiotoolboxdec.o
 OBJS-$(CONFIG_ILBC_AT_DECODER)            += audiotoolboxdec.o
 OBJS-$(CONFIG_MP1_AT_DECODER)             += audiotoolboxdec.o
index f498041..0bbf7d3 100644 (file)
@@ -568,6 +568,7 @@ void avcodec_register_all(void)
     REGISTER_DECODER(ADPCM_IMA_QT_AT,   adpcm_ima_qt_at);
     REGISTER_ENCDEC (ALAC_AT,           alac_at);
     REGISTER_DECODER(AMR_NB_AT,         amr_nb_at);
+    REGISTER_DECODER(EAC3_AT,           eac3_at);
     REGISTER_DECODER(GSM_MS_AT,         gsm_ms_at);
     REGISTER_ENCDEC (ILBC_AT,           ilbc_at);
     REGISTER_DECODER(MP1_AT,            mp1_at);
index 4ff46ea..f840a6b 100644 (file)
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
 
+#ifndef __MAC_10_11
+#define kAudioFormatEnhancedAC3 'ec-3'
+#endif
+
 typedef struct ATDecodeContext {
     AVClass *av_class;
 
@@ -58,6 +62,8 @@ static UInt32 ffat_get_format_id(enum AVCodecID codec, int profile)
         return kAudioFormatAppleLossless;
     case AV_CODEC_ID_AMR_NB:
         return kAudioFormatAMR;
+    case AV_CODEC_ID_EAC3:
+        return kAudioFormatEnhancedAC3;
     case AV_CODEC_ID_GSM_MS:
         return kAudioFormatMicrosoftGSM;
     case AV_CODEC_ID_ILBC:
@@ -512,6 +518,7 @@ FFAT_DEC(ac3,          AV_CODEC_ID_AC3)
 FFAT_DEC(adpcm_ima_qt, AV_CODEC_ID_ADPCM_IMA_QT)
 FFAT_DEC(alac,         AV_CODEC_ID_ALAC)
 FFAT_DEC(amr_nb,       AV_CODEC_ID_AMR_NB)
+FFAT_DEC(eac3,         AV_CODEC_ID_EAC3)
 FFAT_DEC(gsm_ms,       AV_CODEC_ID_GSM_MS)
 FFAT_DEC(ilbc,         AV_CODEC_ID_ILBC)
 FFAT_DEC(mp1,          AV_CODEC_ID_MP1)