gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] problems building under gui/


From: Rob Savoye
Subject: Re: [Gnash-dev] problems building under gui/
Date: Tue, 16 May 2006 09:20:24 -0600
User-agent: Thunderbird 1.5 (X11/20051201)

strk wrote:
> With current HEAD branch I can't build under gui/
> while I succeed under backend/

> Error under gui/ is missing gtkgl.h (which is the reason
> I'm using sdl GUI, btw).

  Try this patch, it works for me. The problem is gui/gnash.cpp isn't
keeping pace with the other changes for URLs and movies. (all good, btw)
This fixes the compilation problem, but for some reason the movie never
gets initialized. Once that is tracked down, I'll check this in.

  One question on your new changes, is there a reason to use an array of
 movie names on the command line instead of just one ?

cvs diff: Diffing gui
Index: gui/gnash.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gnash.cpp,v
retrieving revision 1.10
diff -u -b -B -w -r1.10 gnash.cpp
--- gui/gnash.cpp       13 May 2006 05:45:27 -0000      1.10
+++ gui/gnash.cpp       16 May 2006 15:20:48 -0000
@@ -60,27 +60,14 @@

 #include "gnash.h"
 #include "movie_definition.h"
+#include "URL.h"
+#include "GnashException.h"

 using namespace std;
 using namespace gnash;

 static void usage ();
 static void version_and_copyright();
-static bool advance_movie(void* data);
-
-static tu_file*
-file_opener(const char* url)
-// Callback function.  This opens files for the library.
-{
-//    GNASH_REPORT_FUNCTION;
-
-    if (strcmp(url, "-") == 0) {
-        FILE *newin = fdopen(dup(0),"rb");
-        return new tu_file(newin, false);
-    } else {
-        return new tu_file(url, "rb");
-    }
-}

 static void
 fs_callback(gnash::movie_interface* movie, const char* command, const
char* args)
@@ -97,7 +84,7 @@
 main(int argc, char *argv[])
 {
     int render_arg; // XXX we probably want to be using this.
-    char* infile = NULL;
+    std::vector<const char*> infiles;
     string url;

     unsigned long windowid = 0;
@@ -239,7 +226,7 @@
       if (strchr(argv[optind], '=')) {
          dbglogfile << "Got variable option on command line!" << endl;
       } else {
-         infile = argv[optind];
+         infiles.push_back(argv[optind]);
          break;
       }
       optind++;
@@ -252,13 +239,12 @@
     }

     // No file name was supplied
-    if (!infile) {
-       std::cerr << "Error: no input file was specified." << endl << endl;
+    if (infiles.size() == 0) {
+       std::cerr << "Error: no input files were specified!" << endl <<
endl;
        usage();
        return EXIT_FAILURE;
     }

-    gnash::register_file_opener_callback(file_opener);
     gnash::register_fscommand_callback(fs_callback);

     std::auto_ptr<gnash::sound_handler>  sound;
@@ -274,11 +260,16 @@
     // Get info about the width & height of the movie.
     int        movie_version = 0, movie_width = 0, movie_height = 0;
     float movie_fps = 30.0f;
-
-    gnash::get_movie_info(infile, &movie_version, &movie_width,
+    try {
+        gnash::get_movie_info(URL(infiles[0]), &movie_version,
&movie_width,
                           &movie_height, &movie_fps, NULL, NULL);
+    } catch (const GnashException& er) {
+        fprintf(stderr, "%s\n", er.what());
+        movie_version = 0;
+    }
+
     if (movie_version == 0) {
-      std::cerr << "Error: can't get info about " << infile << "." << endl;
+      std::cerr << "Error: can't get info about " << infiles[0] << "."
<< endl;       return EXIT_FAILURE;
     }

@@ -301,14 +292,23 @@
     gui.createWindow(width, height);

     // Load the actual movie.
-    smart_ptr<gnash::movie_definition> md =
gnash::create_library_movie(infile);
-    if (!md.get_ptr())
-      return EXIT_FAILURE;
-
-    smart_ptr<gnash::movie_interface>  m =
create_library_movie_inst(md.get_ptr());
-    assert(m.get_ptr());
-
-    gnash::set_current_root(m.get_ptr());
+    // Load the actual movie.
+    gnash::movie_definition* md;
+    try {
+      md = gnash::create_library_movie(URL(infiles[0]));
+    } catch (const GnashException& er) {
+      fprintf(stderr, "%s\n", er.what());
+      md = NULL;
+    }
+    if (md == NULL) {
+        fprintf(stderr, "error: can't create a movie from '%s'\n",
infiles[0]);+        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);
+    }

     m->set_display_viewport(0, 0, width, height);
     m->set_background_alpha(background ? 1.0f : 0.05f);
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.10
diff -u -b -B -w -r1.10 gtk.cpp
--- gui/gtk.cpp 13 May 2006 05:45:27 -0000      1.10
+++ gui/gtk.cpp 16 May 2006 15:20:48 -0000
@@ -51,7 +51,7 @@

 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
-
+# include <gtk/gtkgl.h>

 using namespace std;

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.6
diff -u -b -B -w -r1.6 gui.cpp
--- gui/gui.cpp 13 May 2006 05:45:27 -0000      1.6
+++ gui/gui.cpp 16 May 2006 15:20:48 -0000
@@ -202,10 +202,14 @@
     Gui *gui = reinterpret_cast<Gui*> (data);
     gnash::movie_interface* m = gnash::get_current_root();

+    if (m) {
     m->notify_mouse_state(gui->getMouseX(), gui->getMouseY(),
gui->getMouseButtons());

     m->advance(1.0);
     m->display();
+    } else {
+        log_error("Movie not initialized!\n");
+    }

     gui->renderBuffer();







reply via email to

[Prev in Thread] Current Thread [Next in Thread]