diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-11-21 20:06:22 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-11-21 20:06:22 +0000 |
commit | 63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd (patch) | |
tree | c2a7e585f116b18204d49b0a779d2549485518a0 /libavcodec/ac3enc.c | |
parent | d6e602536c049a952969e95bb8f3897f5d46b914 (diff) | |
download | ffmpeg-63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd.tar.gz |
Use the new libavcore audio channel API.
This also allows to remove a linking dependency of libavfilter on
libavcodec.
Originally committed as revision 25789 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 200ba36c6a..aeaad5d151 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -25,6 +25,7 @@ */ //#define DEBUG //#define DEBUG_BITALLOC +#include "libavcore/audioconvert.h" #include "libavutil/crc.h" #include "avcodec.h" #include "libavutil/common.h" /* for av_reverse */ @@ -620,26 +621,26 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels, ch_layout = *channel_layout; if (!ch_layout) ch_layout = avcodec_guess_channel_layout(channels, CODEC_ID_AC3, NULL); - if (avcodec_channel_layout_num_channels(ch_layout) != channels) + if (av_get_channel_layout_nb_channels(ch_layout) != channels) return -1; - s->lfe = !!(ch_layout & CH_LOW_FREQUENCY); + s->lfe = !!(ch_layout & AV_CH_LOW_FREQUENCY); s->nb_all_channels = channels; s->nb_channels = channels - s->lfe; s->lfe_channel = s->lfe ? s->nb_channels : -1; if (s->lfe) - ch_layout -= CH_LOW_FREQUENCY; + ch_layout -= AV_CH_LOW_FREQUENCY; switch (ch_layout) { - case CH_LAYOUT_MONO: s->channel_mode = AC3_CHMODE_MONO; break; - case CH_LAYOUT_STEREO: s->channel_mode = AC3_CHMODE_STEREO; break; - case CH_LAYOUT_SURROUND: s->channel_mode = AC3_CHMODE_3F; break; - case CH_LAYOUT_2_1: s->channel_mode = AC3_CHMODE_2F1R; break; - case CH_LAYOUT_4POINT0: s->channel_mode = AC3_CHMODE_3F1R; break; - case CH_LAYOUT_QUAD: - case CH_LAYOUT_2_2: s->channel_mode = AC3_CHMODE_2F2R; break; - case CH_LAYOUT_5POINT0: - case CH_LAYOUT_5POINT0_BACK: s->channel_mode = AC3_CHMODE_3F2R; break; + case AV_CH_LAYOUT_MONO: s->channel_mode = AC3_CHMODE_MONO; break; + case AV_CH_LAYOUT_STEREO: s->channel_mode = AC3_CHMODE_STEREO; break; + case AV_CH_LAYOUT_SURROUND: s->channel_mode = AC3_CHMODE_3F; break; + case AV_CH_LAYOUT_2_1: s->channel_mode = AC3_CHMODE_2F1R; break; + case AV_CH_LAYOUT_4POINT0: s->channel_mode = AC3_CHMODE_3F1R; break; + case AV_CH_LAYOUT_QUAD: + case AV_CH_LAYOUT_2_2: s->channel_mode = AC3_CHMODE_2F2R; break; + case AV_CH_LAYOUT_5POINT0: + case AV_CH_LAYOUT_5POINT0_BACK: s->channel_mode = AC3_CHMODE_3F2R; break; default: return -1; } @@ -647,7 +648,7 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels, s->channel_map = ff_ac3_enc_channel_map[s->channel_mode][s->lfe]; *channel_layout = ch_layout; if (s->lfe) - *channel_layout |= CH_LOW_FREQUENCY; + *channel_layout |= AV_CH_LOW_FREQUENCY; return 0; } @@ -1403,23 +1404,23 @@ AVCodec ac3_encoder = { .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), .channel_layouts = (const int64_t[]){ - CH_LAYOUT_MONO, - CH_LAYOUT_STEREO, - CH_LAYOUT_2_1, - CH_LAYOUT_SURROUND, - CH_LAYOUT_2_2, - CH_LAYOUT_QUAD, - CH_LAYOUT_4POINT0, - CH_LAYOUT_5POINT0, - CH_LAYOUT_5POINT0_BACK, - (CH_LAYOUT_MONO | CH_LOW_FREQUENCY), - (CH_LAYOUT_STEREO | CH_LOW_FREQUENCY), - (CH_LAYOUT_2_1 | CH_LOW_FREQUENCY), - (CH_LAYOUT_SURROUND | CH_LOW_FREQUENCY), - (CH_LAYOUT_2_2 | CH_LOW_FREQUENCY), - (CH_LAYOUT_QUAD | CH_LOW_FREQUENCY), - (CH_LAYOUT_4POINT0 | CH_LOW_FREQUENCY), - CH_LAYOUT_5POINT1, - CH_LAYOUT_5POINT1_BACK, + AV_CH_LAYOUT_MONO, + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_2_1, + AV_CH_LAYOUT_SURROUND, + AV_CH_LAYOUT_2_2, + AV_CH_LAYOUT_QUAD, + AV_CH_LAYOUT_4POINT0, + AV_CH_LAYOUT_5POINT0, + AV_CH_LAYOUT_5POINT0_BACK, + (AV_CH_LAYOUT_MONO | AV_CH_LOW_FREQUENCY), + (AV_CH_LAYOUT_STEREO | AV_CH_LOW_FREQUENCY), + (AV_CH_LAYOUT_2_1 | AV_CH_LOW_FREQUENCY), + (AV_CH_LAYOUT_SURROUND | AV_CH_LOW_FREQUENCY), + (AV_CH_LAYOUT_2_2 | AV_CH_LOW_FREQUENCY), + (AV_CH_LAYOUT_QUAD | AV_CH_LOW_FREQUENCY), + (AV_CH_LAYOUT_4POINT0 | AV_CH_LOW_FREQUENCY), + AV_CH_LAYOUT_5POINT1, + AV_CH_LAYOUT_5POINT1_BACK, 0 }, }; |