[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ./ChangeLog ./configure.ac backend/gnash....
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash ./ChangeLog ./configure.ac backend/gnash.... |
Date: |
Fri, 31 Mar 2006 00:57:33 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch:
Changes by: Rob Savoye <address@hidden> 06/03/31 00:57:33
Modified files:
. : ChangeLog configure.ac
backend : gnash.cpp
plugin : Makefile.am plugin.cpp plugin.h
Log message:
* plugin/Makefile.am: Pass in the prefix as a constant so we can
use it to find the Gnash executable from within the plugin.
* gnash.cpp: For now, ignore command line arguments with a equal
sign in them.
* plugin/plugin.cpp: Build the argv array correctly so we don't
core dump Firefox. Use a GNASH_PLAYER environment variable, or the
configured exec_prefix to find the gnash executable to fork.
* plugin/plugin.h: Also store the childpid and the process name.
* configure.ac: Add options to toggle between forking the
standalone player and using a thread.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.192&tr2=1.193&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/configure.ac.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/backend/gnash.cpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/Makefile.am.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/plugin.cpp.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/plugin.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.192 gnash/ChangeLog:1.193
--- gnash/ChangeLog:1.192 Thu Mar 30 01:51:59 2006
+++ gnash/ChangeLog Fri Mar 31 00:57:33 2006
@@ -1,3 +1,42 @@
+2006-03-30 Rob Savoye <address@hidden>
+
+ * plugin/Makefile.am: Pass in the prefix as a constant so we can
+ use it to find the Gnash executable from within the plugin.
+ * gnash.cpp: For now, ignore command line arguments with a equal
+ sign in them.
+ * plugin/plugin.cpp: Build the argv array correctly so we don't
+ core dump Firefox. Use a GNASH_PLAYER environment variable, or the
+ configured exec_prefix to find the gnash executable to fork.
+ * plugin/plugin.h: Also store the childpid and the process name.
+ * configure.ac: Add options to toggle between forking the
+ standalone player and using a thread.
+
+2006-03-30 Petter Reinholdtsen <address@hidden>
+
+ * libamf/Makefile.am: Remove -Wall, it's set in configure.ac now.
+ * libbase/triangulate_impl.h: Add const to some type casting.
+ * libbase/tu_file.cpp: Remove const from *_tell_func API.
+ * libbase/tu_file.h: Remove const from *_tell_func API.
+ * libbase/tu_file_SDL.cpp: Remove const from *_tell_func API.
+ * libbase/zlib_adapter.cpp: Remove const from *_tell_func API.
+ * libgeometry/geometry.h: Swap static and const, they're in the
+ wrong order.
+ * libgeometry/kd_tree_packed.cpp: Use unsigned interger to compare
+ to the result from size() for an STL container.
+ * server/Makefile.am: Remove -Wall, it's set in configure.ac now.
+ * server/action.cpp: Add const to definition of character
+ pointer.
+ * server/dlist.cpp: Add const when casting display_object_info.
+ * server/network.cpp: Return false for now if
+ Network::createClient is called with only the port number.
+ * server/shape.cpp: Use const when casting nmesh)_set.
+ * server/sound_handler_mp3.cpp: Use unsigned interger to compare
+ to the result from size() for an STL container.
+ * server/xml.cpp: Define the niodename before using it.
+ * server/xmlnode.cpp: Return NULL if we can't return an object
+ pointer.
+ * utilities/Makefile.am: Add MP3_LIB to the linker list.
+
2006-03-29 Rob Savoye <address@hidden>
* plugin/Makefile.am: Include the backend directory in the include
@@ -17,7 +56,7 @@
* configure.ac: Add --enable-lotsa-warnings, to turn on many more
warning messages. By default only -Wall is used when using
- GCC. Based on a pacth by Petter Reinholdtsen <address@hidden>
+ GCC. Based on a patch by Petter Reinholdtsen <address@hidden>
2006-03-28 Rob Savoye <address@hidden>
Index: gnash/backend/gnash.cpp
diff -u gnash/backend/gnash.cpp:1.19 gnash/backend/gnash.cpp:1.20
--- gnash/backend/gnash.cpp:1.19 Wed Mar 29 05:42:41 2006
+++ gnash/backend/gnash.cpp Fri Mar 31 00:57:33 2006
@@ -343,7 +343,12 @@
// get the file name from the command line
while (optind < argc) {
- infiles.push_back(argv[optind]);
+ // Some options set variables, like ip=127.0.0.1
+ if (strchr(argv[optind], '=')) {
+ dbglogfile << "Got variable option on command line!" << endl;
+ } else {
+ infiles.push_back(argv[optind]);
+ }
optind++;
}
Index: gnash/configure.ac
diff -u gnash/configure.ac:1.54 gnash/configure.ac:1.55
--- gnash/configure.ac:1.54 Wed Mar 29 18:07:47 2006
+++ gnash/configure.ac Fri Mar 31 00:57:33 2006
@@ -62,6 +62,18 @@
KDE_USE_QT(3)
AM_CONDITIONAL(KLASH, test x$klash = xyes)
+dnl Add KFLASH support, if specified.
+AC_ARG_ENABLE(fork, [ --disable-fork Use a thread instead forking
the standalone player.],
+[case "${enableval}" in
+ yes) fork=yes ;;
+ no) fork=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --disable-fork option]) ;;
+esac],fork=yes)
+
+if test x"$fork" = x"yes"; then
+ AC_DEFINE([USE_FORK], [], [Fork player instead of thread])
+fi
+
dnl Add XML support, if specified.
AC_ARG_ENABLE(libxml, [ --disable-xml Disable support for xml and
xmlsocket],
[case "${enableval}" in
@@ -682,3 +694,7 @@
AC_MSG_ERROR([Please install required packages])
fi
+if test x"$fork" = x"no"; then
+ AC_MSG_ERROR([Currently only forking the standalone player works!])
+fi
+
Index: gnash/plugin/Makefile.am
diff -u gnash/plugin/Makefile.am:1.17 gnash/plugin/Makefile.am:1.18
--- gnash/plugin/Makefile.am:1.17 Thu Mar 30 01:52:00 2006
+++ gnash/plugin/Makefile.am Fri Mar 31 00:57:33 2006
@@ -83,7 +83,7 @@
# XP_UNIX This needs to get defined for npapi.h on unix platforms.
# PLUGIN_TRACE Enable this define to get debug prints whenever the plugin
# api gets control.
-AM_CPPFLAGS = -DPLUGIN_TRACE -DXP_UNIX -DMOZ_X11 -DPREFIX="${prefix}"
+AM_CPPFLAGS = -DPLUGIN_TRACE -DXP_UNIX -DMOZ_X11 -DPREFIX=\""${prefix}"\"
AM_LDFLAGS = $(X_LIBS) -lX11 -lXi -lXmu \
$(SDL_LIBS) \
$(SDL_MIXER_LIBS)\
Index: gnash/plugin/plugin.cpp
diff -u gnash/plugin/plugin.cpp:1.21 gnash/plugin/plugin.cpp:1.22
--- gnash/plugin/plugin.cpp:1.21 Thu Mar 30 01:52:00 2006
+++ gnash/plugin/plugin.cpp Fri Mar 31 00:57:33 2006
@@ -56,10 +56,12 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#endif
+#include <sys/param.h>
#ifdef USE_GTKGLEXT
#include <gtk/gtkgl.h>
#include <gdk/gdkx.h>
#endif
+#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -69,6 +71,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <errno.h>
#include <iostream>
#include <string>
@@ -118,15 +121,12 @@
// static bool s_verbose = false;
// static int doneYet = 0;
static bool waitforgdb = false;
-int start_proc(string procname, string filespec, Window win);
const int INBUFSIZE = 1024;
// static void xt_event_handler(Widget xtwidget, nsPluginInstance *plugin,
// XEvent *xevent, Boolean *b);
-#define USE_FORK 1
-
#if 0
static int attributeList_noFSAA[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_STENCIL_SIZE, 1, None };
#else
@@ -191,6 +191,7 @@
dbglogfile << "ERROR: Couldn't allocate new GL Mutex!" << endl;
}
+#ifndef USE_FORK
// This mutex is only used with the condition variable.
playerMutex = PR_NewLock();
if (playerMutex) {
@@ -206,8 +207,9 @@
dbglogfile << "Allocated new condition variable" << endl;
} else {
dbglogfile << "ERROR: Couldn't allocate new Condition Variable!" <<
endl;
- }
-
+ }
+#endif // end of USE_FORK
+
// Open a connection to the X11 server so we can lock the Display
// when swapping GLX contexts.
gxDisplay = XOpenDisplay(NULL);
@@ -243,11 +245,6 @@
dbglogfile << "Gtk2+ supported in this Mozilla version" << endl;
}
-// if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE)) {
-// fprintf(stderr, "Unable to init SDL: %s", SDL_GetError());
-// exit(1);
-// }
-
plugInitialized = TRUE;
GNASH_REPORT_RETURN;
@@ -270,12 +267,6 @@
dbglogfile << "Plugin already shut down" << endl;
return;
}
-
- if (playerMutex) {
- PR_DestroyLock(playerMutex);
- playerMutex = NULL;
- dbglogfile << "Destroyed Player Mutex" << endl;
- }
if (glMutex) {
PR_DestroyLock(glMutex);
@@ -283,11 +274,19 @@
dbglogfile << "Destroyed GL Mutex" << endl;
}
+#ifndef USE_FORK
+ if (playerMutex) {
+ PR_DestroyLock(playerMutex);
+ playerMutex = NULL;
+ dbglogfile << "Destroyed Player Mutex" << endl;
+ }
+
if (playerCond) {
PR_DestroyCondVar(playerCond);
playerCond = NULL;
dbglogfile << "Destroyed Player condition variable" << endl;
}
+#endif // end of USE_FORK
if (gxDisplay) {
XCloseDisplay(gxDisplay);
@@ -389,7 +388,9 @@
_glxContext(NULL),
_shutdown(FALSE),
_glInitialized(FALSE),
- _thread(NULL)
+ _thread(NULL),
+ _thread_key(0),
+ _childpid(0)
{
GNASH_REPORT_FUNCTION;
}
@@ -442,6 +443,7 @@
{
log_trace("%s: enter for instance %p", __PRETTY_FUNCTION__, this);
+#ifndef USE_FORK
if (_thread) {
dbglogfile << "Waiting for the thread to terminate..." << endl;
// PRStatus rv = PR_SetThreadPrivate(_thread_key, (void *)"stop");
@@ -455,6 +457,10 @@
_thread = NULL;
}
destroyContext();
+// end of USE_FORK
+#endif
+ kill(_childpid, SIGINT);
+ _childpid = 0;
}
/// \brief Set the window to be used to render in
@@ -715,7 +721,7 @@
}
}
- swf_file = fname;
+ _swf_file = fname;
processing = true;
return NPERR_NO_ERROR;
@@ -727,10 +733,10 @@
{
log_trace("%s: enter for instance %p", __PRETTY_FUNCTION__, this);
+ nsPluginInstance *arg = (nsPluginInstance *)this;
char tmp[300];
memset(tmp, 0, 300);
- nsPluginInstance *arg = (nsPluginInstance *)this;
- sprintf(tmp, "Done Flash movie %s", swf_file.c_str());
+ sprintf(tmp, "Done Flash movie %s", _swf_file.c_str());
WriteStatus(tmp);
log_msg("%s: this = %p, URL is %s", __PRETTY_FUNCTION__,
@@ -777,13 +783,11 @@
#else
Window window = _window;
#endif
- string procname = "/usr/local/bin/gnash";
- start_proc(procname, swf_file, window);
- sleep(1);
+ _childpid = startProc(_swf_file.c_str(), window);
#endif
- sprintf(tmp, "Started thread for Flash movie %s", swf_file.c_str());
- WriteStatus(tmp);
+// sprintf(tmp, "Started thread for Flash movie %s", _swf_file.c_str());
+// WriteStatus(tmp);
return NPERR_NO_ERROR;
}
@@ -994,64 +998,86 @@
// SDL_mutexP(mutant);
}
-// Run the memory tests between two processes
+
+int
+nsPluginInstance::startProc(string filespec)
+{
+ return startProc(filespec, _window);
+}
+
int
-start_proc(string procname, string filespec, Window win)
+nsPluginInstance::startProc(string filespec, Window win)
{
GNASH_REPORT_FUNCTION;
struct stat procstats;
- char *cmd_line[5];
- pid_t childpid;
int ret = 0;
- // See if the file actually exists, otherwise we can't spawn it
- if (stat(procname.c_str(), &procstats) == -1) {
- cerr << "Invalid filename \"" << procname << "\"" <<endl;
- perror(procname.c_str());
- return -1;
- }
-
- // setup a command line. By default, argv[0] is the name of the process
- memset(cmd_line, 0, sizeof(char *)*5);
- cmd_line[0] = new char(procname.size()+1);
- strcpy(cmd_line[0], procname.c_str());
- cmd_line[1] = new char(50);
- sprintf(cmd_line[1], "-x %d", (int)win);
- cmd_line[2] = new char(50);
- sprintf(cmd_line[2], "-v");
- cmd_line[3] = new char(filespec.size()+1);
- sprintf(cmd_line[3], "%s", filespec.c_str());
- // This option tells the child process to wait for GDB to connect.
- if (waitforgdb) {
- cmd_line[4] = new char(4);
- strcpy(cmd_line[4], "-s");
+ char *gnash_env = getenv("GNASH_PLAYER");
+ if (!gnash_env) {
+ _procname = PREFIX;
+ _procname += "/bin/gnash";
+ } else {
+ _procname = gnash_env;
}
- // fork ourselves silly
- childpid = fork();
- // childpid is a positive integer, if we are the parent, and fork() worked
- if (childpid > 0) {
- cerr << "Forked sucessfully, child process PID is " << childpid <<
endl;
- return childpid;
+ // See if the file actually exists, otherwise we can't spawn it
+ if (stat(_procname.c_str(), &procstats) == -1) {
+ dbglogfile << "Invalid filename: " << _procname << endl;
+ return -1;
}
+ _childpid = fork();
// childpid is -1, if the fork failed, so print out an error message
- if (childpid == -1) {
- perror(procname.c_str());
+ if (_childpid == -1) {
+ perror(strerror(errno));
return -1;
}
+ // childpid is a positive integer, if we are the parent, and
+ // fork() worked
+ if (_childpid > 0) {
+ dbglogfile << "Forked sucessfully, child process PID is " << _childpid
<< endl;
+ return _childpid;
+ }
+
+ // setup the command line
+ char num[30];
+ memset(num, 0, 30);
+ sprintf(num, "%d", (int)win);
+
+// cmd_line[0] = new char(procname.size()+1);
+// strcpy(cmd_line[0], procname.c_str());
+// cmd_line[1] = new char(50);
+// sprintf(cmd_line[1], "-x %d", (int)win);
+// cmd_line[2] = new char(50);
+// sprintf(cmd_line[2], "-v");
+// cmd_line[3] = new char(filespec.size()+1);
+// sprintf(cmd_line[3], "%s", filespec.c_str());
+ // This option tells the child process to wait for GDB to connect.
+
+ // This option tells the child process to wait for GDB to connect.
+ if (waitforgdb) {
+// cmd_line[4] = new char(4);
+// strcpy(cmd_line[4], "-s");
+ }
+ char *argv[] = {
+ (char *)_procname.c_str(),
+ "-x", num,
+ (char *)filespec.c_str(),
+ 0
+ };
// If we are the child, exec the new process, then go away
- if (childpid == 0) {
+ if (_childpid == 0) {
// Start the desired executable
- cout << "Starting " << procname << " with -x " << win << " "
- << filespec << endl;
- ret = execv(procname.c_str(), cmd_line);
- perror(procname.c_str());
- exit(0);
+ dbglogfile << "Starting " << _procname << " with -x "
+ << (int)win << " " << filespec << endl;
+ ret = execv(argv[0], argv);
+ perror(strerror(ret));
+ exit(ret);
}
- return 0;
+
+ return _childpid;
}
// Local Variables:
Index: gnash/plugin/plugin.h
diff -u gnash/plugin/plugin.h:1.10 gnash/plugin/plugin.h:1.11
--- gnash/plugin/plugin.h:1.10 Thu Mar 30 01:52:00 2006
+++ gnash/plugin/plugin.h Fri Mar 31 00:57:33 2006
@@ -97,7 +97,8 @@
void setWidget(GtkWidget *win) { _gtkwidget = win; };
#endif
-
+ int startProc(std::string filespec);
+ int startProc(std::string filespec, Window win);
// accessors
const char *getVersion();
Window getWindow() { return _window; };
@@ -105,7 +106,7 @@
unsigned int getDepth() { return mDepth; };
int getWidth() { return mWidth; };
int getHeight() { return mHeight; };
- const char *getFilename() { return swf_file.c_str(); };
+ const char *getFilename() { return _swf_file.c_str(); };
PRUintn getThreadKey() { return _thread_key; };
NPBool getShutdown() { return _shutdown; };
@@ -198,7 +199,7 @@
Window _window;
Widget mXtwidget;
XFontStruct *mFontInfo;
- std::string swf_file;
+ std::string _swf_file;
int mX;
int mY;
unsigned int mWidth;
@@ -213,7 +214,8 @@
NPBool _glInitialized;
PRThread *_thread;
PRUintn _thread_key;
-
+ std::string _procname;
+ pid_t _childpid;
#ifdef HAVE_GTK2
// NPBool _newwin;
GtkWidget *_gtkwidget;