On Sun, Oct 14, 2012 at 2:40 PM, Justin Ruggles
<justin.rugg...@gmail.com> wrote:
> ---
>  libavcodec/aac.h    |    7 ++-
>  libavcodec/aacdec.c |  104 
> +++++++++++++++++++++++++++++++--------------------
>  libavcodec/aacsbr.c |    6 +--
>  3 files changed, 69 insertions(+), 48 deletions(-)
>
> diff --git a/libavcodec/aac.h b/libavcodec/aac.h
> index 32baf9d..70470dd 100644
> --- a/libavcodec/aac.h
> +++ b/libavcodec/aac.h
> @@ -237,9 +237,10 @@ typedef struct SingleChannelElement {
>      uint8_t zeroes[128];                            ///< band is not coded 
> (used by encoder)
>      DECLARE_ALIGNED(32, float,   coeffs)[1024];     ///< coefficients for 
> IMDCT
>      DECLARE_ALIGNED(32, float,   saved)[1024];      ///< overlap
> -    DECLARE_ALIGNED(32, float,   ret)[2048];        ///< PCM output
> +    DECLARE_ALIGNED(32, float,   ret_buf)[2048];    ///< PCM output buffer
>      DECLARE_ALIGNED(16, float,   ltp_state)[3072];  ///< time signal for LTP
>      PredictorState predictor_state[MAX_PREDICTORS];
> +    float *ret;                                     ///< PCM output
>  } SingleChannelElement;
>

[...]

> +static int frame_configure_elements(AVCodecContext *avctx, int get_new_frame)
> +{
> +    AACContext *ac = avctx->priv_data;
> +    int type, id;
> +
> +    /* set channel pointers to internal buffers by default */
> +    for (type = 0; type < 4; type++) {
> +        for (id = 0; id < MAX_ELEM_ID; id++) {
> +            ChannelElement *che = ac->che[type][id];
> +            if (che) {
> +                che->ch[0].ret = che->ch[0].ret_buf;
> +                che->ch[1].ret = che->ch[1].ret_buf;
> +            }
> +        }
> +    }
> +
> +    if (get_new_frame) {
> +        int ch, ret;
> +
> +        /* get output buffer */
> +        ac->frame.nb_samples = 2048;
> +        if ((ret = avctx->get_buffer(avctx, &ac->frame)) < 0) {
> +            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> +            return ret;
> +        }
> +
> +        /* map output channel pointers to AVFrame data */
> +        for (ch = 0; ch < avctx->channels; ch++) {
> +            if (ac->output_element[ch])
> +                ac->output_element[ch]->ret = (float 
> *)ac->frame.extended_data[ch];
> +        }
> +    }
> +
> +    return 0;
> +}
> +

I'm somewhat unclear on the case where we are actually decoding to the
internal buffers. output_configure() without get_new_frame only seems
to be called from header parsing code.
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to