diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-09 03:44:20 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-09 04:27:12 +0400 |
commit | f2b20b7a8b6fcbcd8cc669f5211e4e2ed7d8e9f3 (patch) | |
tree | b21166497b8ac3b1e5f840d8b5d73bda7f77e3d5 /libavcodec/aacdec.c | |
parent | d8710228eaafbcf60aa72861de81fc849759ea0b (diff) | |
parent | 38d553322891c8e47182f05199d19888422167dc (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
pixdesc: mark pseudopaletted formats with a special flag.
avconv: switch to avcodec_encode_video2().
libx264: implement encode2().
libx264: split extradata writing out of encode_nals().
lavc: add avcodec_encode_video2() that encodes from an AVFrame -> AVPacket
cmdutils: update copyright year to 2012.
swscale: sign-extend integer function argument to qword on x86-64.
x86inc: support yasm -f win64 flag also.
h264: manually save/restore XMM registers for functions using INIT_MMX.
x86inc: allow manual use of WIN64_SPILL_XMM.
aacdec: Use correct speaker order for 7.1.
aacdec: Remove incorrect comment.
aacdec: Simplify output configuration.
Remove Sun medialib glue code.
dsputil: set STRIDE_ALIGN to 16 for x86 also.
pngdsp: swap argument inversion.
Conflicts:
cmdutils.c
configure
doc/APIchanges
ffmpeg.c
libavcodec/aacdec.c
libavcodec/dsputil.h
libavcodec/libx264.c
libavcodec/mlib/dsputil_mlib.c
libavcodec/utils.c
libavfilter/vf_scale.c
libavutil/avutil.h
libswscale/mlib/yuv2rgb_mlib.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r-- | libavcodec/aacdec.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 77ee59f0ab..4e591222fc 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -189,10 +189,10 @@ static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID]) * @return Returns error status. 0 - OK, !0 - error */ static av_cold int che_configure(AACContext *ac, - enum ChannelPosition che_pos[4][MAX_ELEM_ID], + enum ChannelPosition che_pos, int type, int id, int *channels) { - if (che_pos[type][id]) { + if (che_pos) { if (!ac->che[type][id]) { if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement)))) return AVERROR(ENOMEM); @@ -222,22 +222,21 @@ static av_cold int che_configure(AACContext *ac, * @return Returns error status. 0 - OK, !0 - error */ static av_cold int output_configure(AACContext *ac, - enum ChannelPosition che_pos[4][MAX_ELEM_ID], enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config, enum OCStatus oc_type) { AVCodecContext *avctx = ac->avctx; int i, type, channels = 0, ret; - if (new_che_pos != che_pos) - memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); + if (new_che_pos) + memcpy(ac->che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); if (channel_config) { for (i = 0; i < tags_per_config[channel_config]; i++) { - if ((ret = che_configure(ac, che_pos, - aac_channel_layout_map[channel_config - 1][i][0], - aac_channel_layout_map[channel_config - 1][i][1], - &channels))) + int id = aac_channel_layout_map[channel_config - 1][i][1]; + type = aac_channel_layout_map[channel_config - 1][i][0]; + if ((ret = che_configure(ac, ac->che_pos[type][id], + type, id, &channels))) return ret; } @@ -249,14 +248,12 @@ static av_cold int output_configure(AACContext *ac, * current program configuration. * * Set up default 1:1 output mapping. - * - * For a 5.1 stream the output order will be: - * [ Center ] [ Front Left ] [ Front Right ] [ LFE ] [ Surround Left ] [ Surround Right ] */ for (i = 0; i < MAX_ELEM_ID; i++) { for (type = 0; type < 4; type++) { - if ((ret = che_configure(ac, che_pos, type, i, &channels))) + if ((ret = che_configure(ac, ac->che_pos[type][i], + type, i, &channels))) return ret; } } @@ -456,7 +453,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx, } else if (m4ac->sbr == 1 && m4ac->ps == -1) m4ac->ps = 1; - if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR))) + if (ac && (ret = output_configure(ac, new_che_pos, channel_config, OC_GLOBAL_HDR))) return ret; if (extension_flag) { @@ -629,7 +626,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) if (ac->m4ac.chan_config) { int ret = set_default_channel_config(avctx, new_che_pos, ac->m4ac.chan_config); if (!ret) - output_configure(ac, ac->che_pos, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR); + output_configure(ac, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR); else if (avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } @@ -1733,7 +1730,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, } else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) { ac->m4ac.sbr = 1; ac->m4ac.ps = 1; - output_configure(ac, ac->che_pos, ac->che_pos, ac->m4ac.chan_config, ac->output_configured); + output_configure(ac, NULL, ac->m4ac.chan_config, ac->output_configured); } else { ac->m4ac.sbr = 1; } @@ -2116,7 +2113,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) ac->m4ac.chan_config = hdr_info.chan_config; if (set_default_channel_config(ac->avctx, new_che_pos, hdr_info.chan_config)) return -7; - if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config, + if (output_configure(ac, new_che_pos, hdr_info.chan_config, FFMAX(ac->output_configured, OC_TRIAL_FRAME))) return -7; } else if (ac->output_configured != OC_LOCKED) { @@ -2176,7 +2173,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, if (set_default_channel_config(ac->avctx, new_che_pos, 2)<0) return -1; - if (output_configure(ac, ac->che_pos, new_che_pos, 2, OC_TRIAL_FRAME)<0) + if (output_configure(ac, new_che_pos, 2, OC_TRIAL_FRAME)<0) return -1; } if (!(che=get_che(ac, elem_type, elem_id))) { @@ -2220,7 +2217,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, if (ac->output_configured > OC_TRIAL_PCE) av_log(avctx, AV_LOG_INFO, "Evaluating a further program_config_element.\n"); - err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE); + err = output_configure(ac, new_che_pos, 0, OC_TRIAL_PCE); if (!err) ac->m4ac.chan_config = 0; break; |