mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-30 11:14:21 +00:00
audio: Separate channel maps out of SDL_AudioSpec.
This commit is contained in:
@@ -114,6 +114,7 @@ int SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s\n", SDL_GetError());
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
|
||||
SDL_ResumeAudioStreamDevice(stream);
|
||||
|
||||
return SDL_APP_CONTINUE;
|
||||
|
||||
@@ -1167,7 +1167,7 @@ static AVCodecContext *OpenAudioStream(AVFormatContext *ic, int stream, const AV
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_AudioSpec spec = { SDL_AUDIO_F32, codecpar->ch_layout.nb_channels, codecpar->sample_rate, SDL_FALSE };
|
||||
SDL_AudioSpec spec = { SDL_AUDIO_F32, codecpar->ch_layout.nb_channels, codecpar->sample_rate };
|
||||
audio = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, NULL, NULL);
|
||||
if (audio) {
|
||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(audio));
|
||||
@@ -1240,7 +1240,7 @@ static void InterleaveAudio(AVFrame *frame, const SDL_AudioSpec *spec)
|
||||
static void HandleAudioFrame(AVFrame *frame)
|
||||
{
|
||||
if (audio) {
|
||||
SDL_AudioSpec spec = { GetAudioFormat(frame->format), frame->ch_layout.nb_channels, frame->sample_rate, SDL_FALSE };
|
||||
SDL_AudioSpec spec = { GetAudioFormat(frame->format), frame->ch_layout.nb_channels, frame->sample_rate };
|
||||
SDL_SetAudioStreamFormat(audio, &spec, NULL);
|
||||
|
||||
if (frame->ch_layout.nb_channels > 1 && IsPlanarAudioFormat(frame->format)) {
|
||||
|
||||
Reference in New Issue
Block a user