gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...


From: Tomas Groth
Subject: [Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...
Date: Sat, 24 Mar 2007 14:36:47 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Tomas Groth <tgc>       07/03/24 14:36:47

Modified files:
        .              : ChangeLog 
        libbase        : LoadThread.cpp LoadThread.h 
        server         : StreamProvider.cpp 
        server/asobj   : NetConnection.cpp 

Log message:
                * libbase/LoadThread.{cpp,h}: Changed so that it is possible to
                  check if the stream is valid.
                * server/StreamProvider.cpp: Check if local file exists before
                  creating the tu_file.
                * server/asobj/NetConnection.cpp: Changed to work with the
                  LoadThread changes. Added an assert for a valid URL.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2682&r2=1.2683
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/StreamProvider.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.cpp?cvsroot=gnash&r1=1.32&r2=1.33

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2682
retrieving revision 1.2683
diff -u -b -r1.2682 -r1.2683
--- ChangeLog   24 Mar 2007 14:34:08 -0000      1.2682
+++ ChangeLog   24 Mar 2007 14:36:47 -0000      1.2683
@@ -1,3 +1,12 @@
+2007-03-24 Tomas Groth Christensen <address@hidden>
+
+       * libbase/LoadThread.{cpp,h}: Changed so that it is possible to
+         check if the stream is valid.
+       * server/StreamProvider.cpp: Check if local file exists before
+         creating the tu_file.
+       * server/asobj/NetConnection.cpp: Changed to work with the
+         LoadThread changes. Added an assert for a valid URL.
+
 2007-03-24 Sandro Santilli <address@hidden>
 
        * server/swf/tag_loaders.cpp (readPlaceActions): gracely handle

Index: libbase/LoadThread.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libbase/LoadThread.cpp      23 Mar 2007 00:30:10 -0000      1.2
+++ libbase/LoadThread.cpp      24 Mar 2007 14:36:47 -0000      1.3
@@ -16,31 +16,39 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: LoadThread.cpp,v 1.2 2007/03/23 00:30:10 tgc Exp $
+// $Id: LoadThread.cpp,v 1.3 2007/03/24 14:36:47 tgc Exp $
 
 #include "LoadThread.h"
 
-LoadThread::LoadThread(std::auto_ptr<tu_file> stream)
+LoadThread::LoadThread()
        :
-       _stream(stream),
        _bytesLoaded(0),
        _completed(false),
        _loadPosition(0),
        _userPosition(0),
        _actualPosition(0)
 {
-
-       // Start the downloading.
-       _thread.reset( new 
boost::thread(boost::bind(LoadThread::downloadThread, this)) );
 }
 
-
 LoadThread::~LoadThread()
 {
        // stop the download thread if it's still runnning
        completed();
 }
 
+bool LoadThread::setStream(std::auto_ptr<tu_file> stream)
+{
+       _stream = stream;
+       if (_stream.get() != NULL) {
+               // Start the downloading.
+               _thread.reset( new 
boost::thread(boost::bind(LoadThread::downloadThread, this)) );
+
+               return true;
+       } else {
+               return false;
+       }
+}
+
 bool LoadThread::seek(size_t pos)
 {
        // Try to seek to the wanted position, and return
@@ -150,5 +158,5 @@
 bool LoadThread::isPositionConfirmed(size_t pos)
 {
        boost::mutex::scoped_lock lock(_mutex);
-       return (static_cast<uint32_t>(pos) <= _loadPosition);
+       return (static_cast<int32_t>(pos) <= _loadPosition);
 }

Index: libbase/LoadThread.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libbase/LoadThread.h        23 Mar 2007 00:30:10 -0000      1.3
+++ libbase/LoadThread.h        24 Mar 2007 14:36:47 -0000      1.4
@@ -19,7 +19,7 @@
 #ifndef __LOADTHREAD_H__
 #define __LOADTHREAD_H__
 
-// $Id: LoadThread.h,v 1.3 2007/03/23 00:30:10 tgc Exp $
+// $Id: LoadThread.h,v 1.4 2007/03/24 14:36:47 tgc Exp $
 #include <boost/thread/thread.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/bind.hpp>
@@ -51,13 +51,16 @@
 {
 
 public:
-       /// Creating the object starts the threaded loading 
-       /// of the stream/file passed as an argument.
-       LoadThread(std::auto_ptr<tu_file> stream);
+       /// Just sets up the object
+       LoadThread();
 
        /// Stops the download if still running
        ~LoadThread();
 
+       /// Sets the stream used for the connection, and starts the download
+       /// is the stream is valid. Returns true is the stream is valid, and 
else false.
+       bool setStream(std::auto_ptr<tu_file> stream);
+
        /// Put read pointer at given position
        /// Will block if there is not enough data buffered,
        /// and wait until enough data is present.

Index: server/StreamProvider.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/StreamProvider.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/StreamProvider.cpp   23 Feb 2007 11:26:54 -0000      1.14
+++ server/StreamProvider.cpp   24 Mar 2007 14:36:47 -0000      1.15
@@ -75,7 +75,11 @@
                }
                else
                {
-                       return new tu_file(path.c_str(), "rb");
+                       FILE *newin = fopen(path.c_str(), "rb");
+                       if (!newin)  { 
+                               return NULL;
+                       }
+                       return new tu_file(newin, false);
                }
        }
        else
@@ -111,7 +115,11 @@
                }
                else
                {
-                       return new tu_file(path.c_str(), "rb");
+                       FILE *newin = fopen(path.c_str(), "rb");
+                       if (!newin)  { 
+                               return NULL;
+                       }
+                       return new tu_file(newin, false);
                }
        }
        else

Index: server/asobj/NetConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/asobj/NetConnection.cpp      23 Mar 2007 00:30:10 -0000      1.32
+++ server/asobj/NetConnection.cpp      24 Mar 2007 14:36:47 -0000      1.33
@@ -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.cpp,v 1.32 2007/03/23 00:30:10 tgc Exp $ */
+/* $Id: NetConnection.cpp,v 1.33 2007/03/24 14:36:47 tgc Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -87,7 +87,8 @@
 
        URL uri(_url, get_base_url());
 
-       _url = uri.str().c_str();
+       _url = uri.str();
+       assert(_url.find("://")!=string::npos);
 
        // Check if we're allowed to open url
        if (!URLAccessManager::allow(uri)) {
@@ -95,7 +96,15 @@
                return false;
        }
 
-       _loader = new 
LoadThread(std::auto_ptr<tu_file>(StreamProvider::getDefaultInstance().getStream(uri)));
+       _loader = new LoadThread();
+       
+       if 
(!_loader->setStream(std::auto_ptr<tu_file>(StreamProvider::getDefaultInstance().getStream(uri))))
 {
+               log_warning("Gnash could not open this url:%s", _url.c_str());
+               delete _loader;
+               return false;
+       }
+
+       log_msg("Connection etablished to movie: %s\n", _url.c_str());
 
        return true;
 }




reply via email to

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