Index: video.c
===================================================================
--- video.c	(revision 538)
+++ video.c	(revision 539)
@@ -17,6 +17,8 @@
 {
 int i;
 
+raydium_video_current_with_sound=-1;
+
 for(i=0;i<RAYDIUM_MAX_VIDEOS;i++)
     {
     raydium_video_video[i].state=0;
@@ -90,8 +92,7 @@
 jpeg_destroy_decompress(&cinfo);
 }
 
-
-int raydium_video_open(char *filename, char *as)
+int raydium_video_open_with_sound(char *filename, char *as, char *ogg)
 {
 int id;
 char head[100];
@@ -177,10 +178,24 @@
 raydium_video_video[id].fps,
 raydium_video_video[id].frames_total);
 
+if(ogg!=NULL && strlen(ogg)>0)
+    {
+    if(raydium_sound_load_music(ogg)<0)
+	raydium_log("cannot sync '%s' audio to video '%s'",ogg,as);
+    else
+	raydium_video_current_with_sound=id;
+    }
+
 return id;
 }
 
 
+int raydium_video_open(char *filename, char *as)
+{
+return raydium_video_open_with_sound(filename,as,NULL);
+}
+
+
 void raydium_video_callback_video(int id)
 {
 int current;
@@ -196,6 +211,8 @@
     {
     if(!raydium_video_video[id].loop)
 	{
+	if(raydium_video_current_with_sound==id)
+	    raydium_video_current_with_sound=-1;
 	raydium_video_video[id].playing=0;
 	return;
 	}
@@ -228,6 +245,15 @@
 	}
 }
 
+
+float raydium_video_sound_callback(void)
+{
+if(raydium_video_current_with_sound<0)
+    return 0; // There's no video with sound right now
+
+return raydium_video_video[raydium_video_current_with_sound].elapsed;
+}
+
 void raydium_video_delete(int id)
 {
 if(!raydium_video_isvalid(id))