On Wed,  9 Jan 2013 12:11:55 -0500, Justin Ruggles <justin.rugg...@gmail.com> 
wrote:
> ---
>  libavcodec/mpc.h  |    1 -
>  libavcodec/mpc7.c |   13 +++++--------
>  libavcodec/mpc8.c |   13 +++++--------
>  3 files changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h
> index 86d4b6d..cbb121e 100644
> --- a/libavcodec/mpc.h
> +++ b/libavcodec/mpc.h
> @@ -50,7 +50,6 @@ typedef struct Band {
>  }Band;
>  
>  typedef struct MPCContext {
> -    AVFrame frame;
>      DSPContext dsp;
>      MPADSPContext mpadsp;
>      GetBitContext gb;
> diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
> index ab6fd9f..a253753 100644
> --- a/libavcodec/mpc7.c
> +++ b/libavcodec/mpc7.c
> @@ -138,9 +138,6 @@ static av_cold int mpc7_decode_init(AVCodecContext * 
> avctx)
>      }
>      vlc_initialized = 1;
>  
> -    avcodec_get_frame_defaults(&c->frame);
> -    avctx->coded_frame = &c->frame;
> -
>      return 0;
>  }
>  
> @@ -200,6 +197,7 @@ static int get_scale_idx(GetBitContext *gb, int ref)
>  static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
>                               int *got_frame_ptr, AVPacket *avpkt)
>  {
> +    AVFrame *frame     = data;
>      const uint8_t *buf = avpkt->data;
>      int buf_size;
>      MPCContext *c = avctx->priv_data;
> @@ -229,8 +227,8 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void 
> *data,
>      buf_size  -= 4;
>  
>      /* get output buffer */
> -    c->frame.nb_samples = last_frame ? c->lastframelen : MPC_FRAME_SIZE;
> -    if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
> +    frame->nb_samples = last_frame ? c->lastframelen : MPC_FRAME_SIZE;
> +    if ((ret = ff_get_buffer(avctx, frame)) < 0) {
>          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>          return ret;
>      }
> @@ -294,7 +292,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void 
> *data,
>          for(ch = 0; ch < 2; ch++)
>              idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off);
>  
> -    ff_mpc_dequantize_and_synth(c, mb, (int16_t **)c->frame.extended_data, 
> 2);
> +    ff_mpc_dequantize_and_synth(c, mb, (int16_t **)frame->extended_data, 2);
>  
>      bits_used = get_bits_count(&gb);
>      bits_avail = buf_size * 8;
> @@ -308,8 +306,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void 
> *data,
>          return avpkt->size;
>      }
>  
> -    *got_frame_ptr   = 1;
> -    *(AVFrame *)data = c->frame;
> +    *got_frame_ptr = 1;
>  
>      return avpkt->size;
>  }
> diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
> index a270be3..1b32c4b 100644
> --- a/libavcodec/mpc8.c
> +++ b/libavcodec/mpc8.c
> @@ -230,15 +230,13 @@ static av_cold int mpc8_decode_init(AVCodecContext * 
> avctx)
>      }
>      vlc_initialized = 1;
>  
> -    avcodec_get_frame_defaults(&c->frame);
> -    avctx->coded_frame = &c->frame;
> -
>      return 0;
>  }
>  
>  static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
>                               int *got_frame_ptr, AVPacket *avpkt)
>  {
> +    AVFrame *frame     = data;
>      const uint8_t *buf = avpkt->data;
>      int buf_size = avpkt->size;
>      MPCContext *c = avctx->priv_data;
> @@ -250,8 +248,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void 
> *data,
>      int last[2];
>  
>      /* get output buffer */
> -    c->frame.nb_samples = MPC_FRAME_SIZE;
> -    if ((res = ff_get_buffer(avctx, &c->frame)) < 0) {
> +    frame->nb_samples = MPC_FRAME_SIZE;
> +    if ((res = ff_get_buffer(avctx, frame)) < 0) {
>          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>          return res;
>      }
> @@ -407,7 +405,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void 
> *data,
>      }
>  
>      ff_mpc_dequantize_and_synth(c, maxband - 1,
> -                                (int16_t **)c->frame.extended_data,
> +                                (int16_t **)frame->extended_data,
>                                  avctx->channels);
>  
>      c->cur_frame++;
> @@ -418,8 +416,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void 
> *data,
>      if(c->cur_frame >= c->frames)
>          c->cur_frame = 0;
>  
> -    *got_frame_ptr   = 1;
> -    *(AVFrame *)data = c->frame;
> +    *got_frame_ptr = 1;
>  
>      return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
>  }
> -- 
> 1.7.1

Ok.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to