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/smacker.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/smacker.c')
-rw-r--r-- | libavcodec/smacker.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 1a73dcce0d..ad1d4c3171 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -572,14 +572,8 @@ static av_cold int decode_end(AVCodecContext *avctx) } -typedef struct SmackerAudioContext { - AVFrame frame; -} SmackerAudioContext; - static av_cold int smka_decode_init(AVCodecContext *avctx) { - SmackerAudioContext *s = avctx->priv_data; - if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); return AVERROR(EINVAL); @@ -587,9 +581,6 @@ static av_cold int smka_decode_init(AVCodecContext *avctx) avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16; - avcodec_get_frame_defaults(&s->frame); - avctx->coded_frame = &s->frame; - return 0; } @@ -599,7 +590,7 @@ static av_cold int smka_decode_init(AVCodecContext *avctx) static int smka_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { - SmackerAudioContext *s = avctx->priv_data; + AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; @@ -644,13 +635,13 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, } /* get output buffer */ - s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1)); - if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { + frame->nb_samples = unp_size / (avctx->channels * (bits + 1)); + if ((ret = ff_get_buffer(avctx, frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - samples = (int16_t *)s->frame.data[0]; - samples8 = s->frame.data[0]; + samples = (int16_t *)frame->data[0]; + samples8 = frame->data[0]; // Initialize for(i = 0; i < (1 << (bits + stereo)); i++) { @@ -769,8 +760,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, av_free(h[i].values); } - *got_frame_ptr = 1; - *(AVFrame *)data = s->frame; + *got_frame_ptr = 1; return buf_size; } @@ -791,7 +781,6 @@ AVCodec ff_smackaud_decoder = { .name = "smackaud", .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_SMACKAUDIO, - .priv_data_size = sizeof(SmackerAudioContext), .init = smka_decode_init, .decode = smka_decode_frame, .capabilities = CODEC_CAP_DR1, |