diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 11:36:28 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 11:39:05 +0100 |
commit | d13f434dbb55348b3ed761e4f4c2ff9c7be4ea4b (patch) | |
tree | 6591e3d29559c2dacdea43049b128790993be84c /libavcodec/adxenc.c | |
parent | 4789955ec4260f9e8f99b8d774ada2ad679d5630 (diff) | |
parent | e3db34291f4401a16f6ac92721617a9f33cd4c31 (diff) | |
download | ffmpeg-d13f434dbb55348b3ed761e4f4c2ff9c7be4ea4b.tar.gz |
Merge commit 'e3db34291f4401a16f6ac92721617a9f33cd4c31'
* commit 'e3db34291f4401a16f6ac92721617a9f33cd4c31':
amrnb: decode directly to the user-provided AVFrame
als: decode directly to the user-provided AVFrame
alac: decode directly to the user-provided AVFrame
adxenc: alloc/free coded_frame instead of keeping it in the ADXContext
adx: decode directly to the user-provided AVFrame
Conflicts:
libavcodec/alsdec.c
libavcodec/amrnbdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/adxenc.c')
-rw-r--r-- | libavcodec/adxenc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index 8514a0c9b1..fb8e06deb3 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -107,6 +107,14 @@ static int adx_encode_header(AVCodecContext *avctx, uint8_t *buf, int bufsize) return HEADER_SIZE; } +#if FF_API_OLD_ENCODE_AUDIO +static av_cold int adx_encode_close(AVCodecContext *avctx) +{ + av_freep(&avctx->coded_frame); + return 0; +} +#endif + static av_cold int adx_encode_init(AVCodecContext *avctx) { ADXContext *c = avctx->priv_data; @@ -118,8 +126,8 @@ static av_cold int adx_encode_init(AVCodecContext *avctx) avctx->frame_size = BLOCK_SAMPLES; #if FF_API_OLD_ENCODE_AUDIO - avcodec_get_frame_defaults(&c->frame); - avctx->coded_frame = &c->frame; + if (!(avctx->coded_frame = avcodec_alloc_frame())) + return AVERROR(ENOMEM); #endif /* the cutoff can be adjusted, but this seems to work pretty well */ @@ -167,6 +175,9 @@ AVCodec ff_adpcm_adx_encoder = { .id = AV_CODEC_ID_ADPCM_ADX, .priv_data_size = sizeof(ADXContext), .init = adx_encode_init, +#if FF_API_OLD_ENCODE_AUDIO + .close = adx_encode_close, +#endif .encode2 = adx_encode_frame, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, |