gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10746: Move the clock source from P


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10746: 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
Date: Sat, 28 Mar 2009 10:31:01 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10746
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
=== 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/gui.cpp'
--- a/gui/gui.cpp       2009-03-26 08:11:38 +0000
+++ b/gui/gui.cpp       2009-03-28 09:31:01 +0000
@@ -103,6 +103,7 @@
     ,_stopped(false)
     ,_started(false)
     ,_showUpdatedRegions(false)
+    ,_virtualClock(&_systemClock)
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS 
     ,_xpointer(0)
     ,_ypointer(0)
@@ -145,6 +146,7 @@
     ,_stopped(false)
     ,_started(false)
     ,_showUpdatedRegions(false)
+    ,_virtualClock(&_systemClock)
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS 
     ,_xpointer(0)
     ,_ypointer(0)
@@ -820,6 +822,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 +846,9 @@
     sound::sound_handler* s = _stage->runInfo().soundHandler();
     if ( s ) s->pause();
 
+    log_debug("Pausing virtual clock");
+    _virtualClock.pause();
+
     stopHook();
 }
 
@@ -853,12 +861,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();
     }
 }
@@ -889,6 +904,10 @@
     
     // 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 '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:31:01 +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/vm/VM.h'
--- a/libcore/vm/VM.h   2009-02-10 16:01:43 +0000
+++ b/libcore/vm/VM.h   2009-03-28 09:31: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.


reply via email to

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