gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/Player.cpp server/gnash.h s...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/Player.cpp server/gnash.h s...
Date: Mon, 27 Nov 2006 15:57:51 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/27 15:57:51

Modified files:
        .              : ChangeLog 
        gui            : Player.cpp 
        server         : gnash.h impl.cpp movie_instance.cpp 
        server/parser  : movie_def_impl.cpp movie_definition.h 
        utilities      : processor.cpp 

Log message:
                * server/: gnash.h, impl.cpp: export the movie creation
                  functions taking additional argument to control
                  start of the loader thread.
                * server/parser/movie_definition.h: completeLoad()
                  definition moved in base class.
                * server/parser/movie_def_impl.cpp (create_instance):
                  don't execute actions of frame 0, delegate that
                  to movie_instance::advance.
                * server/movie_instance.cpp (advance): execute
                  actions in frame 0 on first call.
                * gui/Player.cpp (run), utilities/processor.cpp (play_move):
                  complete root movie load *after* the VM is initialized.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1789&r2=1.1790
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.77&r2=1.78
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.78&r2=1.79
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_instance.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_definition.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.39&r2=1.40

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1789
retrieving revision 1.1790
diff -u -b -r1.1789 -r1.1790
--- ChangeLog   27 Nov 2006 14:26:41 -0000      1.1789
+++ ChangeLog   27 Nov 2006 15:57:51 -0000      1.1790
@@ -1,5 +1,20 @@
 2006-11-27 Sandro Santilli <address@hidden>
 
+       * server/: gnash.h, impl.cpp: export the movie creation
+         functions taking additional argument to control
+         start of the loader thread.
+       * server/parser/movie_definition.h: completeLoad()
+         definition moved in base class.
+       * server/parser/movie_def_impl.cpp (create_instance):
+         don't execute actions of frame 0, delegate that
+         to movie_instance::advance.
+       * server/movie_instance.cpp (advance): execute
+         actions in frame 0 on first call.
+       * gui/Player.cpp (run), utilities/processor.cpp (play_move):
+         complete root movie load *after* the VM is initialized.
+
+2006-11-27 Sandro Santilli <address@hidden>
+
        * server/sprite_instance.cpp (get_member):
          clean up _name and _droptarget handling.
          (btw, we should use addProperty for these).

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- gui/Player.cpp      24 Nov 2006 11:52:18 -0000      1.31
+++ gui/Player.cpp      27 Nov 2006 15:57:51 -0000      1.32
@@ -216,7 +216,7 @@
        else
        {
                // _url should be always set at this point...
-               md = gnash::create_library_movie(URL(_infile), _url.c_str());
+               md = gnash::create_library_movie(URL(_infile), _url.c_str(), 
false);
        }
     } catch (const GnashException& er) {
        fprintf(stderr, "%s\n", er.what());
@@ -307,6 +307,9 @@
     //gnash::sprite_instance *m = create_library_movie_inst(_movie_def);
     assert(m);
 
+    // Start loader thread
+    _movie_def->completeLoad();
+
     // Parse parameters
     for ( map<string,string>::const_iterator it=params.begin(),
                itEnd=params.end(); it != itEnd; ++it)

Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- server/gnash.h      24 Nov 2006 09:17:49 -0000      1.77
+++ server/gnash.h      27 Nov 2006 15:57:51 -0000      1.78
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: gnash.h,v 1.77 2006/11/24 09:17:49 strk Exp $ */
+/* $Id: gnash.h,v 1.78 2006/11/27 15:57:51 strk Exp $ */
 
 /// \mainpage
 ///
@@ -224,7 +224,14 @@
 ///
 /// IFF real_url is given, the movie's url will be set to that value.
 ///
-movie_definition* create_movie(const URL& url, const char* real_url=NULL);
+/// @param startLoaderThread
+///    If false only the header will be read, and you'll need to call 
completeLoad
+///    on the returned movie_definition to actually start it. This is 
tipically 
+///    used to postpone parsing until a VirtualMachine is initialized.
+///    Initializing the VirtualMachine requires a target SWF version, which can
+///    be found in the SWF header.
+///
+movie_definition* create_movie(const URL& url, const char* real_url=NULL, bool 
startLoaderThread=true);
 
 /// Load a movie from an already opened stream.
 //
@@ -234,7 +241,14 @@
 /// No attempt will be made to load associated .gsc (cache) files
 /// by this function.
 ///
-DSOEXPORT movie_definition* create_movie(tu_file* in, const std::string& url);
+/// @param startLoaderThread
+///    If false only the header will be read, and you'll need to call 
completeLoad
+///    on the returned movie_definition to actually start it. This is 
tipically 
+///    used to postpone parsing until a VirtualMachine is initialized.
+///    Initializing the VirtualMachine requires a target SWF version, which can
+///    be found in the SWF header.
+///
+DSOEXPORT movie_definition* create_movie(tu_file* in, const std::string& url, 
bool startLoaderThread=true);
 
 /// Creates the movie from the given input stream. 
 //
@@ -292,7 +306,14 @@
 ///
 /// IFF real_url is given, the movie's url will be set to that value.
 ///
-DSOEXPORT movie_definition* create_library_movie(const URL& url, const char* 
real_url=NULL);
+/// @param startLoaderThread
+///    If false only the header will be read, and you'll need to call 
completeLoad
+///    on the returned movie_definition to actually start it. This is 
tipically 
+///    used to postpone parsing until a VirtualMachine is initialized.
+///    Initializing the VirtualMachine requires a target SWF version, which can
+///    be found in the SWF header.
+///
+DSOEXPORT movie_definition* create_library_movie(const URL& url, const char* 
real_url=NULL, bool startLoaderThread=true);
        
 
 /// Helper to pregenerate cached data (basically, shape tesselations). 

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- server/impl.cpp     24 Nov 2006 14:50:30 -0000      1.78
+++ server/impl.cpp     27 Nov 2006 15:57:51 -0000      1.79
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: impl.cpp,v 1.78 2006/11/24 14:50:30 strk Exp $ */
+/* $Id: impl.cpp,v 1.79 2006/11/27 15:57:51 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -393,7 +393,7 @@
        return m.release();
 }
 
-static movie_definition*
+movie_definition*
 create_movie(tu_file* in, const std::string& url, bool startLoaderThread)
 {
        assert(in);
@@ -432,7 +432,7 @@
        return ret;
 }
 
-static movie_definition*
+movie_definition*
 create_movie(const URL& url, const char* reset_url, bool startLoaderThread)
 {
        // URL::str() returns by value, save it to a local string
@@ -489,18 +489,6 @@
 
 }
 
-movie_definition*
-create_movie(const URL& url, const char* reset_url)
-{
-       return create_movie(url, reset_url, true);
-}
-
-movie_definition*
-create_movie(tu_file* in, const std::string& url)
-{
-       return create_movie(in, url, true);
-}
-
 
 bool   s_no_recurse_while_loading = false;     // @@ TODO get rid of this; 
make it the normal mode.
 
@@ -679,7 +667,7 @@
 // loaded it already.  Add it to our library on success, and
 // return a pointer to it.
 //
-movie_definition* create_library_movie(const URL& url, const char* real_url)
+movie_definition* create_library_movie(const URL& url, const char* real_url, 
bool startLoaderThread)
 {
 //    log_msg("%s: url is %s", __PRETTY_FUNCTION__, url.str().c_str());
 
@@ -721,10 +709,13 @@
        //        to allow loads of JPEG to use a loader thread
        //        too...
        //
+       if ( startLoaderThread )
+       {
        movie_def_impl* mdi = dynamic_cast<movie_def_impl*>(mov);
        if ( mdi ) {
                mdi->completeLoad();
        }
+       }
 
        return mov;
 }

Index: server/movie_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_instance.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/movie_instance.cpp   29 Oct 2006 18:34:11 -0000      1.4
+++ server/movie_instance.cpp   27 Nov 2006 15:57:51 -0000      1.5
@@ -79,6 +79,11 @@
        // 2. by different machines the random gave different numbers
        tu_random::next_random();
 
+       if (m_on_event_load_called == false)
+       {
+               execute_frame_tags(0); 
+       }
+
        advance_sprite(delta_time);
 
        if (m_on_event_load_called == false)

Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- server/parser/movie_def_impl.cpp    27 Nov 2006 11:22:43 -0000      1.46
+++ server/parser/movie_def_impl.cpp    27 Nov 2006 15:57:51 -0000      1.47
@@ -32,6 +32,7 @@
 #include "bitmap_character_def.h"
 #include "swf/TagLoadersTable.h"
 #include "movie_root.h"
+#include "VM.h" // for assertions
 
 #include <string>
 #include <unistd.h> 
@@ -603,6 +604,10 @@
        // should call this only once
        assert( ! _loader.started() );
 
+       // The VM is needed by the parser
+       // to allocate swf_function objects !
+       assert ( VM::isInitialized() );
+
        // should call readHeader before this
        assert( _str.get() != NULL );
 
@@ -820,12 +825,6 @@
 movie_def_impl::create_instance()
 {
 
-#ifdef LOAD_MOVIES_IN_A_SEPARATE_THREAD
-       // Guess we want to make sure the loader is started
-       // before we create an instance, right ?
-       assert (_loader.started());
-#endif
-
        // @@ Shouldn't we return a movie_instance instead ?
        // @@ and leave movie_root creation to the caller ..
 
@@ -836,16 +835,7 @@
     //root_movie->set_name("_root");
     m->set_root_movie(root_movie);
 
-    m->add_ref();
-
-       // I don't think we should be executing actions
-       // in first frame from *this* function, rather
-       // it should be the advance() function taking
-       // care of it... anyway, since we do, better
-       // to ensure the frame number 1 is loaded before
-       // messing with it.
-       ensure_frame_loaded(1);
-       root_movie->execute_frame_tags(0); // create _root dlist
+       m->add_ref(); // looking for leaks ??
 
     return m;
 }

Index: server/parser/movie_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_definition.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/parser/movie_definition.h    23 Nov 2006 20:14:13 -0000      1.10
+++ server/parser/movie_definition.h    27 Nov 2006 15:57:51 -0000      1.11
@@ -242,6 +242,12 @@
        /// from.
        virtual const std::string& get_url() const = 0;
 
+       // Start the loader thread. By default no loader thread is engaged
+       // so this function is a no-op.
+       virtual bool completeLoad() {
+               return true;
+       }
+
        /// \brief
        /// Ensure that frame number 'framenum' (1-based offset)
        /// has been loaded (load on demand).

Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- utilities/processor.cpp     24 Nov 2006 11:52:18 -0000      1.39
+++ utilities/processor.cpp     27 Nov 2006 15:57:51 -0000      1.40
@@ -17,7 +17,7 @@
 //
 //
 
-/* $Id: processor.cpp,v 1.39 2006/11/24 11:52:18 strk Exp $ */
+/* $Id: processor.cpp,v 1.40 2006/11/27 15:57:51 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -242,7 +242,7 @@
     gnash::movie_definition* md;
     try
     {
-      md = gnash::create_library_movie(URL(filename));
+      md = gnash::create_library_movie(URL(filename), NULL, false);
     }
     catch (GnashException& ge)
     {
@@ -256,6 +256,8 @@
 
     gnash::sprite_instance* m = VM::init(*md).getRoot();
     
+    md->completeLoad();
+    
     int        kick_count = 0;
     
     // Run through the movie.




reply via email to

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