开发者

How to switch from Stereo to mono

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜