CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 08/01/30 14:51:48
Modified files: . : ChangeLog gui : Player.cpp Player.h gnash.cpp server : movie_root.cpp movie_root.h server/vm : ASHandlers.cpp Log message: Add a -F switch to be used for IPC. It will currently be used to request load of an URL, but the message format is not defined yet, and there's currently no known handler for tha either (the plugin should be one) CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5524&r2=1.5525 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.77&r2=1.78 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.h?cvsroot=gnash&r1=1.21&r2=1.22 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gnash.cpp?cvsroot=gnash&r1=1.98&r2=1.99 http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.155&r2=1.156 http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.106&r2=1.107 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.186&r2=1.187 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5524 retrieving revision 1.5525 diff -u -b -r1.5524 -r1.5525 --- ChangeLog 30 Jan 2008 09:41:49 -0000 1.5524 +++ ChangeLog 30 Jan 2008 14:51:47 -0000 1.5525 @@ -1,3 +1,12 @@ +2008-01-30 Sandro Santilli <[EMAIL PROTECTED]> + + * gui/Player.{cpp,h}: add a setHostFD method. + * server/movie_root.{cpp,h}: add hostFD getter and setter. + * server/vm/ASHandlers.cpp (CommonGetUrl): use host fd + to request load of an url, if given. + * gui/gnash.cpp: add -F switch to specify a filedescriptor + to use for communicating with the hosting application. + 2008-01-30 Benjamin Wolsey <[EMAIL PROTECTED]> * server/vm/VM.cpp: let System.cpp decide what to do with the system Index: gui/Player.cpp =================================================================== RCS file: /sources/gnash/gnash/gui/Player.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -u -b -r1.77 -r1.78 --- gui/Player.cpp 21 Jan 2008 20:55:39 -0000 1.77 +++ gui/Player.cpp 30 Jan 2008 14:51:47 -0000 1.78 @@ -87,6 +87,7 @@ #ifdef GNASH_FPS_DEBUG ,_fpsDebugTime(0.0) #endif + ,_hostfd(-1) { init(); } @@ -358,6 +359,10 @@ SystemClock clock; // use system clock here... movie_root& root = VM::init(*_movie_def, clock).getRoot(); + // Set host requests fd (if any) + if ( _hostfd != -1 ) root.setHostFD(_hostfd); + + _gui->setStage(&root); // Start loader thread Index: gui/Player.h =================================================================== RCS file: /sources/gnash/gnash/gui/Player.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -b -r1.21 -r1.22 --- gui/Player.h 21 Jan 2008 20:55:41 -0000 1.21 +++ gui/Player.h 30 Jan 2008 14:51:47 -0000 1.22 @@ -134,6 +134,11 @@ params[name] = value; } + void setHostFD(int fd) + { + _hostfd = fd; + } + private: void init(); @@ -203,6 +208,9 @@ float _fpsDebugTime; #endif + // Filedescriptor to use for host application requests, -1 if none + int _hostfd; + }; Index: gui/gnash.cpp =================================================================== RCS file: /sources/gnash/gnash/gui/gnash.cpp,v retrieving revision 1.98 retrieving revision 1.99 diff -u -b -r1.98 -r1.99 --- gui/gnash.cpp 21 Jan 2008 20:55:40 -0000 1.98 +++ gui/gnash.cpp 30 Jan 2008 14:51:48 -0000 1.99 @@ -120,6 +120,9 @@ _( " -m <bias> Specify the texture LOD bias (float, default is -1.0)\n" " -x <ID> X11 Window ID for display\n" + " -v Produce verbose output\n" + " -vp Be (very) verbose about parsing\n" + " -va Be (very) verbose about action execution\n" " -w Produce the disk based debug log\n" " -j <width > Set window width\n" " -k <height> Set window height\n" @@ -140,6 +143,7 @@ " (used to resolve relative urls, defaults to movie url)\n" " -P <param> Set parameter (ie. \"FlashVars=A=1&b=2\")\n" " -V, --version Print gnash's version number and exit\n" + " -F <fd> Set filedescriptor to use for external communications\n" ), _( #ifdef GNASH_FPS_DEBUG " -f num Print FPS every num seconds (float)." @@ -224,7 +228,7 @@ } } - while ((c = getopt (argc, argv, "hvaps:cd:x:r:t:b:1wj:k:u:P:U:gVf:")) != -1) + while ((c = getopt (argc, argv, "hvaps:cd:x:r:t:b:1wj:k:u:P:U:gVf:F:")) != -1) { switch (c) { // case 'c' (Disable SDL core dumps) is decoded in sdl.cpp:init() @@ -275,6 +279,17 @@ player.setBaseUrl(optarg); log_msg (_("Setting base URL to %s"), optarg); break; + case 'F': + { + int fd = strtol(optarg, NULL, 0); + if ( fd < 1 ) + { + printf(_("Invalid host communication filedescriptor %d\n"), fd); + exit(EXIT_FAILURE); + } + player.setHostFD ( fd ); + break; + } case 'j': width_given = true; player.setWidth ( strtol(optarg, NULL, 0) ); Index: server/movie_root.cpp =================================================================== RCS file: /sources/gnash/gnash/server/movie_root.cpp,v retrieving revision 1.155 retrieving revision 1.156 diff -u -b -r1.155 -r1.156 --- server/movie_root.cpp 29 Jan 2008 12:31:10 -0000 1.155 +++ server/movie_root.cpp 30 Jan 2008 14:51:48 -0000 1.156 @@ -91,7 +91,8 @@ _allowRescale(true), _invalidated(true), _disableScripts(false), - _processingActionLevel(movie_root::apSIZE) + _processingActionLevel(movie_root::apSIZE), + _hostfd(-1) { } Index: server/movie_root.h =================================================================== RCS file: /sources/gnash/gnash/server/movie_root.h,v retrieving revision 1.106 retrieving revision 1.107 diff -u -b -r1.106 -r1.107 --- server/movie_root.h 29 Jan 2008 12:31:10 -0000 1.106 +++ server/movie_root.h 30 Jan 2008 14:51:48 -0000 1.107 @@ -15,7 +15,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: movie_root.h,v 1.106 2008/01/29 12:31:10 strk Exp $ */ +/* $Id: movie_root.h,v 1.107 2008/01/30 14:51:48 strk Exp $ */ /// \page events_handling Handling of user events /// @@ -635,6 +635,24 @@ /// bool isLevelTarget(const std::string& name, unsigned int& levelno); + + /// Set a filedescriptor to use for host application requests + /// (for browser communication mostly) + void setHostFD(int fd) + { + assert(fd > 0); + _hostfd = fd; + } + + /// Get the filedescriptor to use for host application requests + /// (for browser communication mostly) + /// + /// @return -1 if no filedescriptor is provided by host app. + int getHostFD() + { + return _hostfd; + } + private: /// A load movie request @@ -911,6 +929,11 @@ const character* findDropTarget(float x, float y, character* dragging) const; + /// filedescriptor to write to for host application requests + // + /// -1 if none + /// + int _hostfd; }; Index: server/vm/ASHandlers.cpp =================================================================== RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v retrieving revision 1.186 retrieving revision 1.187 diff -u -b -r1.186 -r1.187 --- server/vm/ASHandlers.cpp 29 Jan 2008 12:31:10 -0000 1.186 +++ server/vm/ASHandlers.cpp 30 Jan 2008 14:51:48 -0000 1.187 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: ASHandlers.cpp,v 1.186 2008/01/29 12:31:10 strk Exp $ */ +/* $Id: ASHandlers.cpp,v 1.187 2008/01/30 14:51:48 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "gnashconfig.h" @@ -56,6 +56,7 @@ #include <vector> #include <utility> // for std::pair #include <locale.h> +#include <cerrno> #include <boost/scoped_array.hpp> #include <boost/random.hpp> #include <boost/algorithm/string/replace.hpp> @@ -2264,6 +2265,9 @@ return; } + int hostfd = VM::get().getRoot().getHostFD(); + if ( hostfd == -1 ) + { gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance(); string command = rcfile.getURLOpenerFormat(); @@ -2305,6 +2309,28 @@ log_msg (_("Launching URL... %s"), command.c_str()); system(command.c_str()); + } + else + { + log_debug("user-provided host requests fd is %d", hostfd); + std::stringstream request; + request << "GET " << url << " " << target_string << endl; + string requestString = request.str(); + const char* cmd = requestString.c_str(); + size_t len = requestString.length(); + // TODO: should mutex-protect this ? + // NOTE: we assuming the hostfd is set in blocking mode here.. + int ret = write(hostfd, cmd, len); + if ( ret == -1 ) + { + log_error("Could not write to user-provided host requests fd %d: %s", hostfd, strerror(errno)); + } + if ( ret < len ) + { + log_error("Could only write %d bytes over %d required to user-provided host requests fd %d: %s", + ret, len, hostfd); + } + } } _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit