More than one audio callback - SDL_OpenAudio

Hey,

I’m trying to play 3 videos simultaneously (using ffmpeg) and i’m using SDL to play the audio of the films.
Problem is that I can only open the audio device once (using SDL_OpenAudio) and there’s only one audio callback function I can provide.
Is there any trick I can do to run 3 callback functions at the same time (one for each movie) ? or maybe there’s a better solution ?

thanks in advance!

Message-ID: <1400225143.m2f.43489 at forums.libsdl.org>
Content-Type: text/plain; charset=“iso-8859-1”

Hey,

I’m trying to play 3 videos simultaneously (using ffmpeg) and i’m using SDL to play the audio of the films.
Problem is that I can only open the audio device once (using SDL_OpenAudio) and there’s only one audio callback function I can provide.
Is there any trick I can do to run 3 callback functions at the same time (one for each movie) ? or maybe there’s a better solution ?

SDL can only use the one callback, but your callback can itself use as
many callbacks as you feel like. The only concern is performance
(hint: decode the audio outside of the callback, before you need it).> Date: Fri, 16 May 2014 07:25:43 +0000

From: “rouki” <roee.leonn at gmail.com>
To: sdl at lists.libsdl.org
Subject: [SDL] More than one audio callback - SDL_OpenAudio