gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/NetConnection.cpp ...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/NetConnection.cpp ...
Date: Fri, 04 May 2007 20:42:42 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/04 20:42:42

Modified files:
        .              : ChangeLog 
        server/asobj   : NetConnection.cpp NetConnection.h 
                         NetStreamFfmpeg.cpp NetStreamGst.cpp 

Log message:
                * server/asobj/NetConnection.{cpp,h}: keep _loader by auto_ptr, 
some
                  comments and interfaces cleanup.
                * server/asobj/: NetStreamFfmpeg.cpp, NetStreamGst.cpp: update 
calls
                  to connectParser(), now taking by ref.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3094&r2=1.3095
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.cpp?cvsroot=gnash&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamGst.cpp?cvsroot=gnash&r1=1.27&r2=1.28

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3094
retrieving revision 1.3095
diff -u -b -r1.3094 -r1.3095
--- ChangeLog   4 May 2007 20:28:35 -0000       1.3094
+++ ChangeLog   4 May 2007 20:42:42 -0000       1.3095
@@ -1,5 +1,12 @@
 2007-05-03 Sandro Santilli <address@hidden>
 
+       * server/asobj/NetConnection.{cpp,h}: keep _loader by auto_ptr, some
+         comments and interfaces cleanup.
+       * server/asobj/: NetStreamFfmpeg.cpp, NetStreamGst.cpp: update calls
+         to connectParser(), now taking by ref.
+
+2007-05-03 Sandro Santilli <address@hidden>
+
        * server/asobj/NetConnection.{cpp,h}: Yay, another ActionScript class
          layout version. As a side effect stubbed missing properties and
          methods of the class + cleanups in the connect() method.

Index: server/asobj/NetConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- server/asobj/NetConnection.cpp      4 May 2007 20:28:35 -0000       1.40
+++ server/asobj/NetConnection.cpp      4 May 2007 20:42:42 -0000       1.41
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: NetConnection.cpp,v 1.40 2007/05/04 20:28:35 strk Exp $ */
+/* $Id: NetConnection.cpp,v 1.41 2007/05/04 20:42:42 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -54,16 +54,13 @@
        as_object(getNetConnectionInterface()),
        _url(),
        _owner(NULL),
-       _loader(NULL)
+       _loader()
 {
        attachProperties();
 }
 
-NetConnection::~NetConnection() {
-       if (_loader) {
-               delete _loader;
-               _loader = NULL;
-       }
+NetConnection::~NetConnection()
+{
 }
 
 /// Open a connection to stream FLV files.
@@ -79,7 +76,11 @@
 {
 
        // if already running there is no need to setup things again
-       if (_loader) return true;
+       if (_loader.get())
+       {
+               log_error("NetConnection::openConnection() called when already 
connected to a stream. Should we close the old stream and open a new one?.");
+               return true;
+       }
 
        _owner = owner;
        if (_url.size() > 0) {
@@ -98,12 +99,11 @@
                return false;
        }
 
-       _loader = new LoadThread();
+       _loader.reset( new LoadThread() );
        
        if 
(!_loader->setStream(std::auto_ptr<tu_file>(StreamProvider::getDefaultInstance().getStream(uri))))
 {
                log_error(_("Gnash could not open this url: %s"), _url.c_str());
-               delete _loader;
-               _loader = NULL;
+               _loader.reset();
                return false;
        }
 
@@ -117,7 +117,7 @@
 NetConnection::addToURL(const std::string& url)
 {
        // What is this ? It is NOT documented in the header !!
-       if (url == "null" || url == "NULL") return;
+       //if (url == "null" || url == "NULL") return;
 
        _url += url;
 }
@@ -126,7 +126,7 @@
 bool
 NetConnection::eof()
 {
-       if (!_loader) return true;
+       if (!_loader.get()) return true; // @@ correct ?
        return _loader->eof();
 }
 
@@ -134,7 +134,7 @@
 size_t
 NetConnection::read(void *dst, size_t bytes)
 {
-       if (!_loader) return 0;
+       if (!_loader.get()) return 0; // @@ correct ?
        return _loader->read(dst, bytes);
 }
 
@@ -142,25 +142,23 @@
 bool
 NetConnection::seek(size_t pos)
 {
-       if (!_loader) return false;
+       if (!_loader.get()) return false; // @@ correct ?
        return _loader->seek(pos);
-
 }
 
 /*public*/
 size_t
 NetConnection::tell()
 {
-       if (!_loader) return 0;
+       if (!_loader.get()) return 0; // @@ correct ?
        return _loader->tell();
-
 }
 
 /*public*/
 long
 NetConnection::getBytesLoaded()
 {
-       if (!_loader) return 0;
+       if (!_loader.get()) return 0; // @@ correct ?
        return _loader->getBytesLoaded();
 }
 
@@ -169,7 +167,7 @@
 long
 NetConnection::getBytesTotal()
 {
-       if (!_loader) return 0;
+       if (!_loader.get()) return 0; // @@ correct ?
        return _loader->getBytesTotal();
 }
 
@@ -177,16 +175,16 @@
 bool
 NetConnection::loadCompleted()
 {
-       if (!_loader) return false;
+       if ( !_loader.get() ) return false; // @@ correct ?
        return _loader->completed();
 }
 
 bool
-NetConnection::connectParser(FLVParser* parser)
+NetConnection::connectParser(FLVParser& parser)
 {
-       if (_loader == NULL) return false;
+       if (!_loader.get()) return false;
 
-       parser->setLoadThread(_loader);
+       parser.setLoadThread(_loader.get());
        return true;
 }
 

Index: server/asobj/NetConnection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/asobj/NetConnection.h        4 May 2007 20:28:35 -0000       1.26
+++ server/asobj/NetConnection.h        4 May 2007 20:42:42 -0000       1.27
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: NetConnection.h,v 1.26 2007/05/04 20:28:35 strk Exp $ */
+/* $Id: NetConnection.h,v 1.27 2007/05/04 20:42:42 strk Exp $ */
 
 #ifndef __NETCONNECTION_H__
 #define __NETCONNECTION_H__
@@ -78,7 +78,7 @@
        long getBytesTotal();
 
        /// Connects FLV parser with the LoadThread
-       bool connectParser(FLVParser* parser);
+       bool connectParser(FLVParser& parser);
 
        /// Returns whether the load is complete
        bool loadCompleted();
@@ -98,7 +98,7 @@
        boost::intrusive_ptr<as_object> _owner;
 
        /// The file/stream loader thread and interface
-       LoadThread* _loader;
+       std::auto_ptr<LoadThread> _loader;
 
        /// Attach ActionScript instance properties
        void attachProperties();

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- server/asobj/NetStreamFfmpeg.cpp    4 May 2007 15:21:00 -0000       1.42
+++ server/asobj/NetStreamFfmpeg.cpp    4 May 2007 20:42:42 -0000       1.43
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: NetStreamFfmpeg.cpp,v 1.42 2007/05/04 15:21:00 strk Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.43 2007/05/04 20:42:42 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -382,8 +382,8 @@
        nc->seek(0);
        if (std::string(head) == "FLV") {
                ns->m_isFLV = true;
-               ns->m_parser = new FLVParser();
-               if (!nc->connectParser(ns->m_parser)) {
+               ns->m_parser = new FLVParser(); // TODO: define ownership, use 
auto_ptr !
+               if (!nc->connectParser(*(ns->m_parser))) {
                        ns->setStatus(streamNotFound);
                        log_error(_("Gnash could not open FLV movie: %s"), 
ns->url.c_str());
                        delete ns->m_parser;

Index: server/asobj/NetStreamGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamGst.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/asobj/NetStreamGst.cpp       4 May 2007 15:21:00 -0000       1.27
+++ server/asobj/NetStreamGst.cpp       4 May 2007 20:42:42 -0000       1.28
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: NetStreamGst.cpp,v 1.27 2007/05/04 15:21:00 strk Exp $ */
+/* $Id: NetStreamGst.cpp,v 1.28 2007/05/04 20:42:42 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -342,8 +342,8 @@
        nc->seek(0);
        if (head[0] == 'F'|| head[1] == 'L' || head[2] == 'V') { 
                ns->m_isFLV = true;
-               ns->m_parser = new FLVParser();
-               if (!nc->connectParser(ns->m_parser)) {
+               ns->m_parser = new FLVParser(); // TODO: define ownership, use 
auto_ptr !
+               if (!nc->connectParser(*(ns->m_parser))) {
                        ns->setStatus(streamNotFound);
                        log_debug(_("Gnash could not open movie: %s"), 
ns->url.c_str());
                        return;




reply via email to

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