[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ./ChangeLog server/Makefile.am server/imp...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash ./ChangeLog server/Makefile.am server/imp... |
Date: |
Sat, 07 Jan 2006 04:44:09 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch:
Changes by: Rob Savoye <address@hidden> 06/01/07 04:44:09
Modified files:
. : ChangeLog
server : Makefile.am impl.cpp sound_handler_mp3.cpp
backend : Makefile.am gnash.cpp
libgeometry : Makefile.am geometry.h
macros : opengl.m4
Log message:
* server/sound_handler_mp3.cpp: Build if libmad exists.
* configure.ac: Rearrange the final display lines, and the order
some of the tests are done in.
* backend/Makefile.am: Add OpenGL flags so Darwin is happy.
* libgeometry/Makefile.am: Add OpenGL flags so Darwin is happy.
* server/Makefile.am: Add sound_handler_mp3.cpp.
* macros/opengl.m4: Rewrite completely. Add --with-opengl optins
for the paths, and also make --disable-opengl work correctly.
* libgeometry/geometry.h(math): Rename _X, _Y, or _Z because on
Darwin they conflict with system header definitions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Makefile.am.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/impl.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/sound_handler_mp3.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/backend/Makefile.am.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/backend/gnash.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libgeometry/Makefile.am.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libgeometry/geometry.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/macros/opengl.m4.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.19 gnash/ChangeLog:1.20
--- gnash/ChangeLog:1.19 Fri Jan 6 16:05:25 2006
+++ gnash/ChangeLog Sat Jan 7 04:44:09 2006
@@ -1,5 +1,18 @@
2006-01-06 Rob Savoye <address@hidden>
+ * server/sound_handler_mp3.cpp: Build if libmad exists.
+ * configure.ac: Rearrange the final display lines, and the order
+ some of the tests are done in. Look for libmad.
+ * backend/Makefile.am: Add OpenGL flags so Darwin is happy.
+ * libgeometry/Makefile.am: Add OpenGL flags so Darwin is happy.
+ * server/Makefile.am: Add sound_handler_mp3.cpp.
+
+ * macros/opengl.m4: Rewrite completely. Add --with-opengl optins
+ for the paths, and also make --disable-opengl work correctly.
+
+ * libgeometry/geometry.h(math): Rename _X, _Y, or _Z because on
+ Darwin they conflict with system header definitions.
+
* configure.in, config.h.in, all Makefiles.in: Remove generated
files from CVS. Running autogen.sh will regenerate them.
Index: gnash/backend/Makefile.am
diff -u gnash/backend/Makefile.am:1.2 gnash/backend/Makefile.am:1.3
--- gnash/backend/Makefile.am:1.2 Mon Dec 26 15:57:26 2005
+++ gnash/backend/Makefile.am Sat Jan 7 04:44:09 2006
@@ -24,14 +24,12 @@
AM_LDFLAGS = ../libbase/libbase.la \
../libgeometry/libgeometry.la \
../server/libserver.la \
- $(OPENGL_LIBS) \
- $(GLU_LIBS) \
- $(SDL_LIBS) \
- $(SDL_MIXER_LIBS) \
- $(LIB_DEBUG_FLAGS) \
$(JPEG_LIBS) \
$(PNG_LIBS) \
- $(LIBXML_LIBS)
+ $(LIBXML_LIBS) \
+ $(SDL_LIBS) \
+ $(SDL_MIXER_LIBS) \
+ $(OPENGL_LIBS)
INCLUDES = -I.. \
-I$(top_srcdir) \
@@ -39,7 +37,8 @@
-I$(top_srcdir)/libbase \
-I$(top_srcdir)/libgeometry \
$(SDL_MIXER_CFLAGS) \
- $(LIBXML_CFLAGS)
+ $(LIBXML_CFLAGS) \
+ $(OPENGL_CFLAGS)
bin_PROGRAMS = gnash
@@ -48,7 +47,7 @@
sound_handler_sdl.cpp \
gnash.cpp
-# gnash_LDADD =
+# gnash_LDADD = -lGL -lGLU
# gnash_DEPENDENCIES =
MUDFLAP_OPT = -fmudflap
Index: gnash/backend/gnash.cpp
diff -u gnash/backend/gnash.cpp:1.2 gnash/backend/gnash.cpp:1.3
--- gnash/backend/gnash.cpp:1.2 Tue Dec 27 16:19:27 2005
+++ gnash/backend/gnash.cpp Sat Jan 7 04:44:09 2006
@@ -30,12 +30,12 @@
#include "tu_types.h"
#include "xmlsocket.h"
-bool gofast; // FIXME: this flag gets set based on
+bool gofast; // FIXME: this flag gets set based on
// an XML message written using
// SendCommand(""). This way a movie
// can optimize it's own performance
// when needed,
-bool nodelay; // FIXME: this flag gets set based on
+bool nodelay; // FIXME: this flag gets set based on
// an XML message written using
// SendCommand(""). This way a movie
// can optimize it's own performance
@@ -49,50 +49,50 @@
// want to make sure it all works.
#endif // HAVE_LIBXML
-void print_usage()
-// Brief instructions.
+void
+print_usage()
{
- printf(
- "gnash -- a standalone OpenGL player.\n"
- "\n"
- "usage: gnasg [options] movie_file.swf\n"
- "\n"
- "Plays a SWF (Shockwave Flash) movie using OpenGL"
- "\n"
- "options:\n"
- "\n"
- " -h Print this info.\n"
- " -s <factor> Scale the movie up/down by the specified
factor\n"
- " -c Produce a core file instead of letting SDL trap
it\n"
- " -d num Number of milli-seconds to delay in main loop\n"
- " -a Turn antialiasing on/off. (obsolete)\n"
- " -v Be verbose; i.e. print log messages to stdout\n"
- " -va Be verbose about movie Actions\n"
- " -vp Be verbose about parsing the movie\n"
- " -ml <bias> Specify the texture LOD bias (float, default is
-1)\n"
- " -p Run full speed (no sleep) and log frame rate\n"
- " -e Use SDL Event thread\n"
- " -1 Play once; exit when/if movie reaches the last
frame\n"
- " -r <0|1|2> 0 disables renderering & sound (good for batch
tests)\n"
- " 1 enables rendering & sound (default setting)\n"
- " 2 enables rendering & disables sound\n"
- " -t <sec> Timeout and exit after the specified number of
seconds\n"
- " -b <bits> Bit depth of output window (16 or 32, default is
16)\n"
- "\n"
- "keys:\n"
- " CTRL-Q Quit/Exit\n"
- " CTRL-W Quit/Exit\n"
- " ESC Quit/Exit\n"
- " CTRL-P Toggle Pause\n"
- " CTRL-R Restart the movie\n"
- " CTRL-[ or kp- Step back one frame\n"
- " CTRL-] or kp+ Step forward one frame\n"
- " CTRL-A Toggle antialiasing (doesn't work)\n"
- " CTRL-T Debug. Test the set_variable() function\n"
- " CTRL-G Debug. Test the get_variable() function\n"
- " CTRL-M Debug. Test the call_method() function\n"
- " CTRL-B Toggle background color\n"
- );
+ printf(
+ "gnash -- a standalone OpenGL player.\n"
+ "\n"
+ "usage: gnasg [options] movie_file.swf\n"
+ "\n"
+ "Plays a SWF (Shockwave Flash) movie using OpenGL"
+ "\n"
+ "options:\n"
+ "\n"
+ " -h Print this info.\n"
+ " -s <factor> Scale the movie up/down by the specified factor\n"
+ " -c Produce a core file instead of letting SDL trap it\n"
+ " -d num Number of milli-seconds to delay in main loop\n"
+ " -a Turn antialiasing on/off. (obsolete)\n"
+ " -v Be verbose; i.e. print log messages to stdout\n"
+ " -va Be verbose about movie Actions\n"
+ " -vp Be verbose about parsing the movie\n"
+ " -ml <bias> Specify the texture LOD bias (float, default is -1)\n"
+ " -p Run full speed (no sleep) and log frame rate\n"
+ " -e Use SDL Event thread\n"
+ " -1 Play once; exit when/if movie reaches the last frame\n"
+ " -r <0|1|2> 0 disables renderering & sound (good for batch
tests)\n"
+ " 1 enables rendering & sound (default setting)\n"
+ " 2 enables rendering & disables sound\n"
+ " -t <sec> Timeout and exit after the specified number of
seconds\n"
+ " -b <bits> Bit depth of output window (16 or 32, default is 16)\n"
+ "\n"
+ "keys:\n"
+ " CTRL-Q Quit/Exit\n"
+ " CTRL-W Quit/Exit\n"
+ " ESC Quit/Exit\n"
+ " CTRL-P Toggle Pause\n"
+ " CTRL-R Restart the movie\n"
+ " CTRL-[ or kp- Step back one frame\n"
+ " CTRL-] or kp+ Step forward one frame\n"
+ " CTRL-A Toggle antialiasing (doesn't work)\n"
+ " CTRL-T Debug. Test the set_variable() function\n"
+ " CTRL-G Debug. Test the get_variable() function\n"
+ " CTRL-M Debug. Test the call_method() function\n"
+ " CTRL-B Toggle background color\n"
+ );
}
@@ -110,849 +110,715 @@
static bool s_event_thread = false;
static bool s_start_waiting = false;
-static void message_log(const char* message)
+static void
+message_log(const char* message)
// Process a log message.
{
- if (s_verbose)
- {
- fputs(message, stdout);
- fflush(stdout); // needed on osx for some reason
- }
+ if (s_verbose) {
+ fputs(message, stdout);
+ fflush(stdout); // needed on osx for some reason
+ }
}
-
-static void log_callback(bool error, const char* message)
+static void
+log_callback(bool error, const char* message)
// Error callback for handling messages.
{
- if (error)
- {
- // Log, and also print to stderr.
- message_log(message);
- fputs(message, stderr);
- }
- else
- {
- message_log(message);
- }
+ if (error) {
+ // Log, and also print to stderr.
+ message_log(message);
+ fputs(message, stderr);
+ } else {
+ message_log(message);
+ }
}
-static tu_file* file_opener(const char* url)
+static tu_file*
+file_opener(const char* url)
// Callback function. This opens files for th library.
{
- return new tu_file(url, "rb");
+ return new tu_file(url, "rb");
}
-static void fs_callback(gnash::movie_interface* movie, const char* command,
const char* args)
+static void
+fs_callback(gnash::movie_interface* movie, const char* command, const char*
args)
// For handling notification callbacks from ActionScript.
{
- message_log("fs_callback: '");
- message_log(command);
- message_log("' '");
- message_log(args);
- message_log("'\n");
+ message_log("fs_callback: '");
+ message_log(command);
+ message_log("' '");
+ message_log(args);
+ message_log("'\n");
}
-static void key_event(SDLKey key, bool down)
+static void
+key_event(SDLKey key, bool down)
// For forwarding SDL key events.
{
- gnash::key::code c(gnash::key::INVALID);
-
- if (key >= SDLK_a && key <= SDLK_z)
- {
- c = (gnash::key::code) ((key - SDLK_a) + gnash::key::A);
- }
- else if (key >= SDLK_F1 && key <= SDLK_F15)
- {
- c = (gnash::key::code) ((key - SDLK_F1) + gnash::key::F1);
- }
- else if (key >= SDLK_KP0 && key <= SDLK_KP9)
- {
- c = (gnash::key::code) ((key - SDLK_KP0) + gnash::key::KP_0);
- }
- else
- {
- // many keys don't correlate, so just use a look-up table.
- struct
- {
- SDLKey sdlk;
- gnash::key::code gs;
- } table[] =
- {
- { SDLK_RETURN, gnash::key::ENTER },
- { SDLK_ESCAPE, gnash::key::ESCAPE },
- { SDLK_LEFT, gnash::key::LEFT },
- { SDLK_UP, gnash::key::UP },
- { SDLK_RIGHT, gnash::key::RIGHT },
- { SDLK_DOWN, gnash::key::DOWN },
- // @@ TODO fill this out some more
- { SDLK_UNKNOWN, gnash::key::INVALID }
- };
-
- for (int i = 0; table[i].sdlk != SDLK_UNKNOWN; i++)
- {
- if (key == table[i].sdlk)
- {
- c = table[i].gs;
- break;
- }
- }
- }
-
- if (c != gnash::key::INVALID)
- {
- gnash::notify_key_event(c, down);
- }
+ gnash::key::code c(gnash::key::INVALID);
+
+ if (key >= SDLK_a && key <= SDLK_z) {
+ c = (gnash::key::code) ((key - SDLK_a) + gnash::key::A);
+ } else if (key >= SDLK_F1 && key <= SDLK_F15) {
+ c = (gnash::key::code) ((key - SDLK_F1) + gnash::key::F1);
+ } else if (key >= SDLK_KP0 && key <= SDLK_KP9) {
+ c = (gnash::key::code) ((key - SDLK_KP0) + gnash::key::KP_0);
+ } else {
+ // many keys don't correlate, so just use a look-up table.
+ struct {
+ SDLKey sdlk;
+ gnash::key::code gs;
+ } table[] = {
+ { SDLK_RETURN, gnash::key::ENTER },
+ { SDLK_ESCAPE, gnash::key::ESCAPE },
+ { SDLK_LEFT, gnash::key::LEFT },
+ { SDLK_UP, gnash::key::UP },
+ { SDLK_RIGHT, gnash::key::RIGHT },
+ { SDLK_DOWN, gnash::key::DOWN },
+ // @@ TODO fill this out some more
+ { SDLK_UNKNOWN, gnash::key::INVALID }
+ };
+
+ for (int i = 0; table[i].sdlk != SDLK_UNKNOWN; i++) {
+ if (key == table[i].sdlk) {
+ c = table[i].gs;
+ break;
+ }
+ }
+ }
+
+ if (c != gnash::key::INVALID) {
+ gnash::notify_key_event(c, down);
+ }
}
-
-
-
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
- assert(tu_types_validate());
-
- const char* infile = NULL;
-
- float exit_timeout = 0;
- bool do_render = true;
- bool do_sound = true;
- bool do_loop = true;
- bool sdl_abort = true;
- int delay = 31;
- float tex_lod_bias;
-
- // -1.0 tends to look good.
- tex_lod_bias = -1.2f;
-
- for (int arg = 1; arg < argc; arg++)
- {
- if (argv[arg][0] == '-')
- {
- // Looks like an option.
-
- if (argv[arg][1] == 'h')
- {
- // Help.
- print_usage();
- exit(1);
- }
- if (argv[arg][1] == 'c')
- {
- sdl_abort = false;
- }
- else if (argv[arg][1] == 's')
- {
- // Scale.
- arg++;
- if (arg < argc)
- {
- s_scale = fclamp((float)
atof(argv[arg]), 0.01f, 100.f);
- }
- else
- {
- fprintf(stderr, "-s arg must be
followed by a scale value\n");
- print_usage();
- exit(1);
- }
- }
- else if (argv[arg][1] == 'a')
- {
- // Set antialiasing on or off.
- arg++;
- if (arg < argc)
- {
- s_antialiased = atoi(argv[arg]) ? true
: false;
- }
- else
- {
- fprintf(stderr, "-a arg must be
followed by 0 or 1 to disable/enable antialiasing\n");
- print_usage();
- exit(1);
- }
- }
- else if (argv[arg][1] == 'b')
- {
- // Set default bit depth.
- arg++;
- if (arg < argc)
- {
- s_bit_depth = atoi(argv[arg]);
- if (s_bit_depth != 16 && s_bit_depth !=
32)
- {
- fprintf(stderr, "Command-line
supplied bit depth %d, but it must be 16 or 32", s_bit_depth);
- print_usage();
- exit(1);
- }
- }
- else
- {
- fprintf(stderr, "-b arg must be
followed by 16 or 32 to set bit depth\n");
- print_usage();
- exit(1);
- }
- }
- else if (argv[arg][1] == 'd')
- {
- // Set a delay
- arg++;
- if (arg < argc)
- {
- delay = atoi(argv[arg]);
- }
- else
- {
- fprintf(stderr, "-d arg must be
followed by number of milli-seconds to del in the main loop\n");
- print_usage();
- exit(1);
- }
- }
- else if (argv[arg][1] == 'p')
- {
- // Enable frame-rate/performance logging.
- s_measure_performance = true;
- }
- else if (argv[arg][1] == 'e')
- {
- // Use an SDL thread to handle events
- s_event_thread = true;
- }
- else if (argv[arg][1] == '1')
- {
- // Play once; don't loop.
- do_loop = false;
- }
- else if (argv[arg][1] == 'r')
- {
- // Set rendering on/off.
- arg++;
- if (arg < argc)
- {
- const int render_arg = atoi(argv[arg]);
- switch (render_arg) {
- case 0:
- // Disable both
- do_render = false;
- do_sound = false;
- break;
- case 1:
- // Enable both
- do_render = true;
- do_sound = true;
- break;
- case 2:
- // Disable just sound
- do_render = true;
- do_sound = false;
- break;
- default:
- fprintf(stderr, "-r must be
followed by 0, 1 or 2 (%d is invalid)\n",
- render_arg);
- print_usage();
- exit(1);
- break;
- }
- } else {
- fprintf(stderr, "-r must be followed by
0 an argument to disable/enable rendering\n");
- print_usage();
- exit(1);
- }
- }
- else if (argv[arg][1] == 't')
- {
- // Set timeout.
- arg++;
- if (arg < argc)
- {
- exit_timeout = (float) atof(argv[arg]);
- }
- else
- {
- fprintf(stderr, "-t must be followed by
an exit timeout, in seconds\n");
- print_usage();
- exit(1);
- }
- }
- else if (argv[arg][1] == 'v')
- {
- // Be verbose; i.e. print log messages to
stdout.
- s_verbose = true;
-
- if (argv[arg][2] == 'a')
- {
- // Enable spew re: action.
- gnash::set_verbose_action(true);
- }
- else if (argv[arg][2] == 'p')
- {
- // Enable parse spew.
- gnash::set_verbose_parse(true);
- }
- // ...
- }
- else if (argv[arg][1] == 'm')
- {
- if (argv[arg][2] == 'l') {
- arg++;
- tex_lod_bias = (float) atof(argv[arg]);
- //printf("Texture LOD Bais is no %f\n",
tex_lod_bias);
- }
- else
- {
- fprintf(stderr, "unknown variant of -m
arg\n");
- print_usage();
- exit(1);
- }
- }
- }
- else
- {
- infile = argv[arg];
- }
- }
-
- if (infile == NULL)
- {
- printf("no input file\n");
- print_usage();
- exit(1);
- }
-
- gnash::register_file_opener_callback(file_opener);
- gnash::register_fscommand_callback(fs_callback);
- if (s_verbose == true) {
- gnash::register_log_callback(log_callback);
- }
- //gnash::set_antialiased(s_antialiased);
-
- gnash::sound_handler* sound = NULL;
- gnash::render_handler* render = NULL;
- if (do_render)
- {
- if (do_sound) {
- sound = gnash::create_sound_handler_sdl();
- gnash::set_sound_handler(sound);
- }
- render = gnash::create_render_handler_ogl();
- gnash::set_render_handler(render);
- }
-
- // Get info about the width & height of the movie.
- int movie_version = 0;
- int movie_width = 0;
- int movie_height = 0;
- float movie_fps = 30.0f;
- gnash::get_movie_info(infile, &movie_version, &movie_width,
&movie_height, &movie_fps, NULL, NULL);
- if (movie_version == 0)
- {
- fprintf(stderr, "error: can't get info about %s\n", infile);
- exit(1);
- }
-
- int width = int(movie_width * s_scale);
- int height = int(movie_height * s_scale);
-
- if (do_render)
- {
- // Initialize the SDL subsystems we're using. Linux
- // and Darwin use Pthreads for SDL threads, Win32
- // doesn't. Otherwise the SDL event loop just polls.
- if (sdl_abort) {
- // Other flags are SDL_INIT_JOYSTICK | SDL_INIT_CDROM
+ assert(tu_types_validate());
+
+ const char* infile = NULL;
+
+ float exit_timeout = 0;
+ bool do_render = true;
+ bool do_sound = true;
+ bool do_loop = true;
+ bool sdl_abort = true;
+ int delay = 31;
+ float tex_lod_bias;
+
+ // -1.0 tends to look good.
+ tex_lod_bias = -1.2f;
+
+ for (int arg = 1; arg < argc; arg++) {
+ if (argv[arg][0] == '-') {
+ // Looks like an option.
+
+ if (argv[arg][1] == 'h') {
+ // Help.
+ print_usage();
+ exit(1);
+ }
+ if (argv[arg][1] == 'c') {
+ sdl_abort = false;
+ } else if (argv[arg][1] == 's') {
+ // Scale.
+ arg++;
+ if (arg < argc) {
+ s_scale = fclamp((float) atof(argv[arg]), 0.01f, 100.f);
+ } else {
+ fprintf(stderr, "-s arg must be followed by a scale value\n");
+ print_usage();
+ exit(1);
+ }
+ } else if (argv[arg][1] == 'a') {
+ // Set antialiasing on or off.
+ arg++;
+ if (arg < argc) {
+ s_antialiased = atoi(argv[arg]) ? true : false;
+ } else {
+ fprintf(stderr, "-a arg must be followed by 0 or 1 to disable/enable
antialiasing\n");
+ print_usage();
+ exit(1);
+ }
+ } else if (argv[arg][1] == 'b') {
+ // Set default bit depth.
+ arg++;
+ if (arg < argc) {
+ s_bit_depth = atoi(argv[arg]);
+ if (s_bit_depth != 16 && s_bit_depth != 32) {
+ fprintf(stderr, "Command-line supplied bit depth %d, but it must
be 16 or 32", s_bit_depth);
+ print_usage();
+ exit(1);
+ }
+ } else {
+ fprintf(stderr, "-b arg must be followed by 16 or 32 to set bit
depth\n");
+ print_usage();
+ exit(1);
+ }
+ } else if (argv[arg][1] == 'd') {
+ // Set a delay
+ arg++;
+ if (arg < argc) {
+ delay = atoi(argv[arg]);
+ } else {
+ fprintf(stderr, "-d arg must be followed by number of milli-seconds
to del in the main loop\n");
+ print_usage();
+ exit(1);
+ }
+ } else if (argv[arg][1] == 'p') {
+ // Enable frame-rate/performance logging.
+ s_measure_performance = true;
+ } else if (argv[arg][1] == 'e') {
+ // Use an SDL thread to handle events
+ s_event_thread = true;
+ } else if (argv[arg][1] == '1') {
+ // Play once; don't loop.
+ do_loop = false;
+ } else if (argv[arg][1] == 'r') {
+ // Set rendering on/off.
+ arg++;
+ if (arg < argc) {
+ const int render_arg = atoi(argv[arg]);
+ switch (render_arg) {
+ case 0:
+ // Disable both
+ do_render = false;
+ do_sound = false;
+ break;
+ case 1:
+ // Enable both
+ do_render = true;
+ do_sound = true;
+ break;
+ case 2:
+ // Disable just sound
+ do_render = true;
+ do_sound = false;
+ break;
+ default:
+ fprintf(stderr, "-r must be followed by 0, 1 or 2 (%d is
invalid)\n",
+ render_arg);
+ print_usage();
+ exit(1);
+ break;
+ }
+ } else {
+ fprintf(stderr, "-r must be followed by 0 an argument to
disable/enable rendering\n");
+ print_usage();
+ exit(1);
+ }
+ } else if (argv[arg][1] == 't') {
+ // Set timeout.
+ arg++;
+ if (arg < argc) {
+ exit_timeout = (float) atof(argv[arg]);
+ } else {
+ fprintf(stderr, "-t must be followed by an exit timeout, in
seconds\n");
+ print_usage();
+ exit(1);
+ }
+ } else if (argv[arg][1] == 'v') {
+ // Be verbose; i.e. print log messages to stdout.
+ s_verbose = true;
+
+ if (argv[arg][2] == 'a') {
+ // Enable spew re: action.
+ gnash::set_verbose_action(true);
+ } else if (argv[arg][2] == 'p') {
+ // Enable parse spew.
+ gnash::set_verbose_parse(true);
+ }
+ // ...
+ } else if (argv[arg][1] == 'm') {
+ if (argv[arg][2] == 'l') {
+ arg++;
+ tex_lod_bias = (float) atof(argv[arg]);
+ //printf("Texture LOD Bais is no %f\n", tex_lod_bias);
+ } else {
+ fprintf(stderr, "unknown variant of -m arg\n");
+ print_usage();
+ exit(1);
+ }
+ }
+ } else {
+ infile = argv[arg];
+ }
+ }
+
+ if (infile == NULL) {
+ printf("no input file\n");
+ print_usage();
+ exit(1);
+ }
+
+ gnash::register_file_opener_callback(file_opener);
+ gnash::register_fscommand_callback(fs_callback);
+ if (s_verbose == true) {
+ gnash::register_log_callback(log_callback);
+ }
+ //gnash::set_antialiased(s_antialiased);
+
+ gnash::sound_handler *sound = NULL;
+ gnash::render_handler *render = NULL;
+ if (do_render) {
+ if (do_sound) {
+ sound = gnash::create_sound_handler_sdl();
+ gnash::set_sound_handler(sound);
+ }
+ render = gnash::create_render_handler_ogl();
+ gnash::set_render_handler(render);
+ }
+
+ // Get info about the width & height of the movie.
+ int movie_version = 0;
+ int movie_width = 0;
+ int movie_height = 0;
+ float movie_fps = 30.0f;
+ gnash::get_movie_info(infile, &movie_version, &movie_width, &movie_height,
&movie_fps, NULL, NULL);
+ if (movie_version == 0) {
+ fprintf(stderr, "error: can't get info about %s\n", infile);
+ exit(1);
+ }
+
+ int width = int(movie_width * s_scale);
+ int height = int(movie_height * s_scale);
+
+ if (do_render) {
+ // Initialize the SDL subsystems we're using. Linux
+ // and Darwin use Pthreads for SDL threads, Win32
+ // doesn't. Otherwise the SDL event loop just polls.
+ if (sdl_abort) {
+ // Other flags are SDL_INIT_JOYSTICK | SDL_INIT_CDROM
#ifdef _WIN32
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO))
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO))
#else
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO |
SDL_INIT_EVENTTHREAD ))
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTTHREAD ))
#endif
- {
- fprintf(stderr, "Unable to init SDL: %s\n",
SDL_GetError());
- exit(1);
- }
- } else {
- fprintf(stderr, "warning: SDL won't trap core dumps
\n");
+ {
+ fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
+ exit(1);
+ }
+ } else {
+ fprintf(stderr, "warning: SDL won't trap core dumps \n");
#ifdef _WIN32
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO |
SDL_INIT_NOPARACHUTE | SDL_INIT_EVENTTHREAD))
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE |
SDL_INIT_EVENTTHREAD))
#else
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO |
SDL_INIT_NOPARACHUTE))
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE))
#endif
- {
- fprintf(stderr, "Unable to init SDL: %s\n",
SDL_GetError());
- exit(1);
- }
- }
-
- atexit(SDL_Quit);
-
- SDL_EnableKeyRepeat(250, 33);
-
-
- if (s_bit_depth == 16)
- {
- // 16-bit color, surface creation is likely to succeed.
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 15);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
- }
- else
- {
- assert(s_bit_depth == 32);
-
- // 32-bit color etc, for getting dest alpha,
- // for MULTIPASS_ANTIALIASING (see
- // render_handler_ogl.cpp).
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
- }
-
- // Change the LOD BIAS values to tweak blurriness.
- if (tex_lod_bias != 0.0f) {
+ {
+ fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
+ exit(1);
+ }
+ }
+
+ atexit(SDL_Quit);
+
+ SDL_EnableKeyRepeat(250, 33);
+
+
+ if (s_bit_depth == 16) {
+ // 16-bit color, surface creation is likely to succeed.
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 15);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
+ } else {
+ assert(s_bit_depth == 32);
+
+ // 32-bit color etc, for getting dest alpha,
+ // for MULTIPASS_ANTIALIASING (see
+ // render_handler_ogl.cpp).
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
+ }
+
+ // Change the LOD BIAS values to tweak blurriness.
+ if (tex_lod_bias != 0.0f) {
#ifdef FIX_I810_LOD_BIAS
- // If 2D textures weren't previously enabled, enable
- // them now and force the driver to notice the update,
- // then disable them again.
- if (!glIsEnabled(GL_TEXTURE_2D)) {
- // Clearing a mask of zero *should* have no
- // side effects, but coupled with enbling
- // GL_TEXTURE_2D it works around a segmentation
- // fault in the driver for the Intel 810 chip.
- glEnable(GL_TEXTURE_2D);
- glClear(0);
- glDisable(GL_TEXTURE_2D);
- }
+ // If 2D textures weren't previously enabled, enable
+ // them now and force the driver to notice the update,
+ // then disable them again.
+ if (!glIsEnabled(GL_TEXTURE_2D)) {
+ // Clearing a mask of zero *should* have no
+ // side effects, but coupled with enbling
+ // GL_TEXTURE_2D it works around a segmentation
+ // fault in the driver for the Intel 810 chip.
+ glEnable(GL_TEXTURE_2D);
+ glClear(0);
+ glDisable(GL_TEXTURE_2D);
+ }
#endif // FIX_I810_LOD_BIAS
- glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
GL_TEXTURE_LOD_BIAS_EXT, tex_lod_bias);
- }
-
- // Set the video mode.
- if (SDL_SetVideoMode(width, height, s_bit_depth, SDL_OPENGL) ==
0)
- {
- fprintf(stderr, "SDL_SetVideoMode() failed.");
- exit(1);
- }
-
- ogl::open();
-
- // Turn on alpha blending.
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- // Turn on line smoothing. Antialiased lines can be used to
- // smooth the outsides of shapes.
- glEnable(GL_LINE_SMOOTH);
- glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // GL_NICEST,
GL_FASTEST, GL_DONT_CARE
-
- glMatrixMode(GL_PROJECTION);
- glOrtho(-OVERSIZE, OVERSIZE, OVERSIZE, -OVERSIZE, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- // We don't need lighting effects
- glDisable(GL_LIGHTING);
- // glColorPointer(4, GL_UNSIGNED_BYTE, 0, *);
- // glInterleavedArrays(GL_T2F_N3F_V3F, 0, *)
- glPushAttrib (GL_ALL_ATTRIB_BITS);
- }
-
- // Load the actual movie.
- gnash::movie_definition* md =
gnash::create_library_movie(infile);
- if (md == NULL)
- {
- fprintf(stderr, "error: can't create a movie from '%s'\n",
infile);
- exit(1);
- }
- gnash::movie_interface* m = create_library_movie_inst(md);
- if (m == NULL)
- {
- fprintf(stderr, "error: can't create movie instance\n");
- exit(1);
- }
- gnash::set_current_root(m);
-
- // Mouse state.
- int mouse_x = 0;
- int mouse_y = 0;
- int mouse_buttons = 0;
-
- float speed_scale = 1.0f;
- Uint32 start_ticks = 0;
- if (do_render)
- {
- start_ticks = SDL_GetTicks();
-
- }
- Uint32 last_ticks = start_ticks;
- int frame_counter = 0;
- int last_logged_fps = last_ticks;
-
-
- SDL_Thread *thread = NULL;
- if (s_event_thread) {
- thread = SDL_CreateThread(runThread, NULL);
- if ( thread == NULL) {
- fprintf(stderr, "Unable to create thread: %s\n",
SDL_GetError());
- }
- }
-
-
- for (;;)
- {
- Uint32 ticks;
- if (do_render)
- {
- ticks = SDL_GetTicks();
- }
- else
- {
- // Simulate time.
- ticks = last_ticks + (Uint32) (1000.0f / movie_fps);
- }
- int delta_ticks = ticks - last_ticks;
- float delta_t = delta_ticks / 1000.f;
- last_ticks = ticks;
-
- // Check auto timeout counter.
- if (exit_timeout > 0
- && ticks - start_ticks > (Uint32) (exit_timeout * 1000))
- {
- // Auto exit now.
- break;
- }
-
- bool ret = true;
- if (do_render)
- {
- SDL_Event event;
- // Handle input.
- while (ret)
- {
- //printf("xml_fd is %d, gofast is %d,
s_start_waiting is %d\n" , xml_fd, gofast, s_start_waiting);
+ glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT,
tex_lod_bias);
+ }
+
+ // Set the video mode.
+ if (SDL_SetVideoMode(width, height, s_bit_depth, SDL_OPENGL) == 0) {
+ fprintf(stderr, "SDL_SetVideoMode() failed.");
+ exit(1);
+ }
+
+ ogl::open();
+
+ // Turn on alpha blending.
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ // Turn on line smoothing. Antialiased lines can be used to
+ // smooth the outsides of shapes.
+ glEnable(GL_LINE_SMOOTH);
+ glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // GL_NICEST, GL_FASTEST,
GL_DONT_CARE
+
+ glMatrixMode(GL_PROJECTION);
+ glOrtho(-OVERSIZE, OVERSIZE, OVERSIZE, -OVERSIZE, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ // We don't need lighting effects
+ glDisable(GL_LIGHTING);
+ // glColorPointer(4, GL_UNSIGNED_BYTE, 0, *);
+ // glInterleavedArrays(GL_T2F_N3F_V3F, 0, *)
+ glPushAttrib (GL_ALL_ATTRIB_BITS);
+ }
+
+ // Load the actual movie.
+ gnash::movie_definition* md = gnash::create_library_movie(infile);
+ if (md == NULL) {
+ fprintf(stderr, "error: can't create a movie from '%s'\n", infile);
+ exit(1);
+ }
+ gnash::movie_interface* m = create_library_movie_inst(md);
+ if (m == NULL) {
+ fprintf(stderr, "error: can't create movie instance\n");
+ exit(1);
+ }
+ gnash::set_current_root(m);
+
+ // Mouse state.
+ int mouse_x = 0;
+ int mouse_y = 0;
+ int mouse_buttons = 0;
+
+ float speed_scale = 1.0f;
+ Uint32 start_ticks = 0;
+ if (do_render) {
+ start_ticks = SDL_GetTicks();
+
+ }
+ Uint32 last_ticks = start_ticks;
+ int frame_counter = 0;
+ int last_logged_fps = last_ticks;
+
+
+ SDL_Thread *thread = NULL;
+ if (s_event_thread) {
+ thread = SDL_CreateThread(runThread, NULL);
+ if ( thread == NULL) {
+ fprintf(stderr, "Unable to create thread: %s\n", SDL_GetError());
+ }
+ }
+
+
+ for (;;) {
+ Uint32 ticks;
+ if (do_render) {
+ ticks = SDL_GetTicks();
+ } else {
+ // Simulate time.
+ ticks = last_ticks + (Uint32) (1000.0f / movie_fps);
+ }
+ int delta_ticks = ticks - last_ticks;
+ float delta_t = delta_ticks / 1000.f;
+ last_ticks = ticks;
+
+ // Check auto timeout counter.
+ if (exit_timeout > 0
+ && ticks - start_ticks > (Uint32) (exit_timeout * 1000)) {
+ // Auto exit now.
+ break;
+ }
+
+ bool ret = true;
+ if (do_render) {
+ SDL_Event event;
+ // Handle input.
+ while (ret) {
+ //printf("xml_fd is %d, gofast is %d, s_start_waiting is %d\n" ,
xml_fd, gofast, s_start_waiting);
#ifdef HAVE_LIBXML
- if (s_event_thread && s_start_waiting &&
(xml_fd > 0) && !gofast) {
-// if (s_event_thread && (xml_fd > 0)) {
- //printf("SDL_WaitEvent!\n");
- ret = SDL_WaitEvent(&event);
- } else {
- if (gofast) {
- //printf("SDL_PollEvent
GOFAST!\n");
- } else {
- //printf("SDL_PollEvent!\n");
- }
- ret = SDL_PollEvent(&event) ? true :
false;
- }
+ if (s_event_thread && s_start_waiting && (xml_fd > 0) && !gofast) {
+ // if (s_event_thread && (xml_fd > 0)) {
+ //printf("SDL_WaitEvent!\n");
+ ret = SDL_WaitEvent(&event);
+ } else {
+ if (gofast) {
+ //printf("SDL_PollEvent GOFAST!\n");
+ } else {
+ //printf("SDL_PollEvent!\n");
+ }
+ ret = SDL_PollEvent(&event) ? true : false;
+ }
#endif
-
- //printf("EVENT Type is %d\n", event.type);
- switch (event.type)
- {
- case SDL_USEREVENT:
- //printf("SDL_USER_EVENT at %s, code
%d%d\n", __FUNCTION__, __LINE__, event.user.code);
- ret = false;
- break;
- case SDL_KEYDOWN:
- {
- SDLKey key = event.key.keysym.sym;
- bool ctrl = (event.key.keysym.mod &
KMOD_CTRL) != 0;
-
- if (key == SDLK_ESCAPE
- || (ctrl && key == SDLK_q)
- || (ctrl && key == SDLK_w))
- {
- goto done;
- }
- else if (ctrl && key == SDLK_p)
- {
- // Toggle paused state.
- if (m->get_play_state() ==
gnash::movie_interface::STOP)
- {
-
m->set_play_state(gnash::movie_interface::PLAY);
- }
- else
- {
-
m->set_play_state(gnash::movie_interface::STOP);
- }
- }
- else if (ctrl && key == SDLK_r)
- {
- // Restart the movie.
- m->restart();
- }
- else if (ctrl && (key ==
SDLK_LEFTBRACKET || key == SDLK_KP_MINUS))
- {
-
m->goto_frame(m->get_current_frame()-1);
- }
- else if (ctrl && (key ==
SDLK_RIGHTBRACKET || key == SDLK_KP_PLUS))
- {
-
m->goto_frame(m->get_current_frame()+1);
- }
- else if (ctrl && key == SDLK_a)
- {
- // Toggle antialiasing.
- s_antialiased = !s_antialiased;
-
//gnash::set_antialiased(s_antialiased);
- }
- else if (ctrl && key == SDLK_t)
- {
- // test text replacement /
variable setting:
- m->set_variable("test.text",
"set_edit_text was here...\nanother line of text for you to see in the text
box\nSome UTF-8: ñö£ç°ÃÃÿ");
- }
- else if (ctrl && key == SDLK_g)
- {
- // test get_variable.
- message_log("testing
get_variable: '");
-
message_log(m->get_variable("test.text"));
- message_log("'\n");
- }
- else if (ctrl && key == SDLK_m)
- {
- // Test call_method.
- const char* result =
m->call_method(
- "test_call",
- "%d, %f, %s, %ls",
- 200,
- 1.0f,
- "Test string",
- L"Test long string");
-
- if (result)
- {
-
message_log("call_method: result = ");
- message_log(result);
- message_log("\n");
- }
- else
- {
-
message_log("call_method: null result\n");
- }
- }
- else if (ctrl && key == SDLK_b)
- {
- // toggle background color.
- s_background = !s_background;
- }
- else if (ctrl && key == SDLK_f) //xxxxxx
- {
- extern bool
gnash_debug_show_paths;
- gnash_debug_show_paths =
!gnash_debug_show_paths;
- }
- else if (ctrl && key == SDLK_EQUALS)
- {
- float f =
gnash::get_curve_max_pixel_error();
- f *= 1.1f;
-
gnash::set_curve_max_pixel_error(f);
- printf("curve error tolerance =
%f\n", f);
- }
- else if (ctrl && key == SDLK_MINUS)
- {
- float f =
gnash::get_curve_max_pixel_error();
- f *= 0.9f;
-
gnash::set_curve_max_pixel_error(f);
- printf("curve error tolerance =
%f\n", f);
- }
-
- key_event(key, true);
-
- break;
- }
-
- case SDL_KEYUP:
- {
- SDLKey key = event.key.keysym.sym;
- key_event(key, false);
- break;
- }
-
- case SDL_MOUSEMOTION:
- mouse_x = (int) (event.motion.x /
s_scale);
- mouse_y = (int) (event.motion.y /
s_scale);
- break;
-
- case SDL_MOUSEBUTTONDOWN:
- case SDL_MOUSEBUTTONUP:
- {
- int mask = 1 <<
(event.button.button - 1);
- if (event.button.state == SDL_PRESSED)
- {
- mouse_buttons |= mask;
- }
- else
- {
- mouse_buttons &= ~mask;
- }
- break;
- }
-
- case SDL_QUIT:
- goto done;
- break;
-
- default:
- break;
- }
- }
- }
-
- m = gnash::get_current_root();
- gnash::delete_unused_root();
-
- m->set_display_viewport(0, 0, width, height);
- m->set_background_alpha(s_background ? 1.0f : 0.05f);
-
- m->notify_mouse_state(mouse_x, mouse_y, mouse_buttons);
-
- m->advance(delta_t * speed_scale);
-
- if (do_render)
- {
- glDisable(GL_DEPTH_TEST); // Disable depth
testing.
- glDrawBuffer(GL_BACK);
- }
- m->display();
- frame_counter++;
-
- if (do_render)
- {
- SDL_GL_SwapBuffers();
- //glPopAttrib ();
-
- if (s_measure_performance == false)
- {
- // Don't hog the CPU.
-// if (!nodelay)
- if (!gofast)
- {
- SDL_Delay(delay);
- }
- }
- else
- {
- // Log the frame rate every second or so.
- if (last_ticks - last_logged_fps > 1000)
- {
- float delta = (last_ticks -
last_logged_fps) / 1000.f;
-
- if (delta > 0)
- {
- printf("fps = %3.1f\n",
frame_counter / delta);
- }
- else
- {
- printf("fps = *inf*\n");
- }
-
- last_logged_fps = last_ticks;
- frame_counter = 0;
- }
- }
- }
-
- // See if we should exit.
- if (do_loop == false
- && m->get_current_frame() + 1 == md->get_frame_count())
- {
- // We're reached the end of the movie; exit.
- break;
- }
- }
-
-done:
- doneYet = 1;
- SDL_KillThread(thread); // kill the network read thread
- //SDL_Quit();
-
- if (md) md->drop_ref();
- if (m) m->drop_ref();
- delete sound;
- delete render;
-
- // For testing purposes, throw some keypresses
- // to make sure the key handler is properly using weak
- // references to listeners.
- gnash::notify_key_event(gnash::key::A, true);
- gnash::notify_key_event(gnash::key::B, true);
- gnash::notify_key_event(gnash::key::C, true);
-
- // Clean up as much as possible, so valgrind will help find actual
leaks.
- gnash::clear();
-
- return 0;
+
+ //printf("EVENT Type is %d\n", event.type);
+ switch (event.type) {
+ case SDL_USEREVENT:
+ //printf("SDL_USER_EVENT at %s, code %d%d\n", __FUNCTION__,
__LINE__, event.user.code);
+ ret = false;
+ break;
+ case SDL_KEYDOWN:
+ {
+ SDLKey key = event.key.keysym.sym;
+ bool ctrl = (event.key.keysym.mod & KMOD_CTRL) != 0;
+
+ if (key == SDLK_ESCAPE
+ || (ctrl && key == SDLK_q)
+ || (ctrl && key == SDLK_w)) {
+ goto done;
+ } else if (ctrl && key == SDLK_p) {
+ // Toggle paused state.
+ if (m->get_play_state() == gnash::movie_interface::STOP) {
+ m->set_play_state(gnash::movie_interface::PLAY);
+ } else {
+ m->set_play_state(gnash::movie_interface::STOP);
+ }
+ } else if (ctrl && key == SDLK_r) {
+ // Restart the movie.
+ m->restart();
+ } else if (ctrl && (key == SDLK_LEFTBRACKET || key ==
SDLK_KP_MINUS)) {
+ m->goto_frame(m->get_current_frame()-1);
+ } else if (ctrl && (key == SDLK_RIGHTBRACKET || key ==
SDLK_KP_PLUS)) {
+ m->goto_frame(m->get_current_frame()+1);
+ } else if (ctrl && key == SDLK_a) {
+ // Toggle antialiasing.
+ s_antialiased = !s_antialiased;
+ //gnash::set_antialiased(s_antialiased);
+ } else if (ctrl && key == SDLK_t) {
+ // test text replacement / variable setting:
+ m->set_variable("test.text", "set_edit_text was here...\nanother
line of text for you to see in the text box\nSome UTF-8: ñö£ç°ÃÃÿ");
+ } else if (ctrl && key == SDLK_g) {
+ // test get_variable.
+ message_log("testing get_variable: '");
+ message_log(m->get_variable("test.text"));
+ message_log("'\n");
+ } else if (ctrl && key == SDLK_m) {
+ // Test call_method.
+ const char* result = m->call_method(
+ "test_call",
+ "%d, %f, %s, %ls",
+ 200,
+ 1.0f,
+ "Test string",
+ L"Test long string");
+
+ if (result) {
+ message_log("call_method: result = ");
+ message_log(result);
+ message_log("\n");
+ } else {
+ message_log("call_method: null result\n");
+ }
+ } else if (ctrl && key == SDLK_b) {
+ // toggle background color.
+ s_background = !s_background;
+ } else if (ctrl && key == SDLK_f) {
+ extern bool gnash_debug_show_paths;
+ gnash_debug_show_paths = !gnash_debug_show_paths;
+ } else if (ctrl && key == SDLK_EQUALS) {
+ float f = gnash::get_curve_max_pixel_error();
+ f *= 1.1f;
+ gnash::set_curve_max_pixel_error(f);
+ printf("curve error tolerance = %f\n", f);
+ } else if (ctrl && key == SDLK_MINUS) {
+ float f = gnash::get_curve_max_pixel_error();
+ f *= 0.9f;
+ gnash::set_curve_max_pixel_error(f);
+ printf("curve error tolerance = %f\n", f);
+ }
+
+ key_event(key, true);
+
+ break;
+ }
+
+ case SDL_KEYUP:
+ {
+ SDLKey key = event.key.keysym.sym;
+ key_event(key, false);
+ break;
+ }
+
+ case SDL_MOUSEMOTION:
+ mouse_x = (int) (event.motion.x / s_scale);
+ mouse_y = (int) (event.motion.y / s_scale);
+ break;
+
+ case SDL_MOUSEBUTTONDOWN:
+ case SDL_MOUSEBUTTONUP:
+ {
+ int mask = 1 << (event.button.button - 1);
+ if (event.button.state == SDL_PRESSED) {
+ mouse_buttons |= mask;
+ } else {
+ mouse_buttons &= ~mask;
+ }
+ break;
+ }
+
+ case SDL_QUIT:
+ goto done;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ m = gnash::get_current_root();
+ gnash::delete_unused_root();
+
+ m->set_display_viewport(0, 0, width, height);
+ m->set_background_alpha(s_background ? 1.0f : 0.05f);
+
+ m->notify_mouse_state(mouse_x, mouse_y, mouse_buttons);
+
+ m->advance(delta_t * speed_scale);
+
+ if (do_render) {
+ glDisable(GL_DEPTH_TEST); // Disable depth testing.
+ glDrawBuffer(GL_BACK);
+ }
+ m->display();
+ frame_counter++;
+
+ if (do_render) {
+ SDL_GL_SwapBuffers();
+ //glPopAttrib ();
+
+ if (s_measure_performance == false) {
+ // Don't hog the CPU.
+ // if (!nodelay)
+ if (!gofast) {
+ SDL_Delay(delay);
+ }
+ } else {
+ // Log the frame rate every second or so.
+ if (last_ticks - last_logged_fps > 1000) {
+ float delta = (last_ticks - last_logged_fps) / 1000.f;
+
+ if (delta > 0) {
+ printf("fps = %3.1f\n", frame_counter / delta);
+ } else {
+ printf("fps = *inf*\n");
+ }
+
+ last_logged_fps = last_ticks;
+ frame_counter = 0;
+ }
+ }
+ }
+
+ // See if we should exit.
+ if (do_loop == false
+ && m->get_current_frame() + 1 == md->get_frame_count())
+ {
+ // We're reached the end of the movie; exit.
+ break;
+ }
+ }
+
+ done:
+ doneYet = 1;
+ SDL_KillThread(thread); // kill the network read thread
+ //SDL_Quit();
+
+ if (md) md->drop_ref();
+ if (m) m->drop_ref();
+ delete sound;
+ delete render;
+
+ // For testing purposes, throw some keypresses
+ // to make sure the key handler is properly using weak
+ // references to listeners.
+ gnash::notify_key_event(gnash::key::A, true);
+ gnash::notify_key_event(gnash::key::B, true);
+ gnash::notify_key_event(gnash::key::C, true);
+
+ // Clean up as much as possible, so valgrind will help find actual leaks.
+ gnash::clear();
+
+ return 0;
}
static int
runThread(void *nothing)
{
#ifdef HAVE_LIBXML
-
- //int i = 123;
- int val;
- int count = 0;
- SDL_Event *ptr;
+
+ //int i = 123;
+ int val;
+ int count = 0;
+ SDL_Event *ptr;
#if 1
- SDL_Event ev;
- ev.type = SDL_USEREVENT;
- ev.user.code = 0;
- ev.user.data1 = 0;
- ev.user.data2 = 0;
- ptr = &ev;
+ SDL_Event ev;
+ ev.type = SDL_USEREVENT;
+ ev.user.code = 0;
+ ev.user.data1 = 0;
+ ev.user.data2 = 0;
+ ptr = &ev;
#else
- ptr = (SDL_Event *)ev_ptr;
- ptr->type = SDL_USEREVENT;
- ptr->user.code = 0;
- ptr->user.data1 = 0;
- ptr->user.data2 = 0;
+ ptr = (SDL_Event *)ev_ptr;
+ ptr->type = SDL_USEREVENT;
+ ptr->user.code = 0;
+ ptr->user.data1 = 0;
+ ptr->user.data2 = 0;
#endif
-
- printf("Initializing event thread...\n");
-
- while (gnash::check_sockets(xml_fd) == -1) {
- sleep(10); // Delay to give the socket time to
- // connect.
- continue;
- }
-
- // give everything a chance to initialize.
- // since all the frames need to be set up,
- // and this is just a more runtime performance
- // issue with CPU load.
- sleep(20);
-
- printf("Enabling Event Wait Mode...\n");
- s_start_waiting = true;
-
- while (!doneYet) {
- //ptr->user.data1 = (void *)i;
- if ((val = gnash::check_sockets(xml_fd)) == -1) {
- return -1; // we shouldn't be seeing any errors
- }
- // Don't push an event if there is already one in the
- // queue. XMLSocket::onData() will come around and get
- // the data anyway.
- count = SDL_PeepEvents(ptr, 1, SDL_PEEKEVENT, SDL_USEREVENT);
- // printf("%d User Events in queue\n", count);
- if ((count == 0) && (val >= 0)) {
- //printf("Pushing User Event on queue\n");
- SDL_PushEvent(ptr);
- SDL_Delay(300); // was 300
- }
- }
+
+ printf("Initializing event thread...\n");
+
+ while (gnash::check_sockets(xml_fd) == -1) {
+ sleep(10); // Delay to give the socket time to
+ // connect.
+ continue;
+ }
+
+ // give everything a chance to initialize.
+ // since all the frames need to be set up,
+ // and this is just a more runtime performance
+ // issue with CPU load.
+ sleep(20);
+
+ printf("Enabling Event Wait Mode...\n");
+ s_start_waiting = true;
+
+ while (!doneYet) {
+ //ptr->user.data1 = (void *)i;
+ if ((val = gnash::check_sockets(xml_fd)) == -1) {
+ return -1; // we shouldn't be seeing any errors
+ }
+ // Don't push an event if there is already one in the
+ // queue. XMLSocket::onData() will come around and get
+ // the data anyway.
+ count = SDL_PeepEvents(ptr, 1, SDL_PEEKEVENT, SDL_USEREVENT);
+ // printf("%d User Events in queue\n", count);
+ if ((count == 0) && (val >= 0)) {
+ //printf("Pushing User Event on queue\n");
+ SDL_PushEvent(ptr);
+ SDL_Delay(300); // was 300
+ }
+ }
#endif // HAVE_LIBXML
-
- return 0;
+
+ return 0;
}
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8
-// tab-width: 8
-// indent-tabs-mode: t
-// End:
Index: gnash/libgeometry/Makefile.am
diff -u gnash/libgeometry/Makefile.am:1.3 gnash/libgeometry/Makefile.am:1.4
--- gnash/libgeometry/Makefile.am:1.3 Tue Dec 27 17:22:11 2005
+++ gnash/libgeometry/Makefile.am Sat Jan 7 04:44:09 2006
@@ -21,7 +21,7 @@
AM_CXXFLAGS = $(CFLAGS) $(SDL_CFLAGS) $(INCLUDES)
AM_CPPFLAGS = -Wall
-AM_LDFLAGS = -lGL -lGLU $(SDL_LIBS)
+AM_LDFLAGS = $(OPENGL_LIBNS) $(SDL_LIBS)
lib_LTLIBRARIES = libgeometry.la
@@ -32,6 +32,7 @@
-I$(top_srcdir) \
-I$(top_srcdir)/libbase \
$(SDL_CFLAGS) \
+ $(OPENGL_CFLAGS) \
$(ENGINE_INCLUDE) \
$(LIBPNG_CFLAGS) \
$(ZLIB_CFLAGS) \
Index: gnash/libgeometry/geometry.h
diff -u gnash/libgeometry/geometry.h:1.1 gnash/libgeometry/geometry.h:1.2
--- gnash/libgeometry/geometry.h:1.1 Tue Dec 20 20:57:00 2005
+++ gnash/libgeometry/geometry.h Sat Jan 7 04:44:09 2006
@@ -20,7 +20,7 @@
float x, y, z; // these guys are out in public, no m_ prefix;
this matches most other conventions.
vec3() {}
- vec3(float _X, float _Y, float _Z) { x = _X; y = _Y; z = _Z; }
+ vec3(float XX, float YY, float ZZ) { x = XX; y = YY; z = ZZ; }
vec3(const vec3& v) { x = v.x; y = v.y; z = v.z; }
operator const float*() const { return &x; }
Index: gnash/macros/opengl.m4
diff -u gnash/macros/opengl.m4:1.1 gnash/macros/opengl.m4:1.2
--- gnash/macros/opengl.m4:1.1 Tue Dec 20 21:02:51 2005
+++ gnash/macros/opengl.m4 Sat Jan 7 04:44:09 2006
@@ -19,58 +19,66 @@
dnl Check for OpenGL & [Glut | GLU]
AC_DEFUN([AM_PATH_OPENGL], [
- AC_ARG_ENABLE(opengl, AC_HELP_STRING([--disable-opengl], [do not build
OpenGL]),
- [enableopengl=$enableval],
- [enableopengl="yes"]
- )
-
- if test x$enableopengl = "xyes"; then
- AC_CHECK_LIB(GL, glBegin,
- [AC_CHECK_HEADER(GL/gl.h,
- [ac_have_opengl="yes"
- OPENGL_LIBS="-lGL"
- dnl check for glut
- AC_CHECK_LIB(glut, glutInit,
- [ac_have_glut="yes"
- GLUT_LIBS="-lglut"
- AC_DEFINE(HAVE_GLUT,1,[Define this if you have GLut support
available])
- AC_DEFINE(HAVE_OPENGL,1,[Define this if you have OpenGL support
available])
- ],
- [ac_have_glut="no"
- dnl fallback, check for GLU
- AC_CHECK_LIB(GLU, gluPerspective,
- [ac_have_glu="yes"
- GLU_LIBS="-lGLU -lm"
- AC_DEFINE(HAVE_GLU,1,[Define this if you have GLU support
available])
- AC_DEFINE(HAVE_OPENGL,1,[Define this if you have OpenGL support
available])
- ],
- [ac_have_glu="no"],
- [$X_LIBS $X_PRE_LIBS $OPENGL_LIBS -lGLU -lm $X_EXTRA_LIBS]
- )
- ],
- [$X_LIBS $X_PRE_LIBS -lglut $X_EXTRA_LIBS]
- )
- ]
- )],
- [],
- [$X_LIBS $X_PRE_LIBS -lGL $X_EXTRA_LIBS]
- )
- if test x$ac_have_opengl = "xyes" -a x$ac_have_glut = "xyes" -o
x$ac_have_opengl = "xyes" -a x$ac_have_glu = "xyes"; then
- ac_use_opengl=yes
- fi
+dnl Add XML support, if specified.
+ AC_ARG_ENABLE(opengl, [ --disable-opengl Disable support for
OpenGL],
+ [case "${enableval}" in
+ yes) opengl=no ;;
+ no) pengl=yes ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for disable-opengl option]) ;;
+ esac],opengl=yes)
+
+ AM_CONDITIONAL(OPENGL, test x$opengl = xyes)
+
+ AC_ARG_WITH(opengl,[ --with-opengl=PFX Prefix where opengl is installed
(optional)], opengl_prefix="$withval", opengl_prefix="")
+ AC_ARG_WITH(opengl-libraries,[ --with-opengl-libraries=DIR Directory
where opengl library is installed (optional)], opengl_libraries="$withval",
opengl_libraries="")
+ AC_ARG_WITH(opengl-includes,[ --with-opengl-includes=DIR Directory where
opengl header files are installed (optional)], opengl_includes="$withval",
opengl_includes="")
+
+ if test "x$opengl_libraries" != "x" ; then
+ OPENGL_LIBS="-L$opengl_libraries -lxml2"
+ elif test "x$opengl_prefix" != "x" ; then
+ OPENGL_LIBS="-L$opengl_prefix/lib -lxml2"
fi
- AC_SUBST(OPENGL_CFLAGS)
- AC_SUBST(OPENGL_LIBS)
- AC_SUBST(GLUT_LIBS)
- AC_SUBST(GLU_LIBS)
- AM_CONDITIONAL(HAVE_OPENGL, [test x$ac_use_opengl = "xyes"])
+ if test "x$opengl_includes" != "x" ; then
+ OPENGL_CFLAGS="-I$opengl_includes"
+ elif test "x$opengl_prefix" != "x" ; then
+ OPENGL_CFLAGS="-I$opengl_prefix/include"
+ fi
- dnl result
- if test x$ac_use_opengl = "xyes"; then
- ifelse([$1], , :, [$1])
- else
- ifelse([$2], , :, [$2])
+ if test x"$opengl" = x"yes"; then
+ AC_CHECK_LIB(GL, glBegin)
+ AC_CHECK_HEADERS(GL/gl.h)
+ AC_CHECK_LIB(GLU, gluPerspective)
+ if test x"$HAVE_GL" = x; then
+ AC_MSG_CHECKING(futher locations for OpenGL Header files)
+ dirlist="/usr/X11R6 /usr /usr/local /opt /home/latest"
+ for i in $dirlist; do
+ if test -f $i/include/GL/gl.h; then
+ OPENGL_CFLAGS=-I`(cd $i/include; pwd)`
+ break
+ fi
+ done
+ if test x"$OPENGL_CFLAGS" != x; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ AC_MSG_CHECKING(futher locations for OpenGL library files)
+ for i in $dirlist; do
+ if test -f $i/lib/libGL.a; then
+ OPENGL_LIBS="-L`(cd $i/lib; pwd)` -lGL -lGLU"
+ break
+ fi
+ done
+ if test x"$OPENGL_LIBS" != x; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
fi
+ AC_SUBST(OPENGL_CFLAGS)
+ AC_SUBST(OPENGL_LIBS)
+ AM_CONDITIONAL(HAVE_OPENGL, [test x$ac_use_opengl = "xyes"])
])
Index: gnash/server/Makefile.am
diff -u gnash/server/Makefile.am:1.3 gnash/server/Makefile.am:1.4
--- gnash/server/Makefile.am:1.3 Tue Dec 27 17:22:11 2005
+++ gnash/server/Makefile.am Sat Jan 7 04:44:09 2006
@@ -52,6 +52,7 @@
render.cpp \
shape.cpp \
sound.cpp \
+ sound_handler_mp3.cpp \
stream.cpp \
styles.cpp \
tesselate.cpp \
Index: gnash/server/impl.cpp
diff -u gnash/server/impl.cpp:1.2 gnash/server/impl.cpp:1.3
--- gnash/server/impl.cpp:1.2 Mon Dec 26 15:57:26 2005
+++ gnash/server/impl.cpp Sat Jan 7 04:44:09 2006
@@ -1602,41 +1602,6 @@
s_movie_library_inst.clear();
}
-// tulrich: Vitaly sent this code. I don't trust it though! It looks
-// like it may be dropping refs in order to remove cyclic references.
-// I would rather fix the source of any cyclic references directly.
-//
-// void clear_library()
-// // Drop all library references to movie_definitions, so they
-// // can be cleaned up.
-// {
-// {for (hash< movie_definition_sub*, smart_ptr<movie_interface>
>::iterator it =
-// s_movie_library_inst.begin();
-// it != s_movie_library_inst.end();
-// ++it)
-// {
-// smart_ptr<movie_interface> obj = it->second;
-// while (obj->get_ref_count() > 2)
-// {
-// obj->drop_ref();
-// }
-// }}
-// s_movie_library_inst.clear();
-//
-// {for (stringi_hash< smart_ptr<movie_definition_sub> >::iterator
it = s_movie_library.begin();
-// it != s_movie_library.end();
-// ++it)
-// {
-// smart_ptr<movie_definition_sub> obj = it->second;
-// while (obj->get_ref_count() > 2)
-// {
-// obj->drop_ref();
-// }
-// }}
-// s_movie_library.clear();
-// }
-
-
movie_definition* create_library_movie(const char* filename)
// Try to load a movie from the given url, if we haven't
// loaded it already. Add it to our library on success, and
@@ -5029,10 +4994,3 @@
}
}
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8
-// tab-width: 8
-// indent-tabs-mode: t
-// End:
Index: gnash/server/sound_handler_mp3.cpp
diff -u gnash/server/sound_handler_mp3.cpp:1.1
gnash/server/sound_handler_mp3.cpp:1.2
--- gnash/server/sound_handler_mp3.cpp:1.1 Tue Dec 20 21:01:18 2005
+++ gnash/server/sound_handler_mp3.cpp Sat Jan 7 04:44:09 2006
@@ -10,8 +10,11 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#ifdef GNASH_MP3_SUPPORT
+#ifdef HAVE_LIBMAD
#include "gnash.h"
#include "container.h"
@@ -200,12 +203,4 @@
}
-#endif // GNASH_MP3_SUPPORT
-
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8
-// tab-width: 8
-// indent-tabs-mode: t
-// End:
+#endif // HAVE_LIBMAD
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ./ChangeLog server/Makefile.am server/imp...,
Rob Savoye <=