diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-06-13 17:44:50 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-06-13 17:49:37 -0400 |
commit | 99477adc31c0569b3cebe8004dd584aa4726a2d1 (patch) | |
tree | 1569d3312cf71e9a5c4b152c221d44205b744a54 /libavcodec/ac3enc_template.c | |
parent | 35bdaf3d427b6856df01d41ee826bd515440ec46 (diff) | |
download | ffmpeg-99477adc31c0569b3cebe8004dd584aa4726a2d1.tar.gz |
ac3enc: fix allocation of floating point samples.
sizeof(SampleType) is different for fixed and float encoders.
Diffstat (limited to 'libavcodec/ac3enc_template.c')
-rw-r--r-- | libavcodec/ac3enc_template.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index d88fa225a1..0547165aaf 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -31,6 +31,26 @@ #include "ac3enc.h" +int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s) +{ + int ch; + + FF_ALLOC_OR_GOTO(s->avctx, s->windowed_samples, AC3_WINDOW_SIZE * + sizeof(*s->windowed_samples), alloc_fail); + FF_ALLOC_OR_GOTO(s->avctx, s->planar_samples, s->channels * sizeof(*s->planar_samples), + alloc_fail); + for (ch = 0; ch < s->channels; ch++) { + FF_ALLOCZ_OR_GOTO(s->avctx, s->planar_samples[ch], + (AC3_FRAME_SIZE+AC3_BLOCK_SIZE) * sizeof(**s->planar_samples), + alloc_fail); + } + + return 0; +alloc_fail: + return AVERROR(ENOMEM); +} + + /** * Deinterleave input samples. * Channels are reordered from Libav's default order to AC-3 order. |