gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/avm2 r9701: Merge from trunk


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9701: Merge from trunk
Date: Tue, 31 Mar 2009 11:45:01 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9701
committer: Sandro Santilli <address@hidden>
branch nick: avm2
timestamp: Tue 2009-03-31 11:45:01 +0200
message:
  Merge from trunk
modified:
  configure.ac
  gui/Player.cpp
  gui/gtk.cpp
  gui/gui.cpp
  gui/gui.h
  libamf/amf_msg.cpp
  libbase/curl_adapter.cpp
  libcore/VirtualClock.h
  libcore/asobj/LoadableObject.cpp
  libcore/asobj/MovieClipLoader.cpp
  libcore/asobj/NetStream_as.cpp
  libcore/asobj/TextSnapshot_as.cpp
  libcore/fill_style.cpp
  libcore/parser/SWFMovieDefinition.cpp
  libcore/swf.h
  libcore/vm/VM.h
  libnet/network.cpp
  macros/gnashpkgtool.m4
  macros/pthreads.m4
  testsuite/as3/Makefile.am
  testsuite/as3/basic.as
    ------------------------------------------------------------
    revno: 9439.1.1299
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Thu 2009-03-26 08:40:02 +0100
    message:
      Don't close_tag if open_tag wasn't successful.
    modified:
      libcore/parser/SWFMovieDefinition.cpp
    ------------------------------------------------------------
    revno: 9439.1.1300
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Thu 2009-03-26 08:50:45 +0100
    message:
      fill_style::set_lerp : don't pretend that gradient bitmaps
      are the same for the two shapes of a morph. Dunno if this is correct
      but was the behaviour before I merged bitmap and gradient bitmapInfo
      into one. Fixes assertion failure in bug #25998.
    modified:
      libcore/fill_style.cpp
    ------------------------------------------------------------
    revno: 9439.1.1301
    committer: Benjamin Wolsey <address@hidden>
    branch nick: trunk
    timestamp: Thu 2009-03-26 09:02:06 +0100
    message:
      Don't add separator1 to the file menu twice. Fixes GTK complaint.
    modified:
      gui/gtk.cpp
    ------------------------------------------------------------
    revno: 9439.1.1302
    committer: Benjamin Wolsey <address@hidden>
    branch nick: trunk
    timestamp: Thu 2009-03-26 09:13:16 +0100
    message:
      Fix movie size on restart. Fix suggested by Michael Fötsch.
    modified:
      gui/gui.cpp
        ------------------------------------------------------------
        revno: 9439.297.11
        committer: Benjamin Wolsey <address@hidden>
        branch nick: work
        timestamp: Thu 2009-03-26 09:11:38 +0100
        message:
          Patch as suggested by Michael Fötsch to fix size on restart.
        modified:
          gui/gui.cpp
    ------------------------------------------------------------
    revno: 9439.1.1303
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Thu 2009-03-26 09:16:06 +0100
    message:
      Hide menu bar when in fullscreen. Fixes bug 25959
    modified:
      gui/gtk.cpp
    ------------------------------------------------------------
    revno: 9439.1.1304
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Fri 2009-03-27 11:05:20 +0100
    message:
      Update info about SWTTABINDEX tag
    modified:
      libcore/swf.h
    ------------------------------------------------------------
    revno: 9439.1.1305
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Fri 2009-03-27 17:17:01 +0100
    message:
      Stop mentioning the now obsoleted --enable-mit-shm. Fixes bug #26029.
    modified:
      configure.ac
    ------------------------------------------------------------
    revno: 9439.1.1306
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Fri 2009-03-27 17:19:10 +0100
    message:
      Cast fill type to int, as the format string suggests being intended
    modified:
      libcore/fill_style.cpp
    ------------------------------------------------------------
    revno: 9439.1.1307
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Sat 2009-03-28 10:31:01 +0100
    message:
      Move the clock source from Player to Gui, have the Gui use an 
InterruptableVirtualClock controlled by gui pause/play. Have NetStream use the 
VM clock as source for the PlayBack clock. This commit basically makes the 
NetStream Playback
      clock controlled by the Gui so that after pause/resume you don't have to
      wait for the whole time elapsed while paused to be consumed before 
proceeding.
      See the difference going to youtube and doing some pause/resume operations
      using the Gui controls (^p).
    modified:
      gui/Player.cpp
      gui/gui.cpp
      gui/gui.h
      libcore/asobj/NetStream_as.cpp
      libcore/vm/VM.h
    ------------------------------------------------------------
    revno: 9439.1.1308
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Sat 2009-03-28 10:54:42 +0100
    message:
      InterruptableVirtualClock semantic change: do NOT take ownership of 
source clock. Makes more sense, as NetStream for instance hooks a time tap to 
the gnash source clock but doesn't want to destroy that clock afterwards (taps 
don't take ownerhip of water pumps!)
    modified:
      gui/gui.cpp
      libcore/VirtualClock.h
      libcore/asobj/NetStream_as.cpp
    ------------------------------------------------------------
    revno: 9439.1.1309
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Sat 2009-03-28 12:44:39 +0100
    message:
      Fix build with USE_CURL undefined. Fixes bug #26036
    modified:
      libbase/curl_adapter.cpp
    ------------------------------------------------------------
    revno: 9439.1.1310
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Sun 2009-03-29 21:26:31 +0200
    message:
      Really fix bug #26036 (fully tested now); include arpa/inet.h for htons
    modified:
      libamf/amf_msg.cpp
      libbase/curl_adapter.cpp
        ------------------------------------------------------------
        revno: 9439.298.1
        committer: Sandro Santilli <address@hidden>
        branch nick: trunk
        timestamp: Sun 2009-03-29 15:08:23 +0200
        message:
          Include arpa/inet.h for htons, move system includes after local ones
        modified:
          libamf/amf_msg.cpp
    ------------------------------------------------------------
    revno: 9439.1.1311
    committer: Benjamin Wolsey <address@hidden>
    branch nick: trunk
    timestamp: Mon 2009-03-30 17:27:53 +0200
    message:
      Clean up MovieClipLoader.
    modified:
      libcore/asobj/LoadableObject.cpp
      libcore/asobj/MovieClipLoader.cpp
        ------------------------------------------------------------
        revno: 9439.299.1
        committer: Benjamin Wolsey <address@hidden>
        branch nick: work
        timestamp: Mon 2009-03-30 09:22:26 +0200
        message:
          Clean up MovieClipLoader.
        modified:
          libcore/asobj/MovieClipLoader.cpp
        ------------------------------------------------------------
        revno: 9439.299.2
        committer: Benjamin Wolsey <address@hidden>
        branch nick: work
        timestamp: Mon 2009-03-30 09:45:40 +0200
        message:
          Modify interface.
        modified:
          libcore/asobj/MovieClipLoader.cpp
        ------------------------------------------------------------
        revno: 9439.299.3
        committer: Benjamin Wolsey <address@hidden>
        branch nick: work
        timestamp: Mon 2009-03-30 11:49:01 +0200
        message:
          Minor improvement to LoadableObject.
        modified:
          libcore/asobj/LoadableObject.cpp
        ------------------------------------------------------------
        revno: 9439.299.4
        committer: Benjamin Wolsey <address@hidden>
        branch nick: work
        timestamp: Mon 2009-03-30 11:50:27 +0200
        message:
          Move empty dtor inline.
        modified:
          libcore/asobj/MovieClipLoader.cpp
    ------------------------------------------------------------
    revno: 9439.1.1312
    committer: Benjamin Wolsey <address@hidden>
    branch nick: trunk
    timestamp: Mon 2009-03-30 20:09:06 +0200
    message:
      Don't forget to markAsObjectReachable().
    modified:
      libcore/asobj/MovieClipLoader.cpp
    ------------------------------------------------------------
    revno: 9439.1.1313
    committer: address@hidden
    branch nick: trunk
    timestamp: Mon 2009-03-30 17:21:33 -0600
    message:
      Don't create a --enable-* option, as it confuses people, and is never 
used anyway.
    modified:
      macros/gnashpkgtool.m4
    ------------------------------------------------------------
    revno: 9439.1.1314
    committer: address@hidden
    branch nick: trunk
    timestamp: Mon 2009-03-30 17:24:05 -0600
    message:
      comment out inet_lnaof(), it's not used.
    modified:
      libnet/network.cpp
    ------------------------------------------------------------
    revno: 9439.1.1315
    committer: address@hidden
    branch nick: trunk
    timestamp: Mon 2009-03-30 17:35:25 -0600
    message:
      when cross-compiling, assume we don't need any flags for pthreads support.
    modified:
      macros/pthreads.m4
    ------------------------------------------------------------
    revno: 9439.1.1316
    committer: address@hidden
    branch nick: trunk
    timestamp: Mon 2009-03-30 17:47:37 -0600
    message:
      cast boost::int32_t to a real int so std::max is happy when cross 
compiling.
    modified:
      libcore/asobj/TextSnapshot_as.cpp
    ------------------------------------------------------------
    revno: 9439.1.1317
    committer: Sandro Santilli <address@hidden>
    branch nick: trunk
    timestamp: Tue 2009-03-31 11:02:23 +0200
    message:
      Add totals check and 'done' call at end of as3 testcase, add 
last-line-output check in testrunner and expect it to fail.
    modified:
      testsuite/as3/Makefile.am
      testsuite/as3/basic.as
=== modified file 'configure.ac'
--- a/configure.ac      2009-03-24 10:56:52 +0000
+++ b/configure.ac      2009-03-31 09:45:01 +0000
@@ -2266,12 +2266,6 @@
   echo "        Intel 810 LOD bias hack disabled (default). Use 
--enable-i810-lod-bias to enable."
 fi
 
-if test x"$xmitshm" = x"yes"; then
-  echo "        MIT-SHM X extension support enabled"
-else
-  echo "        MIT-SHM X extension support disabled (default). Use 
--enable-mit-shm to enable."
-fi
-
 if test x"$pthreads" = x"yes"; then
   echo "        POSIX Threads support enabled (default)"
 else

=== modified file 'gui/Player.cpp'
--- a/gui/Player.cpp    2009-02-12 15:15:22 +0000
+++ b/gui/Player.cpp    2009-03-28 09:31:01 +0000
@@ -416,8 +416,7 @@
     // Now that we know about movie size, create gui window.
     _gui->createWindow(_url.c_str(), _width, _height);
 
-    SystemClock clock; // use system clock here...
-    movie_root root(*_movieDef, clock, *_runInfo);
+    movie_root root(*_movieDef, _gui->getClock(), *_runInfo);
 
     _callbacksHandler.reset(new CallbacksHandler(*_gui, *this)); 
     

=== modified file 'gui/gtk.cpp'
--- a/gui/gtk.cpp       2009-03-19 10:26:17 +0000
+++ b/gui/gtk.cpp       2009-03-26 08:16:06 +0000
@@ -513,6 +513,7 @@
 #ifdef USE_MENUS
     if (!_menubar) return;
     if (show) gtk_widget_show(_menubar);
+    else gtk_widget_hide(_menubar);
 #endif
 }
 
@@ -675,9 +676,9 @@
 #endif
     createHelpMenu(GTK_WIDGET(_popup_menu));
 
-    GtkWidget *separator1 = gtk_separator_menu_item_new ();
-    gtk_widget_show (separator1);
-    gtk_container_add (GTK_CONTAINER (_popup_menu), separator1);
+    GtkWidget *separator1 = gtk_separator_menu_item_new();
+    gtk_widget_show(separator1);
+    gtk_container_add (GTK_CONTAINER(_popup_menu), separator1);
 
     /// The sound handler is initialized after the Gui is created, and
     /// may be disabled or enabled dynamically.
@@ -688,11 +689,10 @@
     gtk_widget_show(GTK_WIDGET(menusound));
     g_signal_connect(menusound, "activate", G_CALLBACK(menuSound), this);
 
-    GtkWidget *separator2 = gtk_separator_menu_item_new ();
-    gtk_widget_show (separator2);
-    gtk_container_add (GTK_CONTAINER (_popup_menu), separator2);
+    GtkWidget *separator2 = gtk_separator_menu_item_new();
+    gtk_widget_show(separator2);
+    gtk_container_add (GTK_CONTAINER(_popup_menu), separator2);
 
-    gtk_container_add (GTK_CONTAINER (_popup_menu), separator1);
     GtkWidget *quit = gtk_image_menu_item_new_from_stock("gtk-quit", 0);
     gtk_widget_show(quit);
     gtk_container_add(GTK_CONTAINER(_popup_menu), quit);

=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp       2009-03-13 20:49:33 +0000
+++ b/gui/gui.cpp       2009-03-28 09:54:42 +0000
@@ -103,6 +103,12 @@
     ,_stopped(false)
     ,_started(false)
     ,_showUpdatedRegions(false)
+
+    // NOTE: it's important that _systemClock is constructed
+    //       before and destroyed after _virtualClock !
+    ,_systemClock()
+    ,_virtualClock(_systemClock)
+
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS 
     ,_xpointer(0)
     ,_ypointer(0)
@@ -145,6 +151,12 @@
     ,_stopped(false)
     ,_started(false)
     ,_showUpdatedRegions(false)
+
+    // NOTE: it's important that _systemClock is constructed
+    //       before and destroyed after _virtualClock !
+    ,_systemClock()
+    ,_virtualClock(_systemClock)
+
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS 
     ,_xpointer(0)
     ,_ypointer(0)
@@ -820,6 +832,9 @@
         //       already what it is ?!
         sound::sound_handler* s = _stage->runInfo().soundHandler();
         if ( s ) s->unpause();
+
+        log_debug("Starting virtual clock");
+        _virtualClock.resume();
     }
 
     playHook ();
@@ -841,6 +856,9 @@
     sound::sound_handler* s = _stage->runInfo().soundHandler();
     if ( s ) s->pause();
 
+    log_debug("Pausing virtual clock");
+    _virtualClock.pause();
+
     stopHook();
 }
 
@@ -853,12 +871,19 @@
     }
     else
     {
+        // TODO: call stop() instead ?
+        // The only thing I see is that ::stop exits full-screen,
+        // but I'm not sure that's intended behaviour
+
         // @todo since we registered the sound handler, shouldn't we know
         //       already what it is ?!
        sound::sound_handler* s = _stage->runInfo().soundHandler();
        if ( s ) s->pause();
         _stopped = true;
 
+        log_debug("Pausing virtual clock");
+        _virtualClock.pause();
+
         stopHook();
     }
 }
@@ -877,7 +902,6 @@
     mr->setVariables(_flashVars);
 
     _stage->setRootMovie( mr.release() ); // will construct the instance
-    resize_view(_width, _height); // to properly update stageMatrix if scaling 
is given 
 
     bool background = true; // ??
     _stage->set_background_alpha(background ? 1.0f : 0.05f);
@@ -887,6 +911,13 @@
     sound::sound_handler* s = _stage->runInfo().soundHandler();
     if ( s ) s->unpause();
     _started = true;
+    
+    // to properly update stageMatrix if scaling is given  
+    resize_view(_width, _height); 
+
+    log_debug("Starting virtual clock");
+    _virtualClock.resume();
+
 }
 
 bool

=== modified file 'gui/gui.h'
--- a/gui/gui.h 2009-02-25 02:00:44 +0000
+++ b/gui/gui.h 2009-03-28 09:31:01 +0000
@@ -26,6 +26,8 @@
 #include "snappingrange.h"  // for InvalidatedRanges
 #include "GnashKey.h" // for gnash::key::code type
 #include "smart_ptr.h"
+#include "VirtualClock.h"
+#include "SystemClock.h"
 
 #ifdef USE_SWFTREE
 #include "tree.hh" // for tree
@@ -101,6 +103,13 @@
       _interval = interval;
     }
 
+    /// Return the clock provided by this Gui.
+    //
+    /// The Gui clock will be paused when the gui is put
+    /// in pause mode and resumed when gui playback is resumed.
+    ///
+    VirtualClock& getClock() { return _virtualClock; }
+
     /// Set the time in milliseconds after which the programme should exit.
     virtual void setTimeout(unsigned int timeout) = 0;
 
@@ -511,6 +520,9 @@
 
     /// If true, updated regions (invalidated ranges) are visibly outlined.
     bool _showUpdatedRegions;
+
+    SystemClock _systemClock;
+    InterruptableVirtualClock _virtualClock;
     
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS 
        int _xpointer;

=== modified file 'libamf/amf_msg.cpp'
--- a/libamf/amf_msg.cpp        2009-03-19 23:14:43 +0000
+++ b/libamf/amf_msg.cpp        2009-03-29 13:08:23 +0000
@@ -17,9 +17,6 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#include <boost/shared_ptr.hpp>
-#include <string>
-
 #include "log.h"
 #include "GnashException.h"
 #include "buffer.h"
@@ -27,7 +24,11 @@
 #include "amf_msg.h"
 #include "element.h"
 #include "network.h"
-#include <boost/cstdint.hpp> // for boost::?int??_t
+
+#include <boost/shared_ptr.hpp>
+#include <string>
+#include <boost/cstdint.hpp> // For C99 int types
+#include <arpa/inet.h> // for htons
 
 using namespace std;
 using namespace gnash;

=== modified file 'libbase/curl_adapter.cpp'
--- a/libbase/curl_adapter.cpp  2009-02-26 08:04:27 +0000
+++ b/libbase/curl_adapter.cpp  2009-03-29 19:26:31 +0000
@@ -41,7 +41,7 @@
 // Stub for warning about access when no libcurl is defined.
 
 std::auto_ptr<IOChannel>
-NetworkAdapter::makeStream(const std::string& /*url*/, const std::string&,
+NetworkAdapter::makeStream(const std::string& /*url*/, 
         const std::string& /*cachefile*/)
 {
        log_error(_("libcurl is not available, but "
@@ -50,17 +50,20 @@
 }
 
 std::auto_ptr<IOChannel>
-NetworkAdapter::makeStream(const std::string& url, const std::string& postdata,
+NetworkAdapter::makeStream(const std::string& url,
+        const std::string& /*postdata*/,
         const std::string& cachefile)
 {
-    return makeStream(url);
+    return makeStream(url, cachefile);
 }
 
 std::auto_ptr<IOChannel>
-NetworkAdapter::makeStream(const std::string& url, const std::string& postdata,
-        const RequestHeaders& headers, const std::string& cachefile)
+NetworkAdapter::makeStream(const std::string& url,
+           const std::string& /*postdata*/,
+            const RequestHeaders& /*headers*/,
+           const std::string& cachefile)
 {
-    return makeStream(url);
+    return makeStream(url, cachefile);
 }
 
 } // namespace gnash

=== modified file 'libcore/VirtualClock.h'
--- a/libcore/VirtualClock.h    2009-02-25 22:33:03 +0000
+++ b/libcore/VirtualClock.h    2009-03-28 09:54:42 +0000
@@ -63,16 +63,19 @@
 
        /// Construct an InterruptableVirtualClock from a VirtualClock source
        //
-       /// The interruptable virtual clock starts in 'stop' mode
+       /// The interruptable virtual clock starts in 'stop' mode,
+    /// use resume() to start.
        ///
        /// @param src
-       ///     A VirtualClock to use as source, ownership transferred
+       ///     A VirtualClock to use as source, ownership is retained by caller
+    /// which should guarantee to keep the source alive for the whole
+    /// lifetime of this instance.
        ///
-       InterruptableVirtualClock(VirtualClock* src)
+       InterruptableVirtualClock(VirtualClock& src)
                :
                _src(src),
                _elapsed(0),
-               _offset(_src->elapsed()),
+               _offset(_src.elapsed()),
                _paused(true)
        {
        }
@@ -81,14 +84,14 @@
        unsigned long int elapsed() const
        {
                if ( ! _paused ) // query source if not stopped
-                       _elapsed = _src->elapsed()-_offset;
+                       _elapsed = _src.elapsed()-_offset;
                return _elapsed;
        }
 
        void restart()
        {
                _elapsed = 0;
-               _offset = _src->elapsed();
+               _offset = _src.elapsed();
        }
 
        void pause()
@@ -102,14 +105,14 @@
                if ( ! _paused ) return; // nothing to do
                _paused = false;
 
-               unsigned long now = _src->elapsed();
+               unsigned long now = _src.elapsed();
                _offset = ( now - _elapsed );
                assert( now-_offset == _elapsed ); // check if we did the right 
thing
        }
 
 private:
 
-       std::auto_ptr<VirtualClock> _src;
+       VirtualClock& _src;
 
        mutable unsigned long int _elapsed;
 

=== modified file 'libcore/asobj/LoadableObject.cpp'
--- a/libcore/asobj/LoadableObject.cpp  2009-03-17 09:44:00 +0000
+++ b/libcore/asobj/LoadableObject.cpp  2009-03-30 09:49:01 +0000
@@ -190,7 +190,11 @@
 LoadableObject::queueLoad(std::auto_ptr<IOChannel> str)
 {
 
-    bool startTimer = _loadThreads.empty();
+    // We don't need to check before adding a timer, but
+    // this may optimize slightly (it was already in the code).
+    if (_loadThreads.empty()) {
+        getVM().getRoot().addAdvanceCallback(this);
+    }
 
     std::auto_ptr<LoadThread> lt (new LoadThread(str));
 
@@ -199,14 +203,8 @@
     // of onData invocation.
     // Doing so also avoids processing queued load
     // request immediately
-    // 
     _loadThreads.push_front(lt.release());
 
-    if (startTimer)
-    {
-        getVM().getRoot().addAdvanceCallback(this);
-    }
-
     _bytesLoaded = 0;
     _bytesTotal = -1;
 

=== modified file 'libcore/asobj/MovieClipLoader.cpp'
--- a/libcore/asobj/MovieClipLoader.cpp 2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/MovieClipLoader.cpp 2009-03-30 18:09:06 +0000
@@ -46,41 +46,54 @@
 
 namespace gnash {
 
-  /// This class is used to queue a function call action
-  //
-  /// Exact use is to queue onLoadInit, which should be invoked
-  /// after actions of in first frame of a loaded movie are executed.
-  /// Since those actions are queued the only way to execute something
-  /// after them is to queue the function call as well.
-  ///
-  /// The class might be made more general and accessible outside
-  /// of the MovieClipLoader class. For now it only works for
-  /// calling a function with a two argument.
-  ///
-  class DelayedFunctionCall: public ExecutableCode {
-
-  public:
-
-    DelayedFunctionCall(as_object* target, string_table::key name, const 
as_value& arg1, const as_value& arg2)
-      :
-      _target(target),
-      _name(name),
-      _arg1(arg1),
-      _arg2(arg2)
+
+// Forward declarations
+namespace {
+    as_value moviecliploader_loadclip(const fn_call& fn);
+    as_value moviecliploader_unloadclip(const fn_call& fn);
+    as_value moviecliploader_getprogress(const fn_call& fn);
+    as_value moviecliploader_new(const fn_call& fn);
+    void attachMovieClipLoaderInterface(as_object& o);
+    as_object* getMovieClipLoaderInterface();
+}
+
+/// This class is used to queue a function call action
+//
+/// Exact use is to queue onLoadInit, which should be invoked
+/// after actions of in first frame of a loaded movie are executed.
+/// Since those actions are queued the only way to execute something
+/// after them is to queue the function call as well.
+///
+/// The class might be made more general and accessible outside
+/// of the MovieClipLoader class. For now it only works for
+/// calling a function with a two argument.
+///
+class DelayedFunctionCall : public ExecutableCode
+{
+
+public:
+
+    DelayedFunctionCall(as_object* target, string_table::key name,
+            const as_value& arg1, const as_value& arg2)
+        :
+        _target(target),
+        _name(name),
+        _arg1(arg1),
+        _arg2(arg2)
     {}
 
 
     ExecutableCode* clone() const
     {
-      return new DelayedFunctionCall(*this);
+        return new DelayedFunctionCall(*this);
     }
 
     virtual void execute()
     {
-      _target->callMethod(_name, _arg1, _arg2);
+        _target->callMethod(_name, _arg1, _arg2);
     }
 
-  #ifdef GNASH_USE_GC
+#ifdef GNASH_USE_GC
     /// Mark reachable resources (for the GC)
     //
     /// Reachable resources are:
@@ -92,50 +105,15 @@
       _arg1.setReachable();
       _arg2.setReachable();
     }
-  #endif // GNASH_USE_GC
+#endif // GNASH_USE_GC
 
-  private:
+private:
 
     as_object* _target;
     string_table::key _name;
     as_value _arg1, _arg2;
 
-  };
-
-// Forward declarations
-static as_value moviecliploader_loadclip(const fn_call& fn);
-static as_value moviecliploader_unloadclip(const fn_call& fn);
-static as_value moviecliploader_getprogress(const fn_call& fn);
-static as_value moviecliploader_new(const fn_call& fn);
-
-static void
-attachMovieClipLoaderInterface(as_object& o)
-{
-       o.init_member("loadClip", new 
builtin_function(moviecliploader_loadclip));
-       o.init_member("unloadClip",
-            new builtin_function(moviecliploader_unloadclip));
-       o.init_member("getProgress",
-            new builtin_function(moviecliploader_getprogress));
-
-       // NOTE: we want addListener/removeListener/broadcastMessage
-       //       but don't what the _listeners property here...
-       // TODO: add an argument to AsBroadcaster::initialize skip listeners ?
-       AsBroadcaster::initialize(o);
-       o.delProperty(NSV::PROP_uLISTENERS);
-  
-}
-
-static as_object*
-getMovieClipLoaderInterface()
-{
-       static boost::intrusive_ptr<as_object> o;
-       if ( o == NULL )
-       {
-               o = new as_object(getObjectInterface());
-               attachMovieClipLoaderInterface(*o);
-       }
-       return o.get();
-}
+};
 
 class MovieClipLoader: public as_object
 {
@@ -143,20 +121,20 @@
 
        MovieClipLoader();
 
-       ~MovieClipLoader();
+       ~MovieClipLoader() {}
 
        /// MovieClip
-       bool loadClip(const std::string& url, MovieClip& target);
+       bool loadClip(const std::string& url, MovieClip* target);
 
        void unloadClip();
 
+protected:
+
+    void markReachableResources() const {
+        markAsObjectReachable();
+    }
+
 private:
-
-       bool          _started;
-       bool          _completed;
-       std::string     _filespec;
-       int           _progress;
-       bool          _error;
 };
 
 MovieClipLoader::MovieClipLoader()
@@ -169,12 +147,8 @@
        set_member(NSV::PROP_uLISTENERS, ar);
 }
 
-MovieClipLoader::~MovieClipLoader()
-{
-}
-
 bool
-MovieClipLoader::loadClip(const std::string& url_str, MovieClip& target)
+MovieClipLoader::loadClip(const std::string& url_str, MovieClip* target)
 {
     
     movie_root& mr = _vm.getRoot();
@@ -185,10 +159,10 @@
        log_debug(_(" resolved url: %s"), url.str());
 #endif
                         
-       as_value targetVal(&target);
+       as_value targetVal(target);
        log_debug("Target is %s", targetVal);
 
-       bool ret = target.loadMovie(url);
+       bool ret = target->loadMovie(url);
        if ( ! ret ) 
        {
 
@@ -246,10 +220,57 @@
 void
 MovieClipLoader::unloadClip()
 {
-  GNASH_REPORT_FUNCTION;
-}
-
-static as_value
+    GNASH_REPORT_FUNCTION;
+}
+
+/// Extern.
+void
+moviecliploader_class_init(as_object& global)
+{
+       // This is going to be the global Number "class"/"function"
+       static boost::intrusive_ptr<builtin_function> cl = NULL;
+
+       if (cl == NULL)
+       {
+               cl=new builtin_function(&moviecliploader_new,
+                getMovieClipLoaderInterface());
+       }
+       global.init_member("MovieClipLoader", cl.get()); 
+}
+
+
+namespace {
+
+void
+attachMovieClipLoaderInterface(as_object& o)
+{
+       o.init_member("loadClip", new 
builtin_function(moviecliploader_loadclip));
+       o.init_member("unloadClip",
+            new builtin_function(moviecliploader_unloadclip));
+       o.init_member("getProgress",
+            new builtin_function(moviecliploader_getprogress));
+
+       // NOTE: we want addListener/removeListener/broadcastMessage
+       //       but don't what the _listeners property here...
+       // TODO: add an argument to AsBroadcaster::initialize skip listeners ?
+       AsBroadcaster::initialize(o);
+       o.delProperty(NSV::PROP_uLISTENERS);
+  
+}
+
+as_object*
+getMovieClipLoaderInterface()
+{
+       static boost::intrusive_ptr<as_object> o;
+       if ( o == NULL )
+       {
+               o = new as_object(getObjectInterface());
+               attachMovieClipLoaderInterface(*o);
+       }
+       return o.get();
+}
+
+as_value
 moviecliploader_loadclip(const fn_call& fn)
 {
 
@@ -296,14 +317,14 @@
                str_url, (void*)sprite);
 #endif
 
-       ptr->loadClip(str_url, *sprite);
+       ptr->loadClip(str_url, sprite);
 
        // We always want to return true unless something went wrong
        return as_value(true);
 
 }
 
-static as_value
+as_value
 moviecliploader_unloadclip(const fn_call& fn)
 {
   const std::string filespec = fn.arg(0).to_string();
@@ -311,7 +332,7 @@
   return as_value();
 }
 
-static as_value
+as_value
 moviecliploader_new(const fn_call& /* fn */)
 {
 
@@ -322,7 +343,7 @@
 
 // Invoked every time the loading content is written to disk during
 // the loading process.
-static as_value
+as_value
 moviecliploader_getprogress(const fn_call& fn)
 {
 
@@ -373,18 +394,5 @@
        return as_value(mcl_obj.get()); // will keep alive
 }
 
-void
-moviecliploader_class_init(as_object& global)
-{
-       // This is going to be the global Number "class"/"function"
-       static boost::intrusive_ptr<builtin_function> cl=NULL;
-
-       if ( cl == NULL )
-       {
-               cl=new builtin_function(&moviecliploader_new,
-                getMovieClipLoaderInterface());
-       }
-       global.init_member("MovieClipLoader", cl.get()); 
-}
-
+} // anonymous namespace
 } // end of gnash namespace

=== modified file 'libcore/asobj/NetStream_as.cpp'
--- a/libcore/asobj/NetStream_as.cpp    2009-03-19 19:16:28 +0000
+++ b/libcore/asobj/NetStream_as.cpp    2009-03-28 09:54:42 +0000
@@ -38,7 +38,6 @@
 #include "movie_root.h"
 #include "GnashAlgorithm.h"
 #include "VirtualClock.h" // for PlayHead
-#include "SystemClock.h"
 
 #include "MediaHandler.h"
 #include "StreamProvider.h"
@@ -106,9 +105,8 @@
     _audioDecoder(0),
     _audioInfoKnown(false),
 
-    // TODO: if audio is available, use _audioClock instead of SystemClock
-    // as additional source
-    _playbackClock(new InterruptableVirtualClock(new SystemClock)),
+    // TODO: figure out if we should take another path to get to the clock
+    _playbackClock(new InterruptableVirtualClock(getVM().getClock())),
     _playHead(_playbackClock.get()), 
     _soundHandler(_vm.getRoot().runInfo().soundHandler()),
     _mediaHandler(media::MediaHandler::get()),
@@ -1060,7 +1058,8 @@
         // this one we might avoid :) -- a less intrusive logging could
         // be take note about how many things we're pushing over
         log_debug("pushDecodedAudioFrames(%d) pushing %dth frame with "
-                "timestamp %d", ts, _audioQueue.size()+1, nextTimestamp); 
+                "timestamp %d", ts, _audioStreamer._audioQueue.size()+1,
+                nextTimestamp); 
 #endif
 
         _audioStreamer.push(audio);

=== modified file 'libcore/asobj/TextSnapshot_as.cpp'
--- a/libcore/asobj/TextSnapshot_as.cpp 2009-03-17 12:01:42 +0000
+++ b/libcore/asobj/TextSnapshot_as.cpp 2009-03-30 23:47:37 +0000
@@ -439,7 +439,7 @@
         return as_value();
     }
 
-    size_t start = std::max(0, fn.arg(0).to_int());
+    size_t start = std::max(0, static_cast<int>(fn.arg(0).to_int()));
     size_t end = std::max<int>(start + 1, fn.arg(1).to_int());
 
     Array_as* ri = new Array_as;
@@ -505,7 +505,7 @@
         return as_value();
     }
 
-    size_t start = std::max(0, fn.arg(0).to_int());
+    size_t start = std::max(0, static_cast<int>(fn.arg(0).to_int()));
     size_t end = std::max<int>(start + 1, fn.arg(1).to_int());
 
     return as_value(ts->getSelected(start, end));
@@ -592,7 +592,7 @@
         return as_value();
     }
 
-    size_t start = std::max(0, fn.arg(0).to_int());
+    size_t start = std::max(0, static_cast<int>(fn.arg(0).to_int()));
     size_t end = std::max<int>(start, fn.arg(1).to_int());
 
     bool selected = (fn.nargs > 2) ? fn.arg(2).to_bool() : true;

=== modified file 'libcore/fill_style.cpp'
--- a/libcore/fill_style.cpp    2009-03-24 10:56:52 +0000
+++ b/libcore/fill_style.cpp    2009-03-31 09:45:01 +0000
@@ -75,7 +75,7 @@
     }
         
     IF_VERBOSE_PARSE(
-        log_parse("  fill_style read type = 0x%X", m_type);
+        log_parse("  fill_style read type = 0x%X", (int)m_type);
     );
 
     if (m_type == SWF::FILL_SOLID)
@@ -530,36 +530,54 @@
     m_type = a.get_type();
     assert(m_type == b.get_type());
 
-    // fill style color
+    // fill style color (TODO: only for solid fills ?)
     m_color.set_lerp(a.get_color(), b.get_color(), t);
 
-    // fill style gradient SWFMatrix
-    //
-    // @@ TODO morphed gradients don't come out exactly
-    // right; they shift around some.  Not sure where the
-    // problem is.
-    _matrix.set_lerp(a._matrix, b._matrix, t);
+    bool usesMatrix = false;
 
-    // fill style gradients
-    assert(m_gradients.size() == a.m_gradients.size());
-    assert(m_gradients.size() == b.m_gradients.size());
-    for (size_t j=0, nj=m_gradients.size(); j<nj; ++j)
+    switch (m_type)
     {
-        m_gradients[j].m_ratio =
-            (boost::uint8_t) frnd( flerp(a.m_gradients[j].m_ratio,
-                    b.m_gradients[j].m_ratio, t)
-                );
-        m_gradients[j].m_color.set_lerp(a.m_gradients[j].m_color,
-                b.m_gradients[j].m_color, t);
+        case SWF::FILL_LINEAR_GRADIENT:
+        case SWF::FILL_RADIAL_GRADIENT:
+        case SWF::FILL_FOCAL_GRADIENT:
+        {
+            usesMatrix = true;
+
+            // fill style gradients
+            assert(m_gradients.size() == a.m_gradients.size());
+            assert(m_gradients.size() == b.m_gradients.size());
+            for (size_t j=0, nj=m_gradients.size(); j<nj; ++j)
+            {
+                m_gradients[j].m_ratio =
+                    (boost::uint8_t) frnd( flerp(a.m_gradients[j].m_ratio,
+                            b.m_gradients[j].m_ratio, t)
+                        );
+                m_gradients[j].m_color.set_lerp(a.m_gradients[j].m_color,
+                        b.m_gradients[j].m_color, t);
+            }
+            _bitmapInfo = NULL;
+            break;
+        }
+
+        case SWF::FILL_TILED_BITMAP:
+        case SWF::FILL_CLIPPED_BITMAP:
+        case SWF::FILL_TILED_BITMAP_HARD:
+        case SWF::FILL_CLIPPED_BITMAP_HARD:
+        {
+            usesMatrix = true;
+
+            // fill style bitmap ID
+            _bitmapInfo = a._bitmapInfo;
+            assert(_bitmapInfo == b._bitmapInfo);
+            break;
+        }
+
+        default:
+            break;
     }
-    _bitmapInfo = NULL;
-
-    // fill style bitmap ID
-    _bitmapInfo = a._bitmapInfo;
-    assert(_bitmapInfo == b._bitmapInfo);
-
-    // fill style bitmap SWFMatrix
-    _matrix.set_lerp(a._matrix, b._matrix, t);
+
+    // fill style bitmap or gradient SWFMatrix
+    if ( usesMatrix ) _matrix.set_lerp(a._matrix, b._matrix, t);
 }
 
 

=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- a/libcore/parser/SWFMovieDefinition.cpp     2009-03-24 10:56:52 +0000
+++ b/libcore/parser/SWFMovieDefinition.cpp     2009-03-31 09:45:01 +0000
@@ -558,9 +558,12 @@
             return;
         }
 
+        bool tagOpened=false;
+
         try {
 
             SWF::TagType tag = str.open_tag();
+            tagOpened=true;
 
 parse_tag:
 
@@ -591,7 +594,9 @@
                 if (floaded == m_frame_count)
                 {
                     str.close_tag();
+                    tagOpened=false;
                     tag = str.open_tag();
+                    tagOpened=true;
                     if (tag != SWF::END )
                     {
                         IF_VERBOSE_MALFORMED_SWF(
@@ -626,7 +631,7 @@
             log_error(_("Parsing exception: %s"), e.what());
         }
 
-        str.close_tag();
+        if ( tagOpened ) str.close_tag();
 
         setBytesLoaded(str.tell());
     }

=== modified file 'libcore/swf.h'
--- a/libcore/swf.h     2009-03-24 10:56:52 +0000
+++ b/libcore/swf.h     2009-03-31 09:45:01 +0000
@@ -122,7 +122,10 @@
     /// See http://sswf.sourceforge.net/SWFalexref.html#tag_scriptlimits
     SCRIPTLIMITS          = 65, 
 
-    SETTABINDEX           = 66, // SWF 9
+    /// SWF_version  >= 7 
+    /// See http://www.m2osw.com/en/swf_alexref.html#tag_settabindex
+    SETTABINDEX           = 66, 
+
     DEFINESHAPE4_         = 67, // SWF 9
     DEFINEMORPHSHAPE2_    = 68, // SWF 9
 

=== modified file 'libcore/vm/VM.h'
--- a/libcore/vm/VM.h   2009-02-20 12:24:00 +0000
+++ b/libcore/vm/VM.h   2009-03-31 09:45:01 +0000
@@ -100,6 +100,17 @@
                return _callStack;
        }
 
+    /// Get the VM clock
+    //
+    /// NOTE: this clock should drive all internal operations
+    /// but maybe accessing it trough VM isn't the best idea.
+    /// TODO: consider making this accessible trough RunInfo
+    /// instead.
+    ///
+    VirtualClock& getClock() {
+        return _clock;
+    }
+
        /// \brief
        /// Initialize the virtual machine singleton with the given
        /// movie definition and return a reference to it.

=== modified file 'libnet/network.cpp'
--- a/libnet/network.cpp        2009-03-05 19:35:09 +0000
+++ b/libnet/network.cpp        2009-03-30 23:24:05 +0000
@@ -201,7 +201,7 @@
 
     retries = 0;
 
-    nodeaddr = inet_lnaof(*thisaddr);
+//     nodeaddr = inet_lnaof(*thisaddr);
     while (retries < 5) {
         if (bind(_listenfd, reinterpret_cast<struct sockaddr *>(&sock_in),
                  sizeof(sock_in)) == -1) {

=== modified file 'macros/gnashpkgtool.m4'
--- a/macros/gnashpkgtool.m4    2009-02-25 22:33:03 +0000
+++ b/macros/gnashpkgtool.m4    2009-03-30 23:21:33 +0000
@@ -33,13 +33,6 @@
   pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl Lowercase
   pushdef([UPHEADER], translit([$2], [a-z./], [A-Z__]))dnl Uppercase header
 
-dnl   AC_ARG_ENABLE($1, AC_HELP_STRING([--enable-$1], [Enable support for 
$3.]), [
-dnl     case "${enableval}" in
-dnl       yes) $1=yes ;;       
-dnl       no)  $1=no ;;
-dnl       *)   AC_MSG_ERROR([bad value ${enableval} for enable-$1 option]) ;;
-dnl     esac], $1=yes)
-
     $1=yes
     if test x$4 = x; then
       name=$1 
@@ -153,20 +146,6 @@
 
 has_$1=no
 
-AC_ARG_ENABLE($1, AC_HELP_STRING([--enable-$1], [Enable support for $3.]),
-[case "${enableval}" in
-       yes) $1=yes ;;  
-       no)  $1=no ;;
-       *)   
-       AC_MSG_ERROR([bad value ${enableval} for enable-$1 option]) ;;
-esac], $1=yes)
-
-if test x$4 = x; then
-       name=$1 
-else
-       name=$1-$4
-fi
-
 if test x"${$1}" = x"yes"; then
        dnl Look for the library
        AC_ARG_WITH($1_lib, AC_HELP_STRING([--with-$1-lib], [directory where $1 
library is]), with_$1_lib=${withval})

=== modified file 'macros/pthreads.m4'
--- a/macros/pthreads.m4        2009-02-25 22:33:03 +0000
+++ b/macros/pthreads.m4        2009-03-30 23:35:25 +0000
@@ -57,7 +57,14 @@
 dnl which indicates that we try without any flags at all, and "pthread-config"
 dnl which is a program returning the flags for the Pth emulation library.
 
-pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads 
-mthreads pthread --thread-safe -mt pthread-config pth-config"
+pthread_flags="pthreads none lthread -pthread -pthreads -mthreads pthread 
--thread-safe -mt pthread-config pth-config"
+
+dnl When cross configuring, we're always using GCC, and we always have a 
platform
+dnl with pthreads in that case, but it's often sonewhere non-standard, so
+dnl unless this is a problem, assume we don't need any special flags.
+if test x$cross_compiling = xyes; then
+    pthread_flags="none"
+fi
 
 dnl The ordering *is* (sometimes) important.  Some notes on the
 dnl individual items follow:

=== modified file 'testsuite/as3/Makefile.am'
--- a/testsuite/as3/Makefile.am 2009-03-24 10:19:39 +0000
+++ b/testsuite/as3/Makefile.am 2009-03-31 09:02:23 +0000
@@ -19,10 +19,15 @@
 AUTOMAKE_OPTIONS = dejagnu
 
 # These will get executed and parsed for test output
-AS3TESTS = \
+SANE_AS3TESTS = \
+       $(NULL)
+
+BOGUS_AS3TESTS = \
        basic.as \
        $(NULL)
 
+AS3TESTS=$(SANE_AS3TESTS) $(BOGUS_AS3TESTS)
+
 EXTRA_DIST = $(AS3TESTS) dejagnu.as
 
 abs_mediadir = `cd $(srcdir)/../media; pwd`
@@ -31,15 +36,22 @@
 AS3COMPILE_FLAGS = 
 AS3COMPILE_CPP = $(CPP) -x c -P -I$(srcdir) -DMEDIADIR="$(abs_mediadir)"
 
-AS3TESTS_OUT = $(AS3TESTS:.as=.swf)
+SANE_AS3TESTS_OUT = $(SANE_AS3TESTS:.as=.swf)
+BOGUS_AS3TESTS_OUT = $(BOGUS_AS3TESTS:.as=.swf)
+AS3TESTS_OUT = $(SANE_AS3TESTS_OUT) $(BOGUS_AS3TESTS_OUT)
 
 TEST_DRIVERS = ../simple.exp
 TEST_CASES = \
        sanetests-runner \
+       bogustests-runner \
        $(check_PROGRAMS)
 
-sanetests-runner: $(srcdir)/../generic-testrunner.sh $(AS3TESTS_OUT) Makefile
-       sh $< -f 50 -r 50 $(top_builddir) $(AS3TESTS_OUT) > $@
+sanetests-runner: $(srcdir)/../generic-testrunner.sh $(SANE_AS3TESTS_OUT) 
Makefile
+       sh $< -c "__END_OF_TEST__" -r 50 $(top_builddir) $(SANE_AS3TESTS_OUT) > 
$@
+       chmod 755 $@
+
+bogustests-runner: $(srcdir)/../generic-testrunner.sh $(BOGUS_AS3TESTS_OUT) 
Makefile
+       sh $< -C __END_OF_TEST__ -r 50 $(top_builddir) $(BOGUS_AS3TESTS_OUT) > 
$@
        chmod 755 $@
 
 $(AS3TESTS_OUT): dejagnu.as check.as

=== modified file 'testsuite/as3/basic.as'
--- a/testsuite/as3/basic.as    2009-03-24 10:19:39 +0000
+++ b/testsuite/as3/basic.as    2009-03-31 09:02:23 +0000
@@ -45,6 +45,9 @@
             i -= 14;
             check_equals(i, -12.5);
 
+            totals(5);
+
+            done();
         }
     }
 }


reply via email to

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