# HG changeset patch # User reimar # Date 1186011400 0 # Node ID 30677153df210dbc436e9c124ac681959810a515 # Parent 0d483afee811e783be51c21c3908cddbe7e7d308 Set lavc_context->channels before opening the codec, it is sufficient to select the desired number of codecs for ffdca and does not break other codecs like ffvorbis that do not (re)set the channel number during decode. diff -r 0d483afee811 -r 30677153df21 libmpcodecs/ad_ffmpeg.c --- a/libmpcodecs/ad_ffmpeg.c Wed Aug 01 18:11:09 2007 +0000 +++ b/libmpcodecs/ad_ffmpeg.c Wed Aug 01 23:36:40 2007 +0000 @@ -86,6 +86,8 @@ lavc_context->extradata_size); } + // Set desired number of channels + lavc_context->channels = audio_output_channels; /* open it */ if (avcodec_open(lavc_context, lavc_codec) < 0) { mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_CantOpenCodec); @@ -105,8 +107,6 @@ sh_audio->ds->ss_mul = 2*sh_audio->wf->nChannels; // 1 byte*ch/packet } - // Set desired number of channels - lavc_context->channels = audio_output_channels; // Decode at least 1 byte: (to get header filled) x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size); if(x>0) sh_audio->a_buffer_len=x;