[SDL] Re: Re: extension for 2D with DRI

Mattias Engdegård f91-men at nada.kth.se
Thu Apr 13 18:22:58 PDT 2000


>LOL... Actually, this brings up another point- how would one synchronize
>video playback to run precisely at say, 30fps? I presume it's impossible to
>guarantee a locked framerate on a non-realtime OS, but many Windows apps do
>quite a good job of it...

Do you want exactly 30fps, or a multiple (or short fraction) of the frame
rate of your monitor? In the first case you have to resample your movie,
either by doing very expensive interpolation, or be cheap and just
duplicate a frame here and there. For the low quality of video playback on
a computer, I guess the latter is all right.

I would sleep for most part of the inter-frame delay, and then spin in a
loop, polling for vertical retrace. Either sleep on a timer (if your
tick granularity is good enough), or (on Linux) use the rtc device.
The reward of not hogging 100% CPU is that you aren't penalized for
gobbling up your entire timeslice all the time...




More information about the SDL mailing list