summaryrefslogtreecommitdiff
path: root/libavcodec/mpc7.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-12-23 19:38:34 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2013-02-12 12:21:23 -0500
commit3a23752c5a065ce34dc56491836e1db1fc3b88ae (patch)
tree7a4fe60bbb2cb7e98716938af67cf2c65114393c /libavcodec/mpc7.c
parent2c785e250a1f4a6ee2b35e1c86dda79553d2a6c1 (diff)
mpc7/8: decode directly to the user-provided AVFrame
Diffstat (limited to 'libavcodec/mpc7.c')
-rw-r--r--libavcodec/mpc7.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
index 6a2b120230..f151f9c304 100644
--- a/libavcodec/mpc7.c
+++ b/libavcodec/mpc7.c
@@ -139,9 +139,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;
}
@@ -201,6 +198,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;
@@ -230,8 +228,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;
}
@@ -295,7 +293,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;
@@ -309,8 +307,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;
}