That is correct, although given the proper buffer size, you can
between calls to your callback to find out when the audio data is
playing. In all environments, SDL will attempt to call your callback
buffer before it’s needed:
Could I ask you what you meant by the above?
I am working on a media player on an NT box. I am trying to sync the
video to the audio as best I can using the SDL API.
My attempt so far is to decode the first frame of a JPEG-encoded video
sequence , waiting in a loop (using SDL_Delay(5)), before blitting the
image to the screen. Once a flag to be set by the first audio callback
(that does the first fill of the sound card buffer) I start playing my
video sequence - this is to try and synchronise the video and audio at
the start of the clip.
At the end of the callback I note the start time of the audio for the
video clip, and during subsequent calls I get the current time then
calculate the frame I expect to be currently displayed (assuming sound
is played at correct rate!). I then set a correction (i.e. drop frames)
to nudge the video in the right direction.
I realise this is not very precise but is there some better idea?
thanks in advance.