summaryrefslogtreecommitdiff
path: root/libavcodec/wavpack.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 12:49:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-13 12:49:48 +0100
commit0dff771f31cffffec0e16944d3890564c2da16eb (patch)
tree6c6ab0759ebf48fd5a7a478f97fb2110b4c5ad6e /libavcodec/wavpack.c
parentdca6fb08a71b8201f0a32f9cff18e7753355733a (diff)
parent205a95f7b5178362874bc1e65eae9866723491c1 (diff)
Merge commit '205a95f7b5178362874bc1e65eae9866723491c1'
* commit '205a95f7b5178362874bc1e65eae9866723491c1': wmaenc: alloc/free coded_frame instead of keeping it in the WMACodecContext wma: decode directly to the user-provided AVFrame wmapro: decode directly to the user-provided AVFrame wavpack: decode directly to the user-provided AVFrame Conflicts: libavcodec/wavpack.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r--libavcodec/wavpack.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 574ce15d08..b5663b45df 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -129,7 +129,6 @@ typedef struct WavpackFrameContext {
typedef struct WavpackContext {
AVCodecContext *avctx;
- AVFrame frame;
WavpackFrameContext *fdec[WV_MAX_FRAME_DECODERS];
int fdec_num;
@@ -741,9 +740,6 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx)
s->fdec_num = 0;
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
return 0;
}
@@ -1183,6 +1179,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
WavpackContext *s = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
+ AVFrame *frame = data;
int frame_size, ret, frame_flags;
int samplecount = 0;
@@ -1218,12 +1215,12 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
- s->frame.nb_samples = s->samples + 1;
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = s->samples + 1;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- s->frame.nb_samples = s->samples;
+ frame->nb_samples = s->samples;
while (buf_size > 0) {
if (!s->multichannel) {
@@ -1244,7 +1241,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
if ((samplecount = wavpack_decode_block(avctx, s->block,
- s->frame.data[0], got_frame_ptr,
+ frame->data[0], got_frame_ptr,
buf, frame_size)) < 0) {
wavpack_decode_flush(avctx);
return AVERROR_INVALIDDATA;
@@ -1253,9 +1250,6 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
buf += frame_size; buf_size -= frame_size;
}
- if (*got_frame_ptr)
- *(AVFrame *)data = s->frame;
-
return avpkt->size;
}