Commit 1cb72d98 authored by Bastien Nocera's avatar Bastien Nocera Committed by Bastien Nocera

Fix the GTK+ only build, disable vanity building by default (we need to

2004-04-19  Bastien Nocera  <hadess@hadess.net>

	* configure.in:
	* data/Makefile.am:
	* data/mozilla-viewer.glade:
	* src/Makefile.am:
	* src/totem-mozilla-plugin.c: (totem_plugin_fork),
	(totem_plugin_new_instance), (totem_plugin_destroy_instance),
	(totem_plugin_set_window), (totem_plugin_new_stream),
	(totem_plugin_destroy_stream), (totem_plugin_write_ready),
	(totem_plugin_write), (totem_plugin_stream_as_file),
	(totem_plugin_url_notify), (totem_plugin_get_value),
	(totem_plugin_set_value), (NP_GetValue), (NP_GetMIMEDescription),
	(NP_Initialize), (NP_Shutdown):
	* src/totem-mozilla-viewer.c: (totem_embedded_error_and_exit),
	(totem_embedded_open), (totem_embedded_add_children), (embedded),
	(main): Fix the GTK+ only build, disable vanity building by default
	(we need to finish it first...), commit the first version (slightly
	broken *cough*understatement*cough*) of the Mozilla plugin
parent 294c3f58
2004-04-19 Bastien Nocera <hadess@hadess.net>
* configure.in:
* data/Makefile.am:
* data/mozilla-viewer.glade:
* src/Makefile.am:
* src/totem-mozilla-plugin.c: (totem_plugin_fork),
(totem_plugin_new_instance), (totem_plugin_destroy_instance),
(totem_plugin_set_window), (totem_plugin_new_stream),
(totem_plugin_destroy_stream), (totem_plugin_write_ready),
(totem_plugin_write), (totem_plugin_stream_as_file),
(totem_plugin_url_notify), (totem_plugin_get_value),
(totem_plugin_set_value), (NP_GetValue), (NP_GetMIMEDescription),
(NP_Initialize), (NP_Shutdown):
* src/totem-mozilla-viewer.c: (totem_embedded_error_and_exit),
(totem_embedded_open), (totem_embedded_add_children), (embedded),
(main): Fix the GTK+ only build, disable vanity building by default
(we need to finish it first...), commit the first version (slightly
broken *cough*understatement*cough*) of the Mozilla plugin
============ Version 0.99.11 ============ Version 0.99.11
2004-04-18 Bastien Nocera <hadess@hadess.net> 2004-04-18 Bastien Nocera <hadess@hadess.net>
......
...@@ -90,7 +90,7 @@ AC_ARG_ENABLE(vanity, ...@@ -90,7 +90,7 @@ AC_ARG_ENABLE(vanity,
no) ENABLE_VANITY=no ;; no) ENABLE_VANITY=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-vanity) ;; *) AC_MSG_ERROR(bad value ${enableval} for --disable-vanity) ;;
esac], esac],
[ENABLE_VANITY=yes]) dnl Default value [ENABLE_VANITY=no]) dnl Default value
AC_MSG_CHECKING(for Linux) AC_MSG_CHECKING(for Linux)
case `uname` in case `uname` in
...@@ -120,11 +120,10 @@ AC_ARG_ENABLE(gtk, ...@@ -120,11 +120,10 @@ AC_ARG_ENABLE(gtk,
[case "${enableval}" in [case "${enableval}" in
yes) ENABLE_GTK=yes ;; yes) ENABLE_GTK=yes ;;
no) ENABLE_GTK=no ;; no) ENABLE_GTK=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-vanity) ;; *) AC_MSG_ERROR(bad value ${enableval} for --disable-gtk) ;;
esac], esac],
[ENABLE_GTK=no]) dnl Default value [ENABLE_GTK=no]) dnl Default value
dnl Seems that the order matters because libtool blows dnl Seems that the order matters because libtool blows
dnl Also check if we're going to be using GTK+ only dnl Also check if we're going to be using GTK+ only
if test x$ENABLE_GTK = "xno" ; then if test x$ENABLE_GTK = "xno" ; then
...@@ -148,6 +147,28 @@ PKG_CHECK_MODULES(GTK, gtk+-x11-2.0 $MM gthread-2.0) ...@@ -148,6 +147,28 @@ PKG_CHECK_MODULES(GTK, gtk+-x11-2.0 $MM gthread-2.0)
AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS) AC_SUBST(GTK_LIBS)
dnl Check for Mozilla plugin build
AC_ARG_ENABLE(mozilla,
AC_HELP_STRING([--enable-mozilla],[compile the mozilla plugin]),
[case "${enableval}" in
yes) ENABLE_MOZILLA=yes ;;
no) ENABLE_MOZILLA=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-mozilla) ;;
esac],
[ENABLE_MOZILLA=no]) dnl Default value
if test x$ENABLE_MOZILLA = "xyes" ; then
PKG_CHECK_MODULES(MOZILLA, gtk+-x11-2.0 $MM gthread-2.0 mozilla-plugin,
[HAVE_MOZILLA=yes], [HAVE_MOZILLA=no])
fi
AC_SUBST(MOZILLA_CFLAGS)
AC_SUBST(MOZILLA_LIBS)
if test x$HAVE_MOZILLA = "xyes"; then
AC_DEFINE(HAVE_MOZILLA, 1, [defined if you build the mozilla plugin])
fi
AM_CONDITIONAL(HAVE_MOZILLA, test x$ENABLE_MOZILLA = "xyes")
dnl LIRC dnl LIRC
AC_ARG_ENABLE(lirc, AC_ARG_ENABLE(lirc,
......
...@@ -17,6 +17,7 @@ stuff_DATA = \ ...@@ -17,6 +17,7 @@ stuff_DATA = \
stock-tool-brightness-contrast-22.png \ stock-tool-brightness-contrast-22.png \
totem.glade \ totem.glade \
playlist.glade \ playlist.glade \
mozilla-viewer.glade \
properties.glade \ properties.glade \
uri.glade \ uri.glade \
screenshot.glade \ screenshot.glade \
......
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="window">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="controls">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="pp_button">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="pixbuf">stock_media_play.png</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHScale" id="hscale1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="draw_value">False</property>
<property name="value_pos">GTK_POS_TOP</property>
<property name="digits">1</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property>
<property name="adjustment">0 0 0 0 0 0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="prefs_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
...@@ -6,17 +6,35 @@ else ...@@ -6,17 +6,35 @@ else
VANITY= VANITY=
endif endif
if HAVE_GNOME
TOTEM_PROPERTIES_PAGE = totem-properties-page
else
TOTEM_PROPERTIES_PAGE =
endif
if HAVE_MOZILLA
TOTEM_MOZILLA_VIEWER = totem-mozilla-viewer
TOTEM_MOZILLA_PLUGIN = libtotem_mozilla.la
else
TOTEM_MOZILLA_VIEWER =
TOTEM_MOZILLA_PLUGIN =
endif
bin_PROGRAMS = totem totem-video-thumbnailer $(VANITY) bin_PROGRAMS = totem totem-video-thumbnailer $(VANITY)
libexec_PROGRAMS = $(TOTEM_MOZILLA_VIEWER) $(TOTEM_PROPERTIES_PAGE)
plugin_LTLIBRARIES = $(TOTEM_MOZILLA_PLUGIN)
if TOTEM_GST if TOTEM_GST
MM= bacon-video-widget-gst.c \ MM = bacon-video-widget-gst.c \
gstvideowidget.c \ gstvideowidget.c \
gstvideowidget.h gstvideowidget.h
else else
MM=bacon-video-widget-xine.c MM = bacon-video-widget-xine.c
endif endif
MARSHALFILES = baconvideowidget-marshal.h baconvideowidget-marshal.c totemplparser-marshal.c totemplparser-marshal.h BVWMARSHALFILES = baconvideowidget-marshal.h baconvideowidget-marshal.c
PLPARSERMARSHALFILES = totemplparser-marshal.c totemplparser-marshal.h
MARSHALFILES = $(BVWMARSHALFILES) $(PLPARSERMARSHALFILES)
GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0` GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
baconvideowidget-marshal.h: baconvideowidget-marshal.list baconvideowidget-marshal.h: baconvideowidget-marshal.list
...@@ -64,12 +82,13 @@ regenerate-built-sources: ...@@ -64,12 +82,13 @@ regenerate-built-sources:
EGGFILES="$(BACON_CD_SELECTION)" EGGDIR="$(BACONDIR)" $(srcdir)/update-from-egg.sh || true EGGFILES="$(BACON_CD_SELECTION)" EGGDIR="$(BACONDIR)" $(srcdir)/update-from-egg.sh || true
EGGFILES="$(BACON_V4L_SELECTION)" EGGDIR="$(BACONDIR)" $(srcdir)/update-from-egg.sh || true EGGFILES="$(BACON_V4L_SELECTION)" EGGDIR="$(BACONDIR)" $(srcdir)/update-from-egg.sh || true
VIDEOWIDGET = baconvideowidget-marshal.list totemplparser-marshal.list $(MARSHALFILES) $(MM) bacon-video-widget.h bacon-resize.h bacon-resize.c video-utils.c video-utils.h debug.h VIDEOWIDGET = baconvideowidget-marshal.list totemplparser-marshal.list $(BVWMARSHALFILES) $(MM) bacon-video-widget.h bacon-resize.h bacon-resize.c video-utils.c video-utils.h debug.h
totem_SOURCES = \ totem_SOURCES = \
$(EGG_RECENT_FILES) \ $(EGG_RECENT_FILES) \
$(BACON_CD_SELECTION) \ $(BACON_CD_SELECTION) \
$(VIDEOWIDGET) \ $(VIDEOWIDGET) \
$(PLPARSERMARSHALFILES) \
totem.c totem.h \ totem.c totem.h \
totem-remote.c totem-remote.h \ totem-remote.c totem-remote.h \
totem-preferences.c totem-preferences.h \ totem-preferences.c totem-preferences.h \
...@@ -93,16 +112,25 @@ totem_LDADD = $(X_LIBS) $(EXTRA_GNOME_LIBS) $(XTEST_LIBS) $(REMOTE_LIBS) $(RANDR ...@@ -93,16 +112,25 @@ totem_LDADD = $(X_LIBS) $(EXTRA_GNOME_LIBS) $(XTEST_LIBS) $(REMOTE_LIBS) $(RANDR
totem_video_thumbnailer_SOURCES = $(VIDEOWIDGET) totem-video-thumbnailer.c totem_video_thumbnailer_SOURCES = $(VIDEOWIDGET) totem-video-thumbnailer.c
totem_video_thumbnailer_LDADD = $(X_LIBS) $(GTK_LIBS) $(XTEST_LIBS) $(RANDR_LIBS) $(NVTV_LIBS) totem_video_thumbnailer_LDADD = $(X_LIBS) $(GTK_LIBS) $(XTEST_LIBS) $(RANDR_LIBS) $(NVTV_LIBS)
#FIXME for gtk+ only version
#if HAVE_GNOME
libexec_PROGRAMS = totem-properties-page
totem_properties_page_SOURCES = \ totem_properties_page_SOURCES = \
$(VIDEOWIDGET) \ $(VIDEOWIDGET) \
bacon-video-widget-properties.c \ bacon-video-widget-properties.c \
bacon-video-widget-properties.h \ bacon-video-widget-properties.h \
totem-properties-page.c totem-properties-page.c
totem_properties_page_LDADD = $(X_LIBS) $(EXTRA_GNOME_LIBS) $(XTEST_LIBS) $(RANDR_LIBS) $(NVTV_LIBS) totem_properties_page_LDADD = $(X_LIBS) $(EXTRA_GNOME_LIBS) $(XTEST_LIBS) $(RANDR_LIBS) $(NVTV_LIBS)
#endif
libtotem_mozilla_la_LDFLAGS = $(GTK_LIBS) $(module_flags)
libtotem_mozilla_la_SOURCES = totem-mozilla-plugin.c
totem_mozilla_viewer_SOURCES = \
$(VIDEOWIDGET) \
bacon-video-widget-properties.c \
bacon-video-widget-properties.h \
totem-mozilla-viewer.c
totem_mozilla_viewer_LDADD = $(X_LIBS) $(EXTRA_GNOME_LIBS) $(XTEST_LIBS) $(RANDR_LIBS) $(NVTV_LIBS)
plugindir = $(libdir)/mozilla/plugins/
module_flags = -export_dynamic -avoid-version
vanity_SOURCES = \ vanity_SOURCES = \
$(VIDEOWIDGET) \ $(VIDEOWIDGET) \
...@@ -118,10 +146,12 @@ bvw_test_LDADD = $(X_LIBS) $(GTK_LIBS) $(XTEST_LIBS) $(RANDR_LIBS) $(NVTV_LIBS) ...@@ -118,10 +146,12 @@ bvw_test_LDADD = $(X_LIBS) $(GTK_LIBS) $(XTEST_LIBS) $(RANDR_LIBS) $(NVTV_LIBS)
INCLUDES = \ INCLUDES = \
-D_REENTRANT \ -D_REENTRANT \
$(EXTRA_GNOME_CFLAGS) \ $(EXTRA_GNOME_CFLAGS) \
$(NVTV_CFLAGS) \ $(MOZILLA_CFLAGS) \
$(NVTV_CFLAGS) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DGCONF_PREFIX=\""/apps/totem"\" \ -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \ -DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DLOGO_PATH=DATADIR\"\"G_DIR_SEPARATOR_S\"totem\"G_DIR_SEPARATOR_S\"totem_logo.png\" -DLOGO_PATH=DATADIR\"\"G_DIR_SEPARATOR_S\"totem\"G_DIR_SEPARATOR_S\"totem_logo.png\"
CLEANFILES = *.bak *.gladep core* *.orig *~ $(MARSHALFILES) $(desktop_DATA) CLEANFILES = *.bak *.gladep core* *.orig *~ $(MARSHALFILES) $(desktop_DATA)
...@@ -130,5 +160,7 @@ EXTRA_DIST = bacon-video-widget-xine.c \ ...@@ -130,5 +160,7 @@ EXTRA_DIST = bacon-video-widget-xine.c \
gstvideowidget.c \ gstvideowidget.c \
gstvideowidget.h \ gstvideowidget.h \
$(BACON_V4L_SELECTION) \ $(BACON_V4L_SELECTION) \
vanity.c vanity.c \
totem-mozilla-viewer.c \
totem-mozilla-plugin.c
/* Totem Mozilla plugin
*
* Copyright (C) <2004> Bastien Nocera <hadess@hadess.net>
* Copyright (C) <2002> David A. Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <string.h>
#include <glib.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(String) dgettext(GETTEXT_PACKAGE,String)
#ifdef gettext_noop
#define N_(String) gettext_noop(String)
#else
#define N_(String) (String)
#endif /* gettext_noop */
#else
#define _(String) (String)
#define N_(String) (String)
#endif /* ENABLE_NLS */
#define XP_UNIX 1
#define MOZ_X11 1
#include "npapi.h"
#include "npupp.h"
#define DEBUG(x) printf(x "\n")
//#define DEBUG(x)
typedef struct {
NPP instance;
guint32 window;
int width, height;
int recv_fd, send_fd;
int player_pid;
GByteArray *bytes;
} TotemPlugin;
static NPNetscapeFuncs mozilla_functions;
/* You don't update, you die! */
#define MAX_ARGV_LEN 10
static void totem_plugin_fork (TotemPlugin *plugin)
{
char **argv;
int argc = 0;
GError *err = NULL;
argv = (char **)g_new0 (char *, MAX_ARGV_LEN);
if (g_file_test ("./totem-mozilla-viewer",
G_FILE_TEST_EXISTS) != FALSE) {
argv[argc++] = g_strdup ("./totem-mozilla-viewer");
} else {
argv[argc++] = g_strdup (LIBDIR"/totem-mozilla-viewer");
}
argv[argc++] = "--xid";
argv[argc++] = g_strdup_printf ("%d", plugin->window);
if (plugin->width) {
argv[argc++] = g_strdup ("--width");
argv[argc++] = g_strdup_printf ("%d", plugin->width);
}
if (plugin->height) {
argv[argc++] = g_strdup ("--height");
argv[argc++] = g_strdup_printf ("%d", plugin->height);
}
argv[argc++] = g_strdup ("fd://0");
argv[argc] = NULL;
{
int i;
g_print ("Launching: ");
for (i = 0; i < argc; i++) {
g_print ("%s ", argv[i]);
}
g_print ("\n");
}
if (g_spawn_async_with_pipes (NULL, argv, NULL,
G_SPAWN_DO_NOT_REAP_CHILD,
// | G_SPAWN_STDOUT_TO_DEV_NULL,
NULL, NULL, &plugin->player_pid,
&plugin->send_fd, NULL, NULL, &err) == FALSE)
{
DEBUG("Spawn failed");
if(err)
{
fprintf(stderr, "%s\n", err->message);
g_error_free(err);
}
}
g_strfreev (argv);
}
static NPError totem_plugin_new_instance (NPMIMEType mime_type, NPP instance,
uint16_t mode, int16_t argc, char *argn[], char *argv[],
NPSavedData *saved)
{
TotemPlugin *plugin;
int i;
DEBUG("totem_plugin_new_instance");
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
instance->pdata = mozilla_functions.memalloc(sizeof(TotemPlugin));
plugin = (TotemPlugin *) instance->pdata;
if (plugin == NULL)
return NPERR_OUT_OF_MEMORY_ERROR;
memset(plugin, 0, sizeof(TotemPlugin));
/* mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) */
printf("mode %d\n",mode);
//printf("mime type: %s\n",pluginType);
plugin->instance = instance;
for (i=0; i<argc; i++) {
printf ("argv[%d] %s %s\n", i, argn[i], argv[i]);
if (strcmp (argn[i],"width") == 0) {
plugin->width = strtol (argv[i], NULL, 0);
}
if (strcmp (argn[i], "height") == 0) {
plugin->height = strtol (argv[i], NULL, 0);
}
//Handle loop
}
//totem_plugin_fork(plugin, 0x32);
return NPERR_NO_ERROR;
}
static NPError totem_plugin_destroy_instance (NPP instance, NPSavedData **save)
{
TotemPlugin * plugin;
DEBUG("plugin_destroy");
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
plugin = (TotemPlugin *) instance->pdata;
if (plugin == NULL)
return NPERR_NO_ERROR;
// close(plugin->send_fd);
// close(plugin->recv_fd);
// kill (plugin->player_pid, SIGKILL);
// waitpid (plugin->player_pid, NULL, 0);
mozilla_functions.memfree (instance->pdata);
instance->pdata = NULL;
return NPERR_NO_ERROR;
}
static NPError totem_plugin_set_window (NPP instance, NPWindow* window)
{
TotemPlugin *plugin;
DEBUG("plugin_set_window");
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
plugin = (TotemPlugin *) instance->pdata;
if (plugin == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
if (plugin->window) {
DEBUG ("existing window");
if (plugin->window == (Window) window->window) {
DEBUG("resize");
/* Resize event */
/* Not currently handled */
} else {
DEBUG("change");
printf ("ack. window changed!\n");
}
} else {
NPSetWindowCallbackStruct *ws_info;
DEBUG("about to fork");
ws_info = window->ws_info;
plugin->window = (Window) window->window;
totem_plugin_fork (plugin);
//fcntl(plugin->send_fd, F_SETFL, O_NONBLOCK);
}
DEBUG("leaving plugin_set_window");
return NPERR_NO_ERROR;
}
static NPError totem_plugin_new_stream (NPP instance, NPMIMEType type,
NPStream* stream_ptr, NPBool seekable, uint16* stype)
{
DEBUG("plugin_new_stream");
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
return NPERR_NO_ERROR;
}
static NPError totem_plugin_destroy_stream (NPP instance, NPStream* stream,
NPError reason)
{
DEBUG("plugin_destroy_stream");
return NPERR_NO_ERROR;
}
static int32 totem_plugin_write_ready (NPP instance, NPStream *stream)
{
TotemPlugin *plugin;
DEBUG("plugin_write_ready");
if (instance == NULL) {
DEBUG("plugin_write_ready instance is NULL");
return 0;
}
plugin = (TotemPlugin *) instance->pdata;
return (8*1024);
// return 4096;
}
static int32 totem_plugin_write (NPP instance, NPStream *stream, int32 offset,
int32 len, void *buffer)
{
TotemPlugin *plugin;
int ret;
DEBUG("plugin_write");
if (instance == NULL)
return 0;
plugin = (TotemPlugin *) instance->pdata;
if (plugin == NULL)
return 0;
if (!plugin->player_pid)
return 0;
ret = write (plugin->send_fd, buffer, len);
if (ret < 0)
ret = 0;
return ret;
}
static void totem_plugin_stream_as_file (NPP instance, NPStream *stream,
const char* fname)
{
TotemPlugin *plugin;
DEBUG("plugin_stream_as_file");
if (instance == NULL)
return;
plugin = (TotemPlugin *) instance->pdata;
if (plugin == NULL)
return;
printf("plugin_stream_as_file\n");
}
static void
totem_plugin_url_notify (NPP instance, const char* url,
NPReason reason, void* notifyData)
{
DEBUG("plugin_url_notify");
}
static NPError
totem_plugin_get_value (NPP instance, NPPVariable variable,
void *value)
{