[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/Global.cpp server/...
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/Global.cpp server/... |
Date: |
Sat, 27 Jan 2007 16:55:05 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 07/01/27 16:55:05
Modified files:
. : ChangeLog
server/asobj : Global.cpp NetConnection.cpp NetConnection.h
NetStreamFfmpeg.cpp NetStreamFfmpeg.h
NetStreamGst.cpp
Log message:
* server/asobj/Global.cpp: NetConnection switched to the new init
method.
* server/asobj/NetConnection.{cpp,h}: Switched to the new init method.
Moved URL checking to NetConnection, and added support for different
ways
to setup the URL.
* server/asobj/NetStreamFfmpeg.{cpp,h}, server/asobj/NetStreamGst.cpp:
Removed the URL checking, and moved it to NetConnection. Added
"support"
for the "mp3:" prefix (untested).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2183&r2=1.2184
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamGst.cpp?cvsroot=gnash&r1=1.6&r2=1.7
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2183
retrieving revision 1.2184
diff -u -b -r1.2183 -r1.2184
--- ChangeLog 26 Jan 2007 19:41:41 -0000 1.2183
+++ ChangeLog 27 Jan 2007 16:55:05 -0000 1.2184
@@ -1,3 +1,13 @@
+2007-01-27 Tomas Groth Christensen <address@hidden>
+
+ * server/asobj/Global.cpp: NetConnection switched to the new init
method.
+ * server/asobj/NetConnection.{cpp,h}: Switched to the new init method.
+ Moved URL checking to NetConnection, and added support for different
ways
+ to setup the URL.
+ * server/asobj/NetStreamFfmpeg.{cpp,h}, server/asobj/NetStreamGst.cpp:
+ Removed the URL checking, and moved it to NetConnection. Added
"support"
+ for the "mp3:" prefix (untested).
+
2007-01-26 Rob Savoye <address@hidden>
* configure.ac: Look for libexpat too to resolve a stupid library
Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- server/asobj/Global.cpp 23 Jan 2007 16:41:27 -0000 1.34
+++ server/asobj/Global.cpp 27 Jan 2007 16:55:05 -0000 1.35
@@ -18,7 +18,7 @@
// Implementation of the Global ActionScript Object
-/* $Id: Global.cpp,v 1.34 2007/01/23 16:41:27 tgc Exp $ */
+/* $Id: Global.cpp,v 1.35 2007/01/27 16:55:05 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -496,7 +496,7 @@
// SWF7
//-----------------------
- init_member("NetConnection", as_value(netconnection_new));
+ netconnection_class_init(*this);
netstream_class_init(*this);
contextmenu_class_init(*this);
moviecliploader_class_init(*this);
Index: server/asobj/NetConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/asobj/NetConnection.cpp 18 Jan 2007 22:53:21 -0000 1.17
+++ server/asobj/NetConnection.cpp 27 Jan 2007 16:55:05 -0000 1.18
@@ -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.17 2007/01/18 22:53:21 strk Exp $ */
+/* $Id: NetConnection.cpp,v 1.18 2007/01/27 16:55:05 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -24,13 +24,15 @@
#include <string>
#include <new>
#include "NetConnection.h"
-#include "fn_call.h"
-#include "rtmp.h"
#include "log.h"
#include "GnashException.h"
+#include "builtin_function.h"
+#include "movie_root.h"
+
+#include "URLAccessManager.h"
+#include "URL.h"
using namespace std;
-using namespace amf;
namespace {
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
@@ -38,6 +40,10 @@
namespace gnash {
+static void netconnection_new(const fn_call& fn);
+static void netconnection_connect(const fn_call& fn);
+static as_object* getNetConnectionInterface();
+
#ifdef HAVE_CURL_CURL_H
/// \class NetConnection
@@ -170,14 +176,31 @@
/// RTMP. Newer Flash movies have a parameter to connect which is a
/// URL string like rtmp://foobar.com/videos/bar.flv
/*public*/
-bool NetConnection::openConnection(const char* char_url, as_object* ns, bool
local)
+bool NetConnection::openConnection(const char* char_url, as_object* ns)
{
netStreamObj = ns;
- _url = std::string(char_url);
+ if (_url.size() > 0) {
+ _url += "/";
+ }
+ _url += char_url;
_running = 1;
_cache = NULL;
- localFile = local;
+ localFile = false;
+
+
+ URL uri(_url);
+
+ // Check if we're allowed to open url
+ if (URLAccessManager::allow(uri)) {
+
+ if (uri.protocol() == "file")
+ {
+ localFile = true;
+ }
+ } else {
+ return false;
+ }
if (localFile) {
_cache = fopen(char_url, "rb");
@@ -274,6 +297,13 @@
}
/*public*/
+void
+NetConnection::addToURL(const char* url)
+{
+ _url += url;
+}
+
+/*public*/
bool
NetConnection::eof()
{
@@ -311,24 +341,35 @@
#endif // HAVE_CURL_CURL_H
+
+
+netconnection_as_object::netconnection_as_object()
+ :
+ as_object(getNetConnectionInterface())
+{
+}
+
+netconnection_as_object::~netconnection_as_object()
+{
+}
+
+
/// \brief callback to instantiate a new NetConnection object.
/// \param fn the parameters from the Flash movie
/// \return nothing from the function call.
/// \note The return value is returned through the fn.result member.
-void
+static void
netconnection_new(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
netconnection_as_object *netconnection_obj = new netconnection_as_object;
- // FIXME: rely on inheritance
- netconnection_obj->init_member("connect", &netconnection_connect);
-
fn.result->set_as_object(netconnection_obj);
}
-void netconnection_connect(const fn_call& fn)
+static void
+netconnection_connect(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -337,13 +378,52 @@
assert(ptr);
if (fn.nargs != 0) {
- filespec = fn.env->bottom(fn.first_arg_bottom_index).to_string();
-// ptr->obj.connect(filespec.c_str());
- } else {
-// ptr->obj.connect(0);
+
ptr->obj.addToURL(fn.env->bottom(fn.first_arg_bottom_index).to_string());
}
}
+void
+attachNetConnectionInterface(as_object& o)
+{
+
+ o.init_member("connect", &netconnection_connect);
+
+}
+
+static as_object*
+getNetConnectionInterface()
+{
+
+ static boost::intrusive_ptr<as_object> o;
+ if ( o == NULL )
+ {
+ o = new as_object();
+ attachNetConnectionInterface(*o);
+ }
+
+ return o.get();
+}
+
+// extern (used by Global.cpp)
+void netconnection_class_init(as_object& global)
+{
+
+ // This is going to be the global NetConnection "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&netconnection_new,
getNetConnectionInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachNetConnectionInterface(*cl);
+
+ }
+
+ // Register _global.String
+ global.init_member("NetConnection", cl.get());
+
+}
} // end of gnash namespace
Index: server/asobj/NetConnection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/asobj/NetConnection.h 23 Jan 2007 16:41:27 -0000 1.13
+++ server/asobj/NetConnection.h 27 Jan 2007 16:55:05 -0000 1.14
@@ -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.13 2007/01/23 16:41:27 tgc Exp $ */
+/* $Id: NetConnection.h,v 1.14 2007/01/27 16:55:05 tgc Exp $ */
#ifndef __NETCONNECTION_H__
#define __NETCONNECTION_H__
@@ -48,7 +48,7 @@
~NetConnection();
/// Opens the connection to char_url
- bool openConnection(const char* char_url, as_object* ns, bool local);
+ bool openConnection(const char* char_url, as_object* ns);
/// Put read pointer at given position
bool seek(size_t pos);
@@ -65,6 +65,9 @@
/// Report global position within the file
size_t tell();
+ // Extend the URL to be used for playing
+ void addToURL(const char* url);
+
private:
// Use this file to cache data
FILE* _cache;
@@ -119,11 +122,12 @@
#else
class NetConnection {
public:
- NetConnection() {};
- ~NetConnection() {};
- bool openConnection(const char* /*char_url*/, as_object* /*ns*/, bool
/* local */) { return false; };
+ NetConnection() {}
+ ~NetConnection() {}
+ bool openConnection(const char* /*char_url*/, as_object* /*ns*/) {
return false; }
bool seek(size_t /*pos*/) { return 0; }
size_t read(void* /*dst*/, size_t /*bytes*/) { return false; }
+ void addToURL(const char* /*url*/) {}
};
#endif // HAVE_CURL_CURL_H
@@ -131,12 +135,12 @@
class netconnection_as_object : public as_object
{
public:
+ netconnection_as_object();
+ ~netconnection_as_object();
NetConnection obj;
};
-DSOEXPORT void netconnection_new(const fn_call& fn);
-DSOEXPORT void netconnection_connect(const fn_call& fn);
-
+void netconnection_class_init(as_object& global);
} // end of gnash namespace
Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/asobj/NetStreamFfmpeg.cpp 23 Jan 2007 21:37:16 -0000 1.9
+++ server/asobj/NetStreamFfmpeg.cpp 27 Jan 2007 16:55:05 -0000 1.10
@@ -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: NetStreamFfmpeg.cpp,v 1.9 2007/01/23 21:37:16 tgc Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.10 2007/01/27 16:55:05 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -26,12 +26,10 @@
#include "NetStreamFfmpeg.h"
#include "fn_call.h"
#include "NetStream.h"
-#include "URLAccessManager.h"
#include "render.h"
#include "movie_root.h"
#include "NetConnection.h"
-#include "URL.h"
#include "tu_file.h"
#if defined(_WIN32) || defined(WIN32)
@@ -205,6 +203,11 @@
}
url += c_url;
+ // Remove any "mp3:" prefix. Maybe should use this to mark as audio-only
+ if (url.compare(0, 4, std::string("mp3:")) == 0) {
+ url = url.substr(4);
+ }
+
m_go = true;
// To avoid blocking while connecting, we use a thread.
@@ -223,21 +226,10 @@
netconnection_as_object* nc =
static_cast<netconnection_as_object*>(ns->netCon);
- URL uri(ns->url);
-
- // Check if we're allowed to open url
- if (URLAccessManager::allow(uri)) {
-
- bool local = false;
- if (uri.protocol() == "file")
- {
- local = true;
- }
-
// Pass stuff from/to the NetConnection object.
- nc->obj.openConnection(ns->url.c_str(), ns->m_netstream_object,
local);
- } else {
- log_warning("Gnash is not allowed to open movie url: %s",
ns->url.c_str());
+ if (!nc->obj.openConnection(ns->url.c_str(), ns->m_netstream_object)) {
+ log_warning("Gnash could not open movie url: %s",
ns->url.c_str());
+ return;
}
ns->inputPos = 0;
Index: server/asobj/NetStreamFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/NetStreamFfmpeg.h 23 Jan 2007 21:37:16 -0000 1.5
+++ server/asobj/NetStreamFfmpeg.h 27 Jan 2007 16:55:05 -0000 1.6
@@ -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: NetStreamFfmpeg.h,v 1.5 2007/01/23 21:37:16 tgc Exp $ */
+/* $Id: NetStreamFfmpeg.h,v 1.6 2007/01/27 16:55:05 tgc Exp $ */
#ifndef __NETSTREAMFFMPEG_H__
#define __NETSTREAMFFMPEG_H__
@@ -224,8 +224,6 @@
double m_video_clock;
-// pthread_t m_thread;
-// pthread_t startThread;
boost::thread *m_thread;
boost::thread *startThread;
boost::mutex decoding_mutex;
Index: server/asobj/NetStreamGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamGst.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/NetStreamGst.cpp 23 Jan 2007 21:37:16 -0000 1.6
+++ server/asobj/NetStreamGst.cpp 27 Jan 2007 16:55:05 -0000 1.7
@@ -120,6 +120,10 @@
}
url += c_url;
+ // Remove any "mp3:" prefix. Maybe should use this to mark as audio-only
+ if (url.compare(0, 4, std::string("mp3:")) == 0) {
+ url = url.substr(4);
+ }
m_go = true;
// To avoid blocking while connecting, we use a thread.
@@ -237,21 +241,11 @@
{
NetStreamGst* ns = static_cast<NetStreamGst*>(arg);
netconnection_as_object* nc =
static_cast<netconnection_as_object*>(ns->netCon);
- URL uri(ns->url);
-
- // Check if we're allowed to open url
- if (URLAccessManager::allow(uri)) {
- bool local = false;
- if (uri.protocol() == "file")
- {
- local = true;
- }
// Pass stuff from/to the NetConnection object.
- nc->obj.openConnection(ns->url.c_str(), ns->m_netstream_object,
local);
- } else {
- log_warning("Gnash is not allowed to open movie url: %s",
ns->url.c_str());
- return 0;
+ if (!nc->obj.openConnection(ns->url.c_str(), ns->m_netstream_object)) {
+ log_warning("Gnash could not open movie url: %s",
ns->url.c_str());
+ return;
}
ns->inputPos = 0;