[MPlayer-cvslog] r33589 - trunk/libmpcodecs/ae_lavc.c
reimar
subversion at mplayerhq.hu
Sun Jun 12 02:03:36 CEST 2011
Author: reimar
Date: Sun Jun 12 02:03:35 2011
New Revision: 33589
Log:
Fix encoding to formats taking input other than 16 bits per sample.
Modified:
trunk/libmpcodecs/ae_lavc.c
Modified: trunk/libmpcodecs/ae_lavc.c
==============================================================================
--- trunk/libmpcodecs/ae_lavc.c Sun Jun 12 01:36:52 2011 (r33588)
+++ trunk/libmpcodecs/ae_lavc.c Sun Jun 12 02:03:35 2011 (r33589)
@@ -122,11 +122,12 @@ static int encode_lavc(audio_encoder_t *
(!strcmp(lavc_acodec->name,"ac3") ||
!strcmp(lavc_acodec->name,"libfaac"))) {
int isac3 = !strcmp(lavc_acodec->name,"ac3");
+ int bps = av_get_bytes_per_sample(lavc_actx->sample_fmt);
reorder_channel_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
isac3 ? AF_CHANNEL_LAYOUT_LAVC_DEFAULT
: AF_CHANNEL_LAYOUT_AAC_DEFAULT,
encoder->params.channels,
- size / 2, 2);
+ size / bps, bps);
}
n = avcodec_encode_audio(lavc_actx, dest, size, src);
compressed_frame_size = n;
@@ -251,7 +252,9 @@ int mpae_init_lavc(audio_encoder_t *enco
lavc_actx->frame_size = (lavc_actx->block_align - 4 * lavc_actx->channels) * 8 / (4 * lavc_actx->channels) + 1;
}
- encoder->decode_buffer_size = lavc_actx->frame_size * 2 * encoder->params.channels;
+ encoder->decode_buffer_size = lavc_actx->frame_size *
+ av_get_bytes_per_sample(lavc_actx->sample_fmt) *
+ encoder->params.channels;
while (encoder->decode_buffer_size < 1024) encoder->decode_buffer_size *= 2;
encoder->bind = bind_lavc;
encoder->get_frame_size = get_frame_size;
More information about the MPlayer-cvslog
mailing list