Smpeg/glmovie sync problem

The speed problem with glmovie is a result of a time problem that bites
timeSync() (in gdith.cpp). The code determines “real time” by calling
CurrentTime(vid_stream). If mpeg->TimeSource() does not return NULL,
CurrentTime() uses mpeg->TimeSource()->Time(), otherwise it uses
ReadSysClock(). When audio is enabled (EnableAudio(TRUE)) the pointer
time_source (which TimeSource() returns) is initialized, and although I
haven’t gone far into this I think it means that the audio timing is
used (somehow).

In glmovie.c SMPEG_enableaudio() is not called, and apparently
time_source is not NULL. Adding
SMPEG_enableaudio( mpeg, 0 );
to glmovie.c (just before SMPEG_setdisplay()) causes time_source to be
set to NULL, and the video plays OK (almost, see below). I am not
sufficiently familiar with C++ to be sure how to do it, but it seems
that a default initialization of time_source to NULL would remove the
necessity for the call to SMPEG_enableaudio().

If I do
SMPEG_enableaudio( mpeg, 1 );
i.e. try to initialize audio the speed problem is still there. This
could be related to the fact that sound is not working on my system. I
think I have an interrupt conflict with an I/O card.

Interestingly, plaympeg.c calls both SMPEG_enableaudio() and
SMPEG_enablevideo(), but glmovie.c calls neither. Apparently
SMPEG_enablevideo() is not needed?

There are still other problems with glmovie. I have been testing with
the callback to the draw function turned off, and with the draw function
called in the main loop. Playing my 6 sec test mpeg file, it starts
about 1 sec into the movie. I have no idea what causes the initial
frames to be dropped, but I’ll try to track it down.

It is not a good idea to do the drawing like this, because the function
always gets called about 6 or 7 times in quick succession, redrawing the
same image. This seems to happen in the ~30ms when ExecuteDisplay() is
executing. There isn’t much CPU cost though, because the OpenGL draw
functions use the GPU.

I’d appreciate it if someone could give me a quick explanation of how
the time system works with audio enabled.

Gib--------------------------------------------
Gib Bogle @Gib_Bogle
1/44 Arthur St Tel: (64-9) 525-6878
Ellerslie, N.Z. Fax: (64-9) 525-6878