diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 12:42:14 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 12:42:14 +0100 |
commit | dca6fb08a71b8201f0a32f9cff18e7753355733a (patch) | |
tree | 010719ea90db7d04612fcdd871870119ecb04cfb /libavcodec/tta.c | |
parent | 2becf21d9fd841962f87ad4e273274ee81a35bad (diff) | |
parent | ee6ca11b657515ad736ec0d2b8635e098d0a2680 (diff) | |
download | ffmpeg-dca6fb08a71b8201f0a32f9cff18e7753355733a.tar.gz |
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/tta.c')
-rw-r--r-- | libavcodec/tta.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 9b51a05fb4..bcbe037b66 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -61,7 +61,6 @@ typedef struct TTAChannel { typedef struct TTAContext { AVClass *class; AVCodecContext *avctx; - AVFrame frame; GetBitContext gb; const AVCRC *crc_table; @@ -312,15 +311,13 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) return AVERROR_INVALIDDATA; } - avcodec_get_frame_defaults(&s->frame); - avctx->coded_frame = &s->frame; - return 0; } static int tta_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; TTAContext *s = avctx->priv_data; @@ -336,15 +333,15 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, init_get_bits(&s->gb, buf, buf_size*8); /* get output buffer */ - s->frame.nb_samples = framelen; - if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { + frame->nb_samples = framelen; + if ((ret = ff_get_buffer(avctx, frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } // decode directly to output buffer for 24-bit sample format if (s->bps == 3) - s->decode_buffer = (int32_t *)s->frame.data[0]; + s->decode_buffer = (int32_t *)frame->data[0]; // init per channel states for (i = 0; i < s->channels; i++) { @@ -433,7 +430,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, i++; // check for last frame if (i == s->last_frame_length && get_bits_left(&s->gb) / 8 == 4) { - s->frame.nb_samples = framelen = s->last_frame_length; + frame->nb_samples = framelen = s->last_frame_length; break; } } @@ -449,20 +446,20 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, // convert to output buffer switch (s->bps) { case 1: { - uint8_t *samples = (uint8_t *)s->frame.data[0]; + uint8_t *samples = (uint8_t *)frame->data[0]; for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) *samples++ = *p + 0x80; break; } case 2: { - int16_t *samples = (int16_t *)s->frame.data[0]; + int16_t *samples = (int16_t *)frame->data[0]; for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) *samples++ = *p; break; } case 3: { // shift samples for 24-bit sample format - int32_t *samples = (int32_t *)s->frame.data[0]; + int32_t *samples = (int32_t *)frame->data[0]; for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) *samples++ <<= 8; // reset decode buffer @@ -471,8 +468,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, } } - *got_frame_ptr = 1; - *(AVFrame *)data = s->frame; + *got_frame_ptr = 1; return buf_size; error: |