[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash gui/sdl.cpp ChangeLog
From: |
Martin Guy |
Subject: |
[Gnash-commit] gnash gui/sdl.cpp ChangeLog |
Date: |
Wed, 02 May 2007 21:56:49 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Martin Guy <martinwguy> 07/05/02 21:56:49
Modified files:
gui : sdl.cpp
. : ChangeLog
Log message:
* gui/sdl.cpp: A closer hack at making movies run at correct
speed.
Before: always at 100 frames per second + cpu time.
After: Still not perfect: in non-interactive movie, visuals
are a
fraction of a second ahead of MP3 soundtrack.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl.cpp?cvsroot=gnash&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3073&r2=1.3074
Patches:
Index: gui/sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- gui/sdl.cpp 2 May 2007 21:41:04 -0000 1.54
+++ gui/sdl.cpp 2 May 2007 21:56:49 -0000 1.55
@@ -14,7 +14,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: sdl.cpp,v 1.54 2007/05/02 21:41:04 martinwguy Exp $ */
+//
+//
+
+/* $Id: sdl.cpp,v 1.55 2007/05/02 21:56:49 martinwguy Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -65,6 +68,8 @@
int y_old = -1;
int button_state_old = -1;
+ Uint32 movie_time = 0;// SDL_GetTicks(); // what time it should be in the
movie
+
SDL_Event event;
while (true)
{
@@ -73,15 +78,8 @@
break;
}
- Uint32 start_tick = SDL_GetTicks();
-
- while (true)
+ while (SDL_PollEvent(&event))
{
- if (SDL_PollEvent(&event) == 0)
- {
- break;
- }
-
switch (event.type)
{
case SDL_MOUSEMOTION:
@@ -91,6 +89,7 @@
y_old = event.motion.y;
notify_mouse_moved((int) (x_old / _xscale), (int) (y_old /
_yscale));
break;
+
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
@@ -136,15 +135,15 @@
}
}
- Gui::advance_movie(this);
-
-// int delay = _interval - (SDL_GetTicks() - start_tick);
-// if (delay < 0)
-// {
-// delay = 0;
-// }
- SDL_Delay(10);
+ // Wait until real time catches up with movie time.
+ int delay = movie_time - SDL_GetTicks();
+ if (delay > 0)
+ {
+ SDL_Delay(delay);
+ }
+ Gui::advance_movie(this);
+ movie_time += _interval; // Time next frame should be displayed
}
return false;
}
@@ -323,3 +322,4 @@
} // namespace gnash
+
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3073
retrieving revision 1.3074
diff -u -b -r1.3073 -r1.3074
--- ChangeLog 2 May 2007 21:41:05 -0000 1.3073
+++ ChangeLog 2 May 2007 21:56:49 -0000 1.3074
@@ -49,6 +49,10 @@
if the library is not found.
* server/asobj/SoundMad.cpp: Fix compiler warnings.
* gui/sdl.cpp: Regularize bizarre indentation
+ * gui/sdl.cpp: A closer hack at making movies run at correct speed.
+ Before: always at 100 frames per second + cpu time.
+ After: Still not perfect: in non-interactive movie, visuals are a
+ fraction of a second ahead of MP3 soundtrack.
2007-05-02 Sandro Santilli <address@hidden>