gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10768: Some updates to make the cod


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10768: Some updates to make the code closer to build with current libcore.
Date: Sat, 04 Apr 2009 12:39:24 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10768
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Sat 2009-04-04 12:39:24 +0200
message:
  Some updates to make the code closer to build with current libcore.
  Doesn't all really build yet, but gnashpython.o seems to (altought I had to 
add a weird constructor to make boost::python happy)
modified:
  pythonmodule/gnashpython.cpp
  pythonmodule/gnashpython.h
  pythonmodule/pyGnash.cpp
=== modified file 'pythonmodule/gnashpython.cpp'
--- a/pythonmodule/gnashpython.cpp      2009-02-25 22:33:03 +0000
+++ b/pythonmodule/gnashpython.cpp      2009-04-04 10:39:24 +0000
@@ -32,6 +32,8 @@
 #include "SystemClock.h"
 #include "log.h"
 #include "rc.h"
+#include "StreamProvider.h" // for passing to RunInfo
+#include "RunInfo.h" // for initialization
 
 #include <string>
 #include <memory>
@@ -117,7 +119,7 @@
 
 // Set our _url member and pass this to the core.
 void
-GnashPlayer::setBaseURL(std::string url)
+GnashPlayer::setBaseURL(const std::string& url)
 {
 
     // Don't allow empty urls
@@ -125,10 +127,11 @@
 
     _url = url;
 
-    // Pass the base URL to the core libs. We can only do this
-    // once! Checking if it's been set when it hasn't trigger
-    // an assertion failure...
-    gnash::set_base_url( (gnash::URL)_url );
+
+    /// The RunInfo should be populated before parsing.
+    _runInfo.reset(new RunInfo(url));
+    _runInfo->setStreamProvider(boost::shared_ptr<StreamProvider>(
+                new StreamProvider));
 }
 
 
@@ -158,45 +161,28 @@
     // Fail if base URL not set
     if (_url == "") return false;
 
-    std::auto_ptr<tu_file> in(noseek_fd_adapter::make_stream(fileno(file)));
+    std::auto_ptr<IOChannel> in(noseek_fd_adapter::make_stream(fileno(file)));
       
-    _movieDef = gnash::create_movie(in, _url, false);
+    _movieDef = gnash::create_movie(in, _url, *_runInfo, false);
     
     if (!_movieDef) {
         return false;
     }
+
+       _movieRoot = new movie_root(*_movieDef, _manualClock, *_runInfo);
+
+       _movieDef->completeLoad();
+       _movieDef->ensure_frame_loaded(_movieDef->get_frame_count());
+
+       std::auto_ptr<movie_instance> mi ( _movieDef->create_movie_instance() );
+
+       // Finally, place the root movie on the stage ...
+    _movieRoot->setRootMovie( mi.release() );
     
     return true;
 }
 
 
-bool
-GnashPlayer::initVM()
-{
-
-    if (!_movieDef || _movieRoot ) return false;
-
-    // Initialize the VM with a manual clock
-    _movieRoot = &(gnash::VM::init(*_movieDef, _manualClock).getRoot());
-
-    if (!_movieRoot) {
-        // Something didn't work
-        return false;
-    }
-    
-    _movieDef->completeLoad();
-    _movieDef->ensure_frame_loaded(getSWFFrameCount());
-
-    // I don't know why it's done like this.
-    std::auto_ptr<movie_instance> mi (_movieDef->create_movie_instance());
-
-    // Put the instance on stage.
-    _movieRoot->setRootMovie( mi.release() ); 
-   
-    return true; 
-}
-
-
 // Whether debug messages are sent to stdout
 void
 GnashPlayer::setVerbosity(unsigned verbosity)
@@ -440,7 +426,7 @@
 {
     REQUIRE_VM_STARTED;
 
-    gnash::character* c = _movieRoot->getRootMovie()->get_character(id);
+    gnash::DisplayObject* c = _movieRoot->getRootMovie()->getDisplayObject(id);
     
     if (!c) return NULL;
     
@@ -454,7 +440,7 @@
 {
     REQUIRE_VM_STARTED;
 
-    gnash::character* c = _movieRoot->getActiveEntityUnderPointer();
+    gnash::DisplayObject* c = _movieRoot->getActiveEntityUnderPointer();
     
     if (!c) return NULL;
     
@@ -463,7 +449,7 @@
     return chr;
 }
 
-GnashCharacter::GnashCharacter(gnash::character* c)
+GnashCharacter::GnashCharacter(gnash::DisplayObject* c)
     :
     _character(c)
 {
@@ -484,7 +470,7 @@
 GnashCharacter*
 GnashCharacter::getParent()
 {
-    gnash::character* c = _character->get_parent();
+    gnash::DisplayObject* c = _character->get_parent();
 
     if (!c) return NULL;
     

=== modified file 'pythonmodule/gnashpython.h'
--- a/pythonmodule/gnashpython.h        2009-02-25 22:33:03 +0000
+++ b/pythonmodule/gnashpython.h        2009-04-04 10:39:24 +0000
@@ -30,13 +30,16 @@
 #include "movie_root.h"
 #include "movie_definition.h"
 #include "render_handler.h"
-#include "character.h"
+#include "DisplayObject.h"
 #include "log.h"
+#include "RunInfo.h" // for composition
+#include "IOChannel.h"
 
 #include <string>
 #include <memory>
 #include <deque>
 #include <boost/python.hpp>
+#include <boost/cstdint.hpp> // For C99 int types
 
 // Because the Python bindings are there to allow flexible access
 // to Gnash in an interpreted language, there need to be many
@@ -66,6 +69,9 @@
     GnashPlayer();
     ~GnashPlayer();
 
+    // This seems required by BOOST_PYTHON_MODULE ?
+    GnashPlayer(const GnashPlayer&) {};
+
     // For exiting
     void close();
 
@@ -73,7 +79,6 @@
     
     /// Takes a python file object
     bool loadMovie(PyObject& pf);
-    bool initVM();
 
     // Renderer
     bool setRenderer(const std::string& r);
@@ -123,7 +128,7 @@
     
 private:
     void init();
-    void setBaseURL(std::string url);
+    void setBaseURL(const std::string& url);
     bool addRenderer(gnash::render_handler* handler);
 
     gnash::movie_definition* _movieDef;
@@ -145,42 +150,43 @@
 
     static void receiveLogMessages(const std::string& s);
 
+    std::auto_ptr<RunInfo> _runInfo;
 };
 
 class GnashCharacter
 {
 public:
     GnashCharacter();
-    GnashCharacter(gnash::character* c);
+    GnashCharacter(gnash::DisplayObject* c);
     ~GnashCharacter();
 
     // The only constant aspect of a character?
-    const int id() { return _character->get_id(); }
-
-    std::string name() { return _character->get_name(); }
-
-    const char* textName() { return _character->get_text_name(); }
+    int id() { return _character->get_id(); }
+
+    const std::string& name() { return _character->get_name(); }
+
+    //const char* textName() { return _character->get_text_name(); }
 
     std::string target() { return _character->getTarget(); }
 
-    float ratio() { return _character->get_ratio(); }
+    int ratio() { return _character->get_ratio(); }
 
     int depth() { return _character->get_depth(); }
     
     int clipDepth() { return _character->get_clip_depth(); }
     
-    float height() { return _character->get_height(); }
+    boost::uint32_t height() { return _character->get_height(); }
     
-    float width() { return _character->get_width(); }
+    boost::uint32_t width() { return _character->get_width(); }
 
-    bool visible() { return _character->get_visible(); }
+    bool visible() { return _character->isVisible(); }
     
     void advance() { _character->advance(); }
     
     GnashCharacter* getParent();
     
 private:
-    gnash::character*  _character;
+    gnash::DisplayObject*  _character;
 };
 
 }

=== modified file 'pythonmodule/pyGnash.cpp'
--- a/pythonmodule/pyGnash.cpp  2009-02-25 22:33:03 +0000
+++ b/pythonmodule/pyGnash.cpp  2009-04-04 10:39:24 +0000
@@ -44,7 +44,7 @@
  
         .def("loadMovie", &pythonwrapper::GnashPlayer::loadMovie, 
                     "Load the file object passed")
-        .def("initVM", &pythonwrapper::GnashPlayer::initVM)
+        //.def("initVM", &pythonwrapper::GnashPlayer::initVM)
 
         .def("setRenderer", &pythonwrapper::GnashPlayer::setRenderer,
                                "Sets the renderer to use. Pass a string naming 
the "
@@ -105,7 +105,7 @@
 
         .def("id", &pythonwrapper::GnashCharacter::id)
         .def("depth", &pythonwrapper::GnashCharacter::depth)
-        .def("textName", &pythonwrapper::GnashCharacter::textName)
+        //.def("textName", &pythonwrapper::GnashCharacter::textName)
         .def("clipDepth", &pythonwrapper::GnashCharacter::clipDepth)
         .def("height", &pythonwrapper::GnashCharacter::height)
         .def("width", &pythonwrapper::GnashCharacter::height)    


reply via email to

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