summaryrefslogtreecommitdiff
path: root/libavcodec/shorten.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-12-23 19:56:32 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2013-02-12 12:22:38 -0500
commitfed74c0ae497723f4756fab5cfe3ac9b04176edf (patch)
tree59575c8a202e049664bc74e3208db56dba4f3492 /libavcodec/shorten.c
parent5d5c248c3df30fa91a8dde639618c985b9a11c53 (diff)
shorten: decode directly to the user-provided AVFrame
Diffstat (limited to 'libavcodec/shorten.c')
-rw-r--r--libavcodec/shorten.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 0d022f67cc..e678ee8e6a 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -80,7 +80,6 @@ static const uint8_t is_audio_command[10] = { 1, 1, 1, 1, 0, 0, 0, 1, 1, 0 };
typedef struct ShortenContext {
AVCodecContext *avctx;
- AVFrame frame;
GetBitContext gb;
int min_framesize, max_framesize;
@@ -115,9 +114,6 @@ static av_cold int shorten_decode_init(AVCodecContext * avctx)
s->avctx = avctx;
avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
return 0;
}
@@ -408,6 +404,7 @@ static int read_header(ShortenContext *s)
static int shorten_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;
ShortenContext *s = avctx->priv_data;
@@ -582,17 +579,16 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
s->cur_chan++;
if (s->cur_chan == s->channels) {
/* get output buffer */
- s->frame.nb_samples = s->blocksize;
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = s->blocksize;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
/* interleave output */
- output_buffer((int16_t **)s->frame.extended_data, s->channels,
+ output_buffer((int16_t **)frame->extended_data, s->channels,
s->blocksize, s->decoded);
- *got_frame_ptr = 1;
- *(AVFrame *)data = s->frame;
+ *got_frame_ptr = 1;
}
}
}