Mercurial > mplayer.hg
comparison libmpcodecs/ae_lavc.c @ 33501:3209d6cbc393
Fix encoding to formats taking input other than 16 bits per sample.
author | reimar |
---|---|
date | Sun, 12 Jun 2011 00:03:35 +0000 |
parents | c36fec5ba5b6 |
children | 2c1df9ec369a |
comparison
equal
deleted
inserted
replaced
33500:c36fec5ba5b6 | 33501:3209d6cbc393 |
---|---|
120 int n; | 120 int n; |
121 if ((encoder->params.channels == 6 || encoder->params.channels == 5) && | 121 if ((encoder->params.channels == 6 || encoder->params.channels == 5) && |
122 (!strcmp(lavc_acodec->name,"ac3") || | 122 (!strcmp(lavc_acodec->name,"ac3") || |
123 !strcmp(lavc_acodec->name,"libfaac"))) { | 123 !strcmp(lavc_acodec->name,"libfaac"))) { |
124 int isac3 = !strcmp(lavc_acodec->name,"ac3"); | 124 int isac3 = !strcmp(lavc_acodec->name,"ac3"); |
125 int bps = av_get_bytes_per_sample(lavc_actx->sample_fmt); | |
125 reorder_channel_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, | 126 reorder_channel_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, |
126 isac3 ? AF_CHANNEL_LAYOUT_LAVC_DEFAULT | 127 isac3 ? AF_CHANNEL_LAYOUT_LAVC_DEFAULT |
127 : AF_CHANNEL_LAYOUT_AAC_DEFAULT, | 128 : AF_CHANNEL_LAYOUT_AAC_DEFAULT, |
128 encoder->params.channels, | 129 encoder->params.channels, |
129 size / 2, 2); | 130 size / bps, bps); |
130 } | 131 } |
131 n = avcodec_encode_audio(lavc_actx, dest, size, src); | 132 n = avcodec_encode_audio(lavc_actx, dest, size, src); |
132 compressed_frame_size = n; | 133 compressed_frame_size = n; |
133 return n; | 134 return n; |
134 } | 135 } |
249 if(lavc_param_atag == 0x11) { | 250 if(lavc_param_atag == 0x11) { |
250 lavc_actx->block_align = 2048; | 251 lavc_actx->block_align = 2048; |
251 lavc_actx->frame_size = (lavc_actx->block_align - 4 * lavc_actx->channels) * 8 / (4 * lavc_actx->channels) + 1; | 252 lavc_actx->frame_size = (lavc_actx->block_align - 4 * lavc_actx->channels) * 8 / (4 * lavc_actx->channels) + 1; |
252 } | 253 } |
253 | 254 |
254 encoder->decode_buffer_size = lavc_actx->frame_size * 2 * encoder->params.channels; | 255 encoder->decode_buffer_size = lavc_actx->frame_size * |
256 av_get_bytes_per_sample(lavc_actx->sample_fmt) * | |
257 encoder->params.channels; | |
255 while (encoder->decode_buffer_size < 1024) encoder->decode_buffer_size *= 2; | 258 while (encoder->decode_buffer_size < 1024) encoder->decode_buffer_size *= 2; |
256 encoder->bind = bind_lavc; | 259 encoder->bind = bind_lavc; |
257 encoder->get_frame_size = get_frame_size; | 260 encoder->get_frame_size = get_frame_size; |
258 encoder->encode = encode_lavc; | 261 encoder->encode = encode_lavc; |
259 encoder->close = close_lavc; | 262 encoder->close = close_lavc; |