I'm using SDL and FFMPEG to decode audio. my test file has combination of Stereo and mono channels. When i try to play the audio file the stereo part will play, but my application fails to play开发者_StackOverflow社区 when channel changes stereo to mono.
My FFMPEG is giving channel change From Stereo to mono. But how do i tell my SDL to play the Mono part.
I'm doing this in my app
aCodecCtx=pFormatCtx->streams[audioStream]->codec;
wanted_spec.freq = aCodecCtx->sample_rate;
wanted_spec.format = AUDIO_S16SYS;
wanted_spec.channels = aCodecCtx->channels;
wanted_spec.silence = 0;
wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
wanted_spec.callback = audio_callback;
wanted_spec.userdata = aCodecCtx;
if(SDL_OpenAudio(&wanted_spec, &spec) < 0) {
fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
return -1;
}
Can you tell me, How do i update channel change from stereo to mono at runtime.
精彩评论