gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10733: Minor clean ups.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10733: Minor clean ups.
Date: Fri, 20 Mar 2009 11:10:54 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10733
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2009-03-20 11:10:54 +0100
message:
  Minor clean ups.
modified:
  libcore/asobj/ClassHierarchy.cpp
  libcore/asobj/NetConnection_as.cpp
  libcore/asobj/NetConnection_as.h
  libcore/asobj/NetStream_as.cpp
  libcore/asobj/NetStream_as.h
    ------------------------------------------------------------
    revno: 10730.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-03-19 20:16:28 +0100
    message:
      Clean up and remove unused members.
    modified:
      libcore/asobj/ClassHierarchy.cpp
      libcore/asobj/NetConnection_as.cpp
      libcore/asobj/NetConnection_as.h
      libcore/asobj/NetStream_as.cpp
      libcore/asobj/NetStream_as.h
=== modified file 'libcore/asobj/ClassHierarchy.cpp'
--- a/libcore/asobj/ClassHierarchy.cpp  2009-03-17 09:44:00 +0000
+++ b/libcore/asobj/ClassHierarchy.cpp  2009-03-19 19:16:28 +0000
@@ -314,8 +314,10 @@
        { loadvars_class_init, NSV::CLASS_LOAD_VARS, NSV::CLASS_OBJECT, 
NS_GLOBAL, 6 },
        { LocalConnection_as::init, NSV::CLASS_LOCAL_CONNECTION, 
NSV::CLASS_OBJECT, NS_GLOBAL, 6 },
        { customactions_class_init, NSV::CLASS_CUSTOM_ACTIONS, 
NSV::CLASS_OBJECT, NSV::NS_ADOBE_UTILS, 6 },
-       { netconnection_class_init, NSV::CLASS_NET_CONNECTION, 
NSV::CLASS_OBJECT, NSV::NS_FLASH_NET, 6 },
-       { netstream_class_init, NSV::CLASS_NET_STREAM, NSV::CLASS_OBJECT, 
NSV::NS_FLASH_NET, 6 },
+       { NetConnection_as::init, NSV::CLASS_NET_CONNECTION, NSV::CLASS_OBJECT,
+        NSV::NS_FLASH_NET, 6 },
+       { NetStream_as::init, NSV::CLASS_NET_STREAM, NSV::CLASS_OBJECT,
+        NSV::NS_FLASH_NET, 6 },
        { contextmenu_class_init, NSV::CLASS_CONTEXT_MENU, NSV::CLASS_OBJECT, 
NSV::NS_FLASH_UI, 7 },
        { moviecliploader_class_init, NSV::CLASS_MOVIE_CLIP_LOADER, 
NSV::CLASS_OBJECT, NS_GLOBAL, 7 },
        { Error_class_init, NSV::CLASS_ERROR, NSV::CLASS_OBJECT, NS_GLOBAL, 5 },

=== modified file 'libcore/asobj/NetConnection_as.cpp'
--- a/libcore/asobj/NetConnection_as.cpp        2009-03-17 09:44:00 +0000
+++ b/libcore/asobj/NetConnection_as.cpp        2009-03-19 19:16:28 +0000
@@ -684,15 +684,14 @@
     _queuedConnections(),
     _currentConnection(0),
     _uri(),
-    _isConnected(false),
-    _advanceTimer(0)
+    _isConnected(false)
 {
     attachProperties(*this);
 }
 
 // extern (used by Global.cpp)
 void
-netconnection_class_init(as_object& global)
+NetConnection_as::init(as_object& global)
 {
     // This is going to be the global NetConnection "class"/"function"
     static boost::intrusive_ptr<builtin_function> cl;
@@ -851,7 +850,8 @@
 
     if ( url.protocol() == "rtmp" )
     {
-        LOG_ONCE( log_unimpl("NetConnection.connect(%s): RTMP not yet 
supported", url) );
+        LOG_ONCE(log_unimpl("NetConnection.connect(%s): RTMP not "
+                    "yet supported", url) );
         notifyStatus(CONNECT_FAILED);
         return;
     }
@@ -859,7 +859,8 @@
     if ( url.protocol() != "http" )
     {
         IF_VERBOSE_ASCODING_ERRORS(
-        log_aserror("NetConnection.connect(%s): invalid connection protocol", 
url);
+        log_aserror("NetConnection.connect(%s): invalid connection "
+            "protocol", url);
         );
         notifyStatus(CONNECT_FAILED);
         return;
@@ -868,7 +869,8 @@
     // This is for HTTP remoting
 
     if (!URLAccessManager::allow(url)) {
-        log_security(_("Gnash is not allowed to NetConnection.connect to %s"), 
url);
+        log_security(_("Gnash is not allowed to NetConnection.connect "
+                    "to %s"), url);
         notifyStatus(CONNECT_FAILED);
         return;
     }
@@ -966,31 +968,15 @@
 void
 NetConnection_as::startAdvanceTimer() 
 {
-
-    if (_advanceTimer)
-    {
-        //log_debug("startAdvanceTimer: already running %d", _advanceTimer);
-        return;
-    }
-
-    _advanceTimer = 1;
     getVM().getRoot().addAdvanceCallback(this);
-
-    log_debug("startAdvanceTimer: registered advance timer %d", _advanceTimer);
+    log_debug("startAdvanceTimer: registered NetConnection timer");
 }
 
 void
 NetConnection_as::stopAdvanceTimer() 
 {
-    if (!_advanceTimer)
-    {
-        log_debug("stopAdvanceTimer: not running");
-        return;
-    }
-
     getVM().getRoot().removeAdvanceCallback(this);
-    log_debug("stopAdvanceTimer: deregistered timer %d", _advanceTimer);
-    _advanceTimer=0;
+    log_debug("stopAdvanceTimer: deregistered NetConnection timer");
 }
 
 void
@@ -999,7 +985,8 @@
     // Advance
 
 #ifdef GNASH_DEBUG_REMOTING
-    log_debug("NetConnection_as::advance: %d calls to advance", 
_queuedConnections.size());
+    log_debug("NetConnection_as::advance: %d calls to advance",
+            _queuedConnections.size());
 #endif
 
     while ( ! _queuedConnections.empty() )

=== modified file 'libcore/asobj/NetConnection_as.h'
--- a/libcore/asobj/NetConnection_as.h  2009-03-14 13:51:05 +0000
+++ b/libcore/asobj/NetConnection_as.h  2009-03-19 19:16:28 +0000
@@ -55,6 +55,8 @@
        NetConnection_as();
        ~NetConnection_as();
 
+    static void init(as_object& global);
+
     /// Process connection stuff
     virtual void advanceState();
 
@@ -126,8 +128,6 @@
     void startAdvanceTimer();
 
     void stopAdvanceTimer();
-
-    int _advanceTimer;
 };
 
 void netconnection_class_init(as_object& global);

=== modified file 'libcore/asobj/NetStream_as.cpp'
--- a/libcore/asobj/NetStream_as.cpp    2009-03-17 09:44:00 +0000
+++ b/libcore/asobj/NetStream_as.cpp    2009-03-19 19:16:28 +0000
@@ -117,9 +117,8 @@
 {
 }
 
-// extern (used by Global.cpp)
 void
-netstream_class_init(as_object& global)
+NetStream_as::init(as_object& global)
 {
 
     // This is going to be the global NetStream "class"/"function"

=== modified file 'libcore/asobj/NetStream_as.h'
--- a/libcore/asobj/NetStream_as.h      2009-03-16 09:34:54 +0000
+++ b/libcore/asobj/NetStream_as.h      2009-03-19 19:16:28 +0000
@@ -172,123 +172,6 @@
 class NetStream_as : public as_object
 {
 
-protected:
-    
-    /// Status codes used for notifications
-    enum StatusCode {
-    
-        // Internal status, not a valid ActionScript value
-        invalidStatus,
-
-        /// NetStream.Buffer.Empty (level: status)
-        bufferEmpty,
-
-        /// NetStream.Buffer.Full (level: status)
-        bufferFull,
-
-        /// NetStream.Buffer.Flush (level: status)
-        bufferFlush,
-
-        /// NetStream.Play.Start (level: status)
-        playStart,
-
-        /// NetStream.Play.Stop  (level: status)
-        playStop,
-
-        /// NetStream.Seek.Notify  (level: status)
-        seekNotify,
-
-        /// NetStream.Play.StreamNotFound (level: error)
-        streamNotFound,
-
-        /// NetStream.Seek.InvalidTime (level: error)
-        invalidTime
-    };
-
-    boost::intrusive_ptr<NetConnection_as> _netCon;
-
-    boost::scoped_ptr<CharacterProxy> _audioController;
-
-    /// Set stream status.
-    //
-    /// Valid statuses are:
-    ///
-    /// Status level:
-    ///  - NetStream.Buffer.Empty
-    ///  - NetStream.Buffer.Full
-    ///  - NetStream.Buffer.Flush
-    ///  - NetStream.Play.Start
-    ///  - NetStream.Play.Stop 
-    ///  - NetStream.Seek.Notify 
-    ///
-    /// Error level:
-    ///  - NetStream.Play.StreamNotFound
-    ///  - NetStream.Seek.InvalidTime
-    ///
-    /// This method locks the statusMutex during operations
-    ///
-    void setStatus(StatusCode code);
-
-    /// \brief
-    /// Call any onStatus event handler passing it
-    /// any queued status change, see _statusQueue
-    //
-    /// Will NOT lock the statusMutex itself, rather it will
-    /// iteratively call the popNextPendingStatusNotification()
-    /// private method, which will take care of locking it.
-    /// This is to make sure onStatus handler won't call methods
-    /// possibly trying to obtain the lock again (::play, ::pause, ...)
-    ///
-    void processStatusNotifications();
-    
-    
-    void processNotify(const std::string& funcname, as_object* metadata_obj);
-
-    // The size of the buffer in milliseconds
-    boost::uint32_t m_bufferTime;
-
-    // Are a new frame ready to be returned?
-    volatile bool m_newFrameReady;
-
-    // Mutex to insure we don't corrupt the image
-    boost::mutex image_mutex;
-
-    // The image/videoframe which is given to the renderer
-    std::auto_ptr<GnashImage> m_imageframe;
-
-    // The video URL
-    std::string url;
-
-    // The input media parser
-    std::auto_ptr<media::MediaParser> m_parser;
-
-    // Are we playing a FLV?
-    // The handler which is invoked on status change
-    boost::intrusive_ptr<as_function> m_statusHandler;
-
-    // The position in the inputfile, only used when not playing a FLV
-    long inputPos;
-
-#ifdef GNASH_USE_GC
-    /// Mark all reachable resources of a NetStream_as, for the GC
-    //
-    /// Reachable resources are:
-    /// - associated NetConnection object (_netCon)
-    /// - character to invalidate on video updates (_invalidatedVideoCharacter)
-    /// - onStatus event handler (m_statusHandler)
-    ///
-    virtual void markReachableResources() const;
-#endif // GNASH_USE_GC
-
-    /// Unplug the advance timer callback
-    void stopAdvanceTimer();
-
-    /// Register the advance timer callback
-    void startAdvanceTimer();
-
-    /// The character to invalidate on video updates
-    character* _invalidatedVideoCharacter;
-
 public:
 
     enum PauseMode {
@@ -301,6 +184,8 @@
 
     ~NetStream_as();
 
+    static void init(as_object& global);
+
     PlayHead::PlaybackStatus playbackState() const {
         return _playHead.getState();
     }
@@ -428,11 +313,128 @@
     //
     /// This is a sound_handler::aux_streamer_ptr type.
     ///
-    /// It might be invoked by a separate thread (neither main, nor decoder 
thread).
+    /// It might be invoked by a separate thread (neither main,
+    /// nor decoder thread).
     ///
     static unsigned int audio_streamer(void *udata, boost::int16_t* samples,
             unsigned int nSamples, bool& eof);
 
+protected:
+    
+    /// Status codes used for notifications
+    enum StatusCode {
+    
+        // Internal status, not a valid ActionScript value
+        invalidStatus,
+
+        /// NetStream.Buffer.Empty (level: status)
+        bufferEmpty,
+
+        /// NetStream.Buffer.Full (level: status)
+        bufferFull,
+
+        /// NetStream.Buffer.Flush (level: status)
+        bufferFlush,
+
+        /// NetStream.Play.Start (level: status)
+        playStart,
+
+        /// NetStream.Play.Stop  (level: status)
+        playStop,
+
+        /// NetStream.Seek.Notify  (level: status)
+        seekNotify,
+
+        /// NetStream.Play.StreamNotFound (level: error)
+        streamNotFound,
+
+        /// NetStream.Seek.InvalidTime (level: error)
+        invalidTime
+    };
+
+    boost::intrusive_ptr<NetConnection_as> _netCon;
+
+    boost::scoped_ptr<CharacterProxy> _audioController;
+
+    /// Set stream status.
+    //
+    /// Valid statuses are:
+    ///
+    /// Status level:
+    ///  - NetStream.Buffer.Empty
+    ///  - NetStream.Buffer.Full
+    ///  - NetStream.Buffer.Flush
+    ///  - NetStream.Play.Start
+    ///  - NetStream.Play.Stop 
+    ///  - NetStream.Seek.Notify 
+    ///
+    /// Error level:
+    ///  - NetStream.Play.StreamNotFound
+    ///  - NetStream.Seek.InvalidTime
+    ///
+    /// This method locks the statusMutex during operations
+    ///
+    void setStatus(StatusCode code);
+
+    /// \brief
+    /// Call any onStatus event handler passing it
+    /// any queued status change, see _statusQueue
+    //
+    /// Will NOT lock the statusMutex itself, rather it will
+    /// iteratively call the popNextPendingStatusNotification()
+    /// private method, which will take care of locking it.
+    /// This is to make sure onStatus handler won't call methods
+    /// possibly trying to obtain the lock again (::play, ::pause, ...)
+    ///
+    void processStatusNotifications();
+    
+    
+    void processNotify(const std::string& funcname, as_object* metadata_obj);
+
+    // The size of the buffer in milliseconds
+    boost::uint32_t m_bufferTime;
+
+    // Are a new frame ready to be returned?
+    volatile bool m_newFrameReady;
+
+    // Mutex to insure we don't corrupt the image
+    boost::mutex image_mutex;
+
+    // The image/videoframe which is given to the renderer
+    std::auto_ptr<GnashImage> m_imageframe;
+
+    // The video URL
+    std::string url;
+
+    // The input media parser
+    std::auto_ptr<media::MediaParser> m_parser;
+
+    // Are we playing a FLV?
+    // The handler which is invoked on status change
+    boost::intrusive_ptr<as_function> m_statusHandler;
+
+    // The position in the inputfile, only used when not playing a FLV
+    long inputPos;
+
+#ifdef GNASH_USE_GC
+    /// Mark all reachable resources of a NetStream_as, for the GC
+    //
+    /// Reachable resources are:
+    /// - associated NetConnection object (_netCon)
+    /// - character to invalidate on video updates (_invalidatedVideoCharacter)
+    /// - onStatus event handler (m_statusHandler)
+    ///
+    virtual void markReachableResources() const;
+#endif // GNASH_USE_GC
+
+    /// Unplug the advance timer callback
+    void stopAdvanceTimer();
+
+    /// Register the advance timer callback
+    void startAdvanceTimer();
+
+    /// The character to invalidate on video updates
+    character* _invalidatedVideoCharacter;
 
 private:
 
@@ -597,12 +599,7 @@
 
 };
 
-
-// Initialize the global NetStream class
-void netstream_class_init(as_object& global);
-
-} // end of gnash namespace
-
-// __NETSTREAM_H__
+} // gnash namespace
+
 #endif
 


reply via email to

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