diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 12:35:37 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 12:35:37 +0100 |
commit | 2becf21d9fd841962f87ad4e273274ee81a35bad (patch) | |
tree | 69b350cf5d5fc530698b6981442f1af89b221fac /libavcodec/takdec.c | |
parent | 08059f6150fcf75d884670cdbdbdf8830fa199bd (diff) | |
parent | 4a2b26fc1b1ad123eba473a20e270f2b0ba92bca (diff) | |
download | ffmpeg-2becf21d9fd841962f87ad4e273274ee81a35bad.tar.gz |
Merge commit '4a2b26fc1b1ad123eba473a20e270f2b0ba92bca'
* commit '4a2b26fc1b1ad123eba473a20e270f2b0ba92bca':
tak: decode directly to the user-provided AVFrame
smackaud: decode directly to the user-provided AVFrame
sipr: decode directly to the user-provided AVFrame
shorten: decode directly to the user-provided AVFrame
Conflicts:
libavcodec/shorten.c
libavcodec/takdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/takdec.c')
-rw-r--r-- | libavcodec/takdec.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c index f6cacb02c8..ae751fed16 100644 --- a/libavcodec/takdec.c +++ b/libavcodec/takdec.c @@ -45,7 +45,6 @@ typedef struct MCDParam { typedef struct TAKDecContext { AVCodecContext *avctx; ///< parent AVCodecContext - AVFrame frame; ///< AVFrame for decoded output DSPContext dsp; TAKStreamInfo ti; GetBitContext gb; ///< bitstream reader initialized to start at the current frame @@ -175,8 +174,6 @@ static av_cold int tak_decode_init(AVCodecContext *avctx) ff_dsputil_init(&s->dsp, avctx); s->avctx = avctx; - avcodec_get_frame_defaults(&s->frame); - avctx->coded_frame = &s->frame; avctx->bits_per_raw_sample = avctx->bits_per_coded_sample; set_sample_rate_params(avctx); @@ -688,6 +685,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt) { TAKDecContext *s = avctx->priv_data; + AVFrame *frame = data; GetBitContext *gb = &s->gb; int chan, i, ret, hsize; @@ -750,8 +748,8 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples : s->ti.frame_samples; - s->frame.nb_samples = s->nb_samples; - if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) + frame->nb_samples = s->nb_samples; + if ((ret = ff_get_buffer(avctx, frame)) < 0) return ret; if (avctx->bits_per_raw_sample <= 16) { @@ -768,7 +766,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, return ret; } else { for (chan = 0; chan < avctx->channels; chan++) - s->decoded[chan] = (int32_t *)s->frame.extended_data[chan]; + s->decoded[chan] = (int32_t *)frame->extended_data[chan]; } if (s->nb_samples < 16) { @@ -886,7 +884,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, switch (avctx->sample_fmt) { case AV_SAMPLE_FMT_U8P: for (chan = 0; chan < avctx->channels; chan++) { - uint8_t *samples = (uint8_t *)s->frame.extended_data[chan]; + uint8_t *samples = (uint8_t *)frame->extended_data[chan]; int32_t *decoded = s->decoded[chan]; for (i = 0; i < s->nb_samples; i++) samples[i] = decoded[i] + 0x80; @@ -894,7 +892,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, break; case AV_SAMPLE_FMT_S16P: for (chan = 0; chan < avctx->channels; chan++) { - int16_t *samples = (int16_t *)s->frame.extended_data[chan]; + int16_t *samples = (int16_t *)frame->extended_data[chan]; int32_t *decoded = s->decoded[chan]; for (i = 0; i < s->nb_samples; i++) samples[i] = decoded[i]; @@ -902,15 +900,14 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, break; case AV_SAMPLE_FMT_S32P: for (chan = 0; chan < avctx->channels; chan++) { - int32_t *samples = (int32_t *)s->frame.extended_data[chan]; + int32_t *samples = (int32_t *)frame->extended_data[chan]; for (i = 0; i < s->nb_samples; i++) samples[i] <<= 8; } break; } - *got_frame_ptr = 1; - *(AVFrame *)data = s->frame; + *got_frame_ptr = 1; return pkt->size; } |