summaryrefslogtreecommitdiff
path: root/libavcodec/vorbisdec.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/vorbisdec.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/vorbisdec.c')
-rw-r--r--libavcodec/vorbisdec.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index deaf4fd7dc..645673c0c6 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -125,7 +125,6 @@ typedef struct {
typedef struct vorbis_context_s {
AVCodecContext *avccontext;
- AVFrame frame;
GetBitContext gb;
VorbisDSPContext dsp;
AVFloatDSPContext fdsp;
@@ -1040,9 +1039,6 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
avccontext->channels = vc->audio_channels;
avccontext->sample_rate = vc->audio_samplerate;
- avcodec_get_frame_defaults(&vc->frame);
- avccontext->coded_frame = &vc->frame;
-
return 0;
}
@@ -1653,6 +1649,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
vorbis_context *vc = avccontext->priv_data;
+ AVFrame *frame = data;
GetBitContext *gb = &vc->gb;
float *channel_ptrs[255];
int i, len, ret;
@@ -1699,19 +1696,19 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
}
/* get output buffer */
- vc->frame.nb_samples = vc->blocksize[1] / 2;
- if ((ret = ff_get_buffer(avccontext, &vc->frame)) < 0) {
+ frame->nb_samples = vc->blocksize[1] / 2;
+ if ((ret = ff_get_buffer(avccontext, frame)) < 0) {
av_log(avccontext, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
if (vc->audio_channels > 8) {
for (i = 0; i < vc->audio_channels; i++)
- channel_ptrs[i] = (float *)vc->frame.extended_data[i];
+ channel_ptrs[i] = (float *)frame->extended_data[i];
} else {
for (i = 0; i < vc->audio_channels; i++) {
int ch = ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i];
- channel_ptrs[ch] = (float *)vc->frame.extended_data[i];
+ channel_ptrs[ch] = (float *)frame->extended_data[i];
}
}
@@ -1729,9 +1726,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
av_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",
get_bits_count(gb) / 8, get_bits_count(gb) % 8, len);
- vc->frame.nb_samples = len;
- *got_frame_ptr = 1;
- *(AVFrame *)data = vc->frame;
+ frame->nb_samples = len;
+ *got_frame_ptr = 1;
return buf_size;
}