lavc/audiotoolboxdec: add eac3 decoder

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.
pull/193/merge
Rodger Combs 9 years ago
parent 1b9e90ee80
commit b4daa2c40f
  1. 1
      configure
  2. 1
      libavcodec/Makefile
  3. 1
      libavcodec/allcodecs.c
  4. 7
      libavcodec/audiotoolboxdec.c

1
configure vendored

@ -2650,6 +2650,7 @@ ac3_at_decoder_deps="audiotoolbox"
adpcm_ima_qt_at_decoder_deps="audiotoolbox" adpcm_ima_qt_at_decoder_deps="audiotoolbox"
alac_at_decoder_deps="audiotoolbox" alac_at_decoder_deps="audiotoolbox"
amr_nb_at_decoder_deps="audiotoolbox" amr_nb_at_decoder_deps="audiotoolbox"
eac3_at_decoder_deps="audiotoolbox"
gsm_ms_at_decoder_deps="audiotoolbox" gsm_ms_at_decoder_deps="audiotoolbox"
ilbc_at_decoder_deps="audiotoolbox" ilbc_at_decoder_deps="audiotoolbox"
mp1_at_decoder_deps="audiotoolbox" mp1_at_decoder_deps="audiotoolbox"

@ -806,6 +806,7 @@ OBJS-$(CONFIG_AC3_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_ADPCM_IMA_QT_AT_DECODER) += audiotoolboxdec.o OBJS-$(CONFIG_ADPCM_IMA_QT_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_ALAC_AT_DECODER) += audiotoolboxdec.o OBJS-$(CONFIG_ALAC_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_AMR_NB_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_GSM_MS_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_ILBC_AT_DECODER) += audiotoolboxdec.o OBJS-$(CONFIG_ILBC_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o

@ -568,6 +568,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at); REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at);
REGISTER_ENCDEC (ALAC_AT, alac_at); REGISTER_ENCDEC (ALAC_AT, alac_at);
REGISTER_DECODER(AMR_NB_AT, amr_nb_at); REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
REGISTER_DECODER(EAC3_AT, eac3_at);
REGISTER_DECODER(GSM_MS_AT, gsm_ms_at); REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
REGISTER_ENCDEC (ILBC_AT, ilbc_at); REGISTER_ENCDEC (ILBC_AT, ilbc_at);
REGISTER_DECODER(MP1_AT, mp1_at); REGISTER_DECODER(MP1_AT, mp1_at);

@ -30,6 +30,10 @@
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/log.h" #include "libavutil/log.h"
#ifndef __MAC_10_11
#define kAudioFormatEnhancedAC3 'ec-3'
#endif
typedef struct ATDecodeContext { typedef struct ATDecodeContext {
AVClass *av_class; AVClass *av_class;
@ -58,6 +62,8 @@ static UInt32 ffat_get_format_id(enum AVCodecID codec, int profile)
return kAudioFormatAppleLossless; return kAudioFormatAppleLossless;
case AV_CODEC_ID_AMR_NB: case AV_CODEC_ID_AMR_NB:
return kAudioFormatAMR; return kAudioFormatAMR;
case AV_CODEC_ID_EAC3:
return kAudioFormatEnhancedAC3;
case AV_CODEC_ID_GSM_MS: case AV_CODEC_ID_GSM_MS:
return kAudioFormatMicrosoftGSM; return kAudioFormatMicrosoftGSM;
case AV_CODEC_ID_ILBC: 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(adpcm_ima_qt, AV_CODEC_ID_ADPCM_IMA_QT)
FFAT_DEC(alac, AV_CODEC_ID_ALAC) FFAT_DEC(alac, AV_CODEC_ID_ALAC)
FFAT_DEC(amr_nb, AV_CODEC_ID_AMR_NB) 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(gsm_ms, AV_CODEC_ID_GSM_MS)
FFAT_DEC(ilbc, AV_CODEC_ID_ILBC) FFAT_DEC(ilbc, AV_CODEC_ID_ILBC)
FFAT_DEC(mp1, AV_CODEC_ID_MP1) FFAT_DEC(mp1, AV_CODEC_ID_MP1)

Loading…
Cancel
Save