diff options
author | Alex Converse <alex.converse@gmail.com> | 2010-06-05 15:22:19 +0000 |
---|---|---|
committer | Alex Converse <alex.converse@gmail.com> | 2010-06-05 15:22:19 +0000 |
commit | dd8871a63b675b2f43879bd348eba0d4fd1b4078 (patch) | |
tree | 8a777c18d482772054aac18c3359710c2d7f4bbf /libavcodec/aac.c | |
parent | 4cd5100caf01a2d647e4edd4120ffa9d4ecaf265 (diff) | |
download | ffmpeg-dd8871a63b675b2f43879bd348eba0d4fd1b4078.tar.gz |
aacdec: Rename avccontext to avctx.
Originally committed as revision 23488 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/aac.c')
-rw-r--r-- | libavcodec/aac.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/libavcodec/aac.c b/libavcodec/aac.c index d510fcf7a5..ebbc4cd205 100644 --- a/libavcodec/aac.c +++ b/libavcodec/aac.c @@ -120,7 +120,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) int err_printed = 0; while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) { if (ac->output_configured < OC_LOCKED && !err_printed) { - av_log(ac->avccontext, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n"); + av_log(ac->avctx, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n"); err_printed = 1; } elem_id++; @@ -225,7 +225,7 @@ static av_cold int output_configure(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config, enum OCStatus oc_type) { - AVCodecContext *avctx = ac->avccontext; + AVCodecContext *avctx = ac->avctx; int i, type, channels = 0, ret; memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); @@ -308,7 +308,7 @@ static int decode_pce(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_EL sampling_index = get_bits(gb, 4); if (ac->m4ac.sampling_index != sampling_index) - av_log(ac->avccontext, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n"); + av_log(ac->avctx, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n"); num_front = get_bits(gb, 4); num_side = get_bits(gb, 4); @@ -339,7 +339,7 @@ static int decode_pce(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_EL /* comment field, first byte is length */ comment_len = get_bits(gb, 8) * 8; if (get_bits_left(gb) < comment_len) { - av_log(ac->avccontext, AV_LOG_ERROR, overread_err); + av_log(ac->avctx, AV_LOG_ERROR, overread_err); return -1; } skip_bits_long(gb, comment_len); @@ -359,7 +359,7 @@ static av_cold int set_default_channel_config(AACContext *ac, int channel_config) { if (channel_config < 1 || channel_config > 7) { - av_log(ac->avccontext, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", + av_log(ac->avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", channel_config); return -1; } @@ -404,7 +404,7 @@ static int decode_ga_specific_config(AACContext *ac, GetBitContext *gb, int extension_flag, ret; if (get_bits1(gb)) { // frameLengthFlag - av_log_missing_feature(ac->avccontext, "960/120 MDCT window is", 1); + av_log_missing_feature(ac->avctx, "960/120 MDCT window is", 1); return -1; } @@ -468,7 +468,7 @@ static int decode_audio_specific_config(AACContext *ac, void *data, if ((i = ff_mpeg4audio_get_config(&ac->m4ac, data, data_size)) < 0) return -1; if (ac->m4ac.sampling_index > 12) { - av_log(ac->avccontext, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); + av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); return -1; } @@ -481,7 +481,7 @@ static int decode_audio_specific_config(AACContext *ac, void *data, return -1; break; default: - av_log(ac->avccontext, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n", + av_log(ac->avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n", ac->m4ac.sbr == 1? "SBR+" : "", ac->m4ac.object_type); return -1; } @@ -524,20 +524,20 @@ static void reset_predictor_group(PredictorState *ps, int group_num) reset_predict_state(&ps[i]); } -static av_cold int aac_decode_init(AVCodecContext *avccontext) +static av_cold int aac_decode_init(AVCodecContext *avctx) { - AACContext *ac = avccontext->priv_data; + AACContext *ac = avctx->priv_data; int i; - ac->avccontext = avccontext; - ac->m4ac.sample_rate = avccontext->sample_rate; + ac->avctx = avctx; + ac->m4ac.sample_rate = avctx->sample_rate; - if (avccontext->extradata_size > 0) { - if (decode_audio_specific_config(ac, avccontext->extradata, avccontext->extradata_size)) + if (avctx->extradata_size > 0) { + if (decode_audio_specific_config(ac, avctx->extradata, avctx->extradata_size)) return -1; } - avccontext->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = SAMPLE_FMT_S16; AAC_INIT_VLC_STATIC( 0, 304); AAC_INIT_VLC_STATIC( 1, 270); @@ -553,7 +553,7 @@ static av_cold int aac_decode_init(AVCodecContext *avccontext) ff_aac_sbr_init(); - dsputil_init(&ac->dsp, avccontext); + dsputil_init(&ac->dsp, avctx); ac->random_state = 0x1f2e3d4c; @@ -607,7 +607,7 @@ static int skip_data_stream_element(AACContext *ac, GetBitContext *gb) align_get_bits(gb); if (get_bits_left(gb) < 8 * count) { - av_log(ac->avccontext, AV_LOG_ERROR, overread_err); + av_log(ac->avctx, AV_LOG_ERROR, overread_err); return -1; } skip_bits_long(gb, 8 * count); @@ -621,7 +621,7 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics, if (get_bits1(gb)) { ics->predictor_reset_group = get_bits(gb, 5); if (ics->predictor_reset_group == 0 || ics->predictor_reset_group > 30) { - av_log(ac->avccontext, AV_LOG_ERROR, "Invalid Predictor Reset Group.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "Invalid Predictor Reset Group.\n"); return -1; } } @@ -640,7 +640,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, GetBitContext *gb, int common_window) { if (get_bits1(gb)) { - av_log(ac->avccontext, AV_LOG_ERROR, "Reserved bit set.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n"); memset(ics, 0, sizeof(IndividualChannelStream)); return -1; } @@ -681,11 +681,11 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, return -1; } } else if (ac->m4ac.object_type == AOT_AAC_LC) { - av_log(ac->avccontext, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n"); memset(ics, 0, sizeof(IndividualChannelStream)); return -1; } else { - av_log_missing_feature(ac->avccontext, "Predictor bit set but LTP is", 1); + av_log_missing_feature(ac->avctx, "Predictor bit set but LTP is", 1); memset(ics, 0, sizeof(IndividualChannelStream)); return -1; } @@ -693,7 +693,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, } if (ics->max_sfb > ics->num_swb) { - av_log(ac->avccontext, AV_LOG_ERROR, + av_log(ac->avctx, AV_LOG_ERROR, "Number of scalefactor bands in group (%d) exceeds limit (%d).\n", ics->max_sfb, ics->num_swb); memset(ics, 0, sizeof(IndividualChannelStream)); @@ -724,18 +724,18 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120], int sect_len_incr; int sect_band_type = get_bits(gb, 4); if (sect_band_type == 12) { - av_log(ac->avccontext, AV_LOG_ERROR, "invalid band type\n"); + av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n"); return -1; } while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1) sect_end += sect_len_incr; sect_end += sect_len_incr; if (get_bits_left(gb) < 0) { - av_log(ac->avccontext, AV_LOG_ERROR, overread_err); + av_log(ac->avctx, AV_LOG_ERROR, overread_err); return -1; } if (sect_end > ics->max_sfb) { - av_log(ac->avccontext, AV_LOG_ERROR, + av_log(ac->avctx, AV_LOG_ERROR, "Number of bands (%d) exceeds limit (%d).\n", sect_end, ics->max_sfb); return -1; @@ -780,7 +780,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb, for (; i < run_end; i++, idx++) { offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60; if (offset[2] > 255U) { - av_log(ac->avccontext, AV_LOG_ERROR, + av_log(ac->avctx, AV_LOG_ERROR, "%s (%d) out of range.\n", sf_str[2], offset[2]); return -1; } @@ -793,7 +793,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb, else offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60; if (offset[1] > 255U) { - av_log(ac->avccontext, AV_LOG_ERROR, + av_log(ac->avctx, AV_LOG_ERROR, "%s (%d) out of range.\n", sf_str[1], offset[1]); return -1; } @@ -803,7 +803,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb, for (; i < run_end; i++, idx++) { offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60; if (offset[0] > 255U) { - av_log(ac->avccontext, AV_LOG_ERROR, + av_log(ac->avctx, AV_LOG_ERROR, "%s (%d) out of range.\n", sf_str[0], offset[0]); return -1; } @@ -860,7 +860,7 @@ static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns, tns->length[w][filt] = get_bits(gb, 6 - 2 * is8); if ((tns->order[w][filt] = get_bits(gb, 5 - 2 * is8)) > tns_max_order) { - av_log(ac->avccontext, AV_LOG_ERROR, "TNS filter order %d is greater than maximum %d.\n", + av_log(ac->avctx, AV_LOG_ERROR, "TNS filter order %d is greater than maximum %d.\n", tns->order[w][filt], tns_max_order); tns->order[w][filt] = 0; return -1; @@ -1179,7 +1179,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024], b = 31 - av_log2(~b); if (b > 8) { - av_log(ac->avccontext, AV_LOG_ERROR, "error in spectral data, ESC overflow\n"); + av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n"); return -1; } @@ -1232,7 +1232,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024], return 0; err_cb_overflow: - av_log(ac->avccontext, AV_LOG_ERROR, + av_log(ac->avctx, AV_LOG_ERROR, "Read beyond end of ff_aac_codebook_vectors[%d][]. index %d >= %d\n", band_type[idx], err_idx, ff_aac_spectral_sizes[band_type[idx]]); return -1; @@ -1353,18 +1353,18 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce, if (!scale_flag) { if ((pulse_present = get_bits1(gb))) { if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - av_log(ac->avccontext, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n"); return -1; } if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) { - av_log(ac->avccontext, AV_LOG_ERROR, "Pulse data corrupt or invalid.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "Pulse data corrupt or invalid.\n"); return -1; } } if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics)) return -1; if (get_bits1(gb)) { - av_log_missing_feature(ac->avccontext, "SSR", 1); + av_log_missing_feature(ac->avctx, "SSR", 1); return -1; } } @@ -1464,7 +1464,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe) cpe->ch[1].ics.use_kb_window[1] = i; ms_present = get_bits(gb, 2); if (ms_present == 3) { - av_log(ac->avccontext, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); return -1; } else if (ms_present) decode_mid_side_stereo(cpe, gb, ms_present); @@ -1651,14 +1651,14 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, crc_flag++; case EXT_SBR_DATA: if (!che) { - av_log(ac->avccontext, AV_LOG_ERROR, "SBR was found before the first channel element.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "SBR was found before the first channel element.\n"); return res; } else if (!ac->m4ac.sbr) { - av_log(ac->avccontext, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n"); skip_bits_long(gb, 8 * cnt - 4); return res; } else if (ac->m4ac.sbr == -1 && ac->output_configured == OC_LOCKED) { - av_log(ac->avccontext, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n"); + av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n"); skip_bits_long(gb, 8 * cnt - 4); return res; } else { @@ -1744,7 +1744,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float // imdct if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { if (ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) - av_log(ac->avccontext, AV_LOG_WARNING, + av_log(ac->avctx, AV_LOG_WARNING, "Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. " "If you heard an audible artifact, please submit the sample to the FFmpeg developers.\n"); for (i = 0; i < 1024; i += 128) @@ -1810,7 +1810,7 @@ static void apply_dependent_coupling(AACContext *ac, const float *src = cce->ch[0].coeffs; int g, i, group, k, idx = 0; if (ac->m4ac.object_type == AOT_AAC_LTP) { - av_log(ac->avccontext, AV_LOG_ERROR, + av_log(ac->avctx, AV_LOG_ERROR, "Dependent coupling is not supported together with LTP\n"); return; } @@ -1945,25 +1945,25 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) ac->m4ac.sample_rate = hdr_info.sample_rate; ac->m4ac.sampling_index = hdr_info.sampling_index; ac->m4ac.object_type = hdr_info.object_type; - if (!ac->avccontext->sample_rate) - ac->avccontext->sample_rate = hdr_info.sample_rate; + if (!ac->avctx->sample_rate) + ac->avctx->sample_rate = hdr_info.sample_rate; if (hdr_info.num_aac_frames == 1) { if (!hdr_info.crc_absent) skip_bits(gb, 16); } else { - av_log_missing_feature(ac->avccontext, "More than one AAC RDB per ADTS frame is", 0); + av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame is", 0); return -1; } } return size; } -static int aac_decode_frame(AVCodecContext *avccontext, void *data, +static int aac_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; - AACContext *ac = avccontext->priv_data; + AACContext *ac = avctx->priv_data; ChannelElement *che = NULL, *che_prev = NULL; GetBitContext gb; enum RawDataBlockType elem_type, elem_type_prev = TYPE_END; @@ -1976,11 +1976,11 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, if (show_bits(&gb, 12) == 0xfff) { if (parse_adts_frame_header(ac, &gb) < 0) { - av_log(avccontext, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); + av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); return -1; } if (ac->m4ac.sampling_index > 12) { - av_log(ac->avccontext, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); + av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); return -1; } } @@ -1991,7 +1991,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, elem_id = get_bits(&gb, 4); if (elem_type < TYPE_DSE && !(che=get_che(ac, elem_type, elem_id))) { - av_log(ac->avccontext, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); + av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); return -1; } @@ -2023,7 +2023,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, if ((err = decode_pce(ac, new_che_pos, &gb))) break; if (ac->output_configured > OC_TRIAL_PCE) - av_log(avccontext, AV_LOG_ERROR, + av_log(avctx, AV_LOG_ERROR, "Not evaluating a further program_config_element as this construct is dubious at best.\n"); else err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE); @@ -2034,7 +2034,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, if (elem_id == 15) elem_id += get_bits(&gb, 8) - 1; if (get_bits_left(&gb) < 8 * elem_id) { - av_log(avccontext, AV_LOG_ERROR, overread_err); + av_log(avctx, AV_LOG_ERROR, overread_err); return -1; } while (elem_id > 0) @@ -2054,7 +2054,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, return err; if (get_bits_left(&gb) < 3) { - av_log(avccontext, AV_LOG_ERROR, overread_err); + av_log(avctx, AV_LOG_ERROR, overread_err); return -1; } } @@ -2064,20 +2064,20 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, multiplier = (ac->m4ac.sbr == 1) ? ac->m4ac.ext_sample_rate > ac->m4ac.sample_rate : 0; samples <<= multiplier; if (ac->output_configured < OC_LOCKED) { - avccontext->sample_rate = ac->m4ac.sample_rate << multiplier; - avccontext->frame_size = samples; + avctx->sample_rate = ac->m4ac.sample_rate << multiplier; + avctx->frame_size = samples; } - data_size_tmp = samples * avccontext->channels * sizeof(int16_t); + data_size_tmp = samples * avctx->channels * sizeof(int16_t); if (*data_size < data_size_tmp) { - av_log(avccontext, AV_LOG_ERROR, + av_log(avctx, AV_LOG_ERROR, "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n", *data_size, data_size_tmp); return -1; } *data_size = data_size_tmp; - ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avccontext->channels); + ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels); if (ac->output_configured) ac->output_configured = OC_LOCKED; @@ -2090,9 +2090,9 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, return buf_size > buf_offset ? buf_consumed : buf_size; } -static av_cold int aac_decode_close(AVCodecContext *avccontext) +static av_cold int aac_decode_close(AVCodecContext *avctx) { - AACContext *ac = avccontext->priv_data; + AACContext *ac = avctx->priv_data; int i, type; for (i = 0; i < MAX_ELEM_ID; i++) { |