diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-03-31 23:44:14 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-03-31 23:51:19 +0300 |
commit | b8e1456c25de18b8ecb8922d870bfe9161900d2a (patch) | |
tree | 551bb91156adc6c866c49938f5301b9b43639cad | |
parent | a8b93d4c81d09d13e37b5a87a3dfa958078cc5f0 (diff) | |
download | mpv-b8e1456c25de18b8ecb8922d870bfe9161900d2a.tar.bz2 mpv-b8e1456c25de18b8ecb8922d870bfe9161900d2a.tar.xz |
af_lavcac3enc: fix channel reordering
Reordering to libavcodec channel order was broken with libavcodec
versions using float input to the ac3 encoder because the reordering
code still assumed int16 sample size. Fix.
-rw-r--r-- | libaf/af_lavcac3enc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c index 819f3f7382..1042f3691e 100644 --- a/libaf/af_lavcac3enc.c +++ b/libaf/af_lavcac3enc.c @@ -180,6 +180,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) char *buf, *src, *dest; int max_output_len; int frame_num = (data->len + s->pending_len) / s->expect_len; + int samplesize = af_fmt2bits(s->in_sampleformat) / 8; if (s->add_iec61937_header) max_output_len = AC3_FRAME_SIZE * 2 * 2 * frame_num; @@ -230,7 +231,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, AF_CHANNEL_LAYOUT_LAVC_DEFAULT, c->nch, - s->expect_len / 2, 2); + s->expect_len / samplesize, samplesize); len = avcodec_encode_audio(s->lavc_actx, dest, destsize, (void *)s->pending_data); @@ -242,7 +243,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, AF_CHANNEL_LAYOUT_LAVC_DEFAULT, c->nch, - s->expect_len / 2, 2); + s->expect_len / samplesize, samplesize); len = avcodec_encode_audio(s->lavc_actx,dest,destsize,(void *)src); src += s->expect_len; left -= s->expect_len; |