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.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23994 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-08-01 23:36:40 +00:00
parent af9942aa5a
commit c16275939d
1 changed files with 2 additions and 2 deletions

View File

@ -86,6 +86,8 @@ static int init(sh_audio_t *sh_audio)
lavc_context->extradata_size); lavc_context->extradata_size);
} }
// Set desired number of channels
lavc_context->channels = audio_output_channels;
/* open it */ /* open it */
if (avcodec_open(lavc_context, lavc_codec) < 0) { if (avcodec_open(lavc_context, lavc_codec) < 0) {
mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_CantOpenCodec); mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_CantOpenCodec);
@ -105,8 +107,6 @@ static int init(sh_audio_t *sh_audio)
sh_audio->ds->ss_mul = 2*sh_audio->wf->nChannels; // 1 byte*ch/packet 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) // Decode at least 1 byte: (to get header filled)
x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size); x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size);
if(x>0) sh_audio->a_buffer_len=x; if(x>0) sh_audio->a_buffer_len=x;