diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 11:53:23 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 11:53:23 +0100 |
commit | 0a5138695aa441ab341b2f00d946c239db69edbf (patch) | |
tree | 900049ab4690d9511ae2ccad787e0000694529cb /libavcodec/bmv.c | |
parent | f03cdbd0454fbdba53a123a8f95186a519fade8d (diff) | |
parent | 182821cff43f5f977004d105b86c47ceb20d00d6 (diff) | |
download | ffmpeg-0a5138695aa441ab341b2f00d946c239db69edbf.tar.gz |
Merge commit '182821cff43f5f977004d105b86c47ceb20d00d6'
* commit '182821cff43f5f977004d105b86c47ceb20d00d6':
dca: decode directly to the user-provided AVFrame
cook: decode directly to the user-provided AVFrame
comfortnoise: decode directly to the user-provided AVFrame
bmvaudio: decode directly to the user-provided AVFrame
pcm: decode directly to the user-provided AVFrame
Conflicts:
libavcodec/pcm.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/bmv.c')
-rw-r--r-- | libavcodec/bmv.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 715e6a3b62..c480815333 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -302,32 +302,23 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -typedef struct BMVAudioDecContext { - AVFrame frame; -} BMVAudioDecContext; - static const int bmv_aud_mults[16] = { 16512, 8256, 4128, 2064, 1032, 516, 258, 192, 129, 88, 64, 56, 48, 40, 36, 32 }; static av_cold int bmv_aud_decode_init(AVCodecContext *avctx) { - BMVAudioDecContext *c = avctx->priv_data; - avctx->channels = 2; avctx->channel_layout = AV_CH_LAYOUT_STEREO; avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avcodec_get_frame_defaults(&c->frame); - avctx->coded_frame = &c->frame; - return 0; } static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { - BMVAudioDecContext *c = avctx->priv_data; + AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int blocks = 0, total_blocks, i; @@ -343,12 +334,12 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data, } /* get output buffer */ - c->frame.nb_samples = total_blocks * 32; - if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { + frame->nb_samples = total_blocks * 32; + if ((ret = ff_get_buffer(avctx, frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - output_samples = (int16_t *)c->frame.data[0]; + output_samples = (int16_t *)frame->data[0]; for (blocks = 0; blocks < total_blocks; blocks++) { uint8_t code = *buf++; @@ -361,8 +352,7 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data, } } - *got_frame_ptr = 1; - *(AVFrame *)data = c->frame; + *got_frame_ptr = 1; return buf_size; } @@ -383,7 +373,6 @@ AVCodec ff_bmv_audio_decoder = { .name = "bmv_audio", .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_BMV_AUDIO, - .priv_data_size = sizeof(BMVAudioDecContext), .init = bmv_aud_decode_init, .decode = bmv_aud_decode_frame, .capabilities = CODEC_CAP_DR1, |