summaryrefslogtreecommitdiff
path: root/libavcodec/vmdav.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 12:42:14 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-13 12:42:14 +0100
commitdca6fb08a71b8201f0a32f9cff18e7753355733a (patch)
tree010719ea90db7d04612fcdd871870119ecb04cfb /libavcodec/vmdav.c
parent2becf21d9fd841962f87ad4e273274ee81a35bad (diff)
parentee6ca11b657515ad736ec0d2b8635e098d0a2680 (diff)
Merge commit 'ee6ca11b657515ad736ec0d2b8635e098d0a2680'
* commit 'ee6ca11b657515ad736ec0d2b8635e098d0a2680': vorbis: decode directly to the user-provided AVFrame vmdaudio: decode directly to the user-provided AVFrame twinvq: decode directly to the user-provided AVFrame tta: decode directly to the user-provided AVFrame truespeech: decode directly to the user-provided AVFrame Conflicts: libavcodec/tta.c libavcodec/twinvq.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vmdav.c')
-rw-r--r--libavcodec/vmdav.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
index 6da60c14a1..d7f136c8a1 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -469,7 +469,6 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx)
#define BLOCK_TYPE_SILENCE 3
typedef struct VmdAudioContext {
- AVFrame frame;
int out_bps;
int chunk_size;
} VmdAudioContext;
@@ -514,9 +513,6 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
s->chunk_size = avctx->block_align + avctx->channels * (s->out_bps == 2);
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, "
"block align = %d, sample rate = %d\n",
avctx->channels, avctx->bits_per_coded_sample, avctx->block_align,
@@ -557,6 +553,7 @@ static void decode_audio_s16(int16_t *out, const uint8_t *buf, int buf_size,
static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end;
int buf_size = avpkt->size;
@@ -601,13 +598,14 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
audio_chunks = buf_size / s->chunk_size;
/* get output buffer */
- s->frame.nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) / avctx->channels;
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) /
+ avctx->channels;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- output_samples_u8 = s->frame.data[0];
- output_samples_s16 = (int16_t *)s->frame.data[0];
+ output_samples_u8 = frame->data[0];
+ output_samples_s16 = (int16_t *)frame->data[0];
/* decode silent chunks */
if (silent_chunks > 0) {
@@ -637,8 +635,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
}
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = s->frame;
+ *got_frame_ptr = 1;
return avpkt->size;
}