diff options
author | Bastien Nocera <hadess@hadess.net> | 2006-09-07 22:11:44 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@src.gnome.org> | 2006-09-07 22:11:44 +0000 |
commit | 5edbf64a1072fbb268b8f48426ccf6a6efa9dc8e (patch) | |
tree | a96f53b7e9510590f8018f6f5af8185c261614c0 | |
parent | f0ecd039f3f2b26c6861e102ee9cf70877206cc1 (diff) |
Add a new "MullY" plugin, to handle videos on the DivX website,
2006-09-07 Bastien Nocera <hadess@hadess.net>
* browser-plugin/Makefile.am:
* browser-plugin/idl/Makefile.am:
* browser-plugin/idl/totemIMullYPlayer.idl:
* browser-plugin/totemGMPPlugin.cpp:
* browser-plugin/totemMullYPlugin.cpp:
* browser-plugin/totemMullYPlugin.h:
* browser-plugin/totemPlugin.cpp:
* configure.in: Add a new "MullY" plugin, to handle videos on the
DivX website, masquerading as the "DivX Web Player"
(Closes: #345554)
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | browser-plugin/Makefile.am | 58 | ||||
-rw-r--r-- | browser-plugin/idl/Makefile.am | 15 | ||||
-rw-r--r-- | browser-plugin/idl/totemIMullYPlayer.idl | 29 | ||||
-rw-r--r-- | browser-plugin/totemGMPPlugin.cpp | 1 | ||||
-rw-r--r-- | browser-plugin/totemMullYPlugin.cpp | 200 | ||||
-rw-r--r-- | browser-plugin/totemMullYPlugin.h | 54 | ||||
-rw-r--r-- | browser-plugin/totemPlugin.cpp | 2 | ||||
-rw-r--r-- | configure.in | 7 |
9 files changed, 377 insertions, 2 deletions
@@ -1,5 +1,18 @@ 2006-09-07 Bastien Nocera <hadess@hadess.net> + * browser-plugin/Makefile.am: + * browser-plugin/idl/Makefile.am: + * browser-plugin/idl/totemIMullYPlayer.idl: + * browser-plugin/totemGMPPlugin.cpp: + * browser-plugin/totemMullYPlugin.cpp: + * browser-plugin/totemMullYPlugin.h: + * browser-plugin/totemPlugin.cpp: + * configure.in: Add a new "MullY" plugin, to handle videos on the + DivX website, masquerading as the "DivX Web Player" + (Closes: #345554) + +2006-09-07 Bastien Nocera <hadess@hadess.net> + * browser-plugin/totemPlugin.cpp: - Don't fork a viewer in set_window if we don't have a stream yet, it'll come later diff --git a/browser-plugin/Makefile.am b/browser-plugin/Makefile.am index b93d9970..4a68d36c 100644 --- a/browser-plugin/Makefile.am +++ b/browser-plugin/Makefile.am @@ -240,3 +240,61 @@ libtotem_narrowspace_plugin_la_LDFLAGS = \ $(AM_LDFLAGS) endif + +# Totem MULLY Plugin + +if ENABLE_MULLY_PLUGIN + +plugin_LTLIBRARIES += libtotem-mully-plugin.la + +libtotem_mully_plugin_la_SOURCES = \ + totemPlugin.cpp \ + totemPlugin.h \ + totemMullYPlugin.cpp \ + totemMullYPlugin.h + +libtotem_mully_plugin_la_CPPFLAGS = \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/backend \ + -I$(top_srcdir)/src/plparse \ + -I$(top_builddir)/src \ + -I$(top_builddir)/src/backend \ + -I$(top_builddir)/src/plparse \ + -Iidl \ + $(addprefix -I$(MOZILLA_INCLUDE_ROOT)/,$(gecko_include_subdirs)) \ + -DTOTEM_MULLY_PLUGIN \ + -DTOTEM_PL_PARSER_MINI \ + -D_REENTRANT \ + -DDBUS_API_SUBJECT_TO_CHANGE \ + -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ + -DGCONF_PREFIX=\""/apps/totem"\" \ + -DDATADIR=\""$(pkgdatadir)"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DBINDIR=\""$(bindir)"\" \ + $(AM_CPPFLAGS) + +libtotem_mully_plugin_la_CFLAGS = \ + $(BROWSER_PLUGIN_CFLAGS) \ + $(MOZILLA_XPCOM_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(AM_CFLAGS) + +libtotem_mully_plugin_la_CXXFLAGS = \ + $(BROWSER_PLUGIN_CFLAGS) \ + $(MOZILLA_XPCOM_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(AM_CFLAGS) + +libtotem_mully_plugin_la_LIBADD = \ + $(top_builddir)/src/plparse/libtotem-plparser-mini.la \ + $(DBUS_LIBS) \ + $(MOZILLA_LIBS) + +libtotem_mully_plugin_la_LDFLAGS = \ + -avoid-version \ + -export-symbols $(srcdir)/plugin.symbols \ + -module \ + $(AM_LDFLAGS) + +endif + diff --git a/browser-plugin/idl/Makefile.am b/browser-plugin/idl/Makefile.am index e01864ca..aa5fd391 100644 --- a/browser-plugin/idl/Makefile.am +++ b/browser-plugin/idl/Makefile.am @@ -14,6 +14,9 @@ GMP_IDLS = \ NARROWSPACE_IDLS = \ totemINarrowSpacePlayer.idl +MULLY_IDLS = \ + totemIMullYPlayer.idl + xptdir = $(libdir)/mozilla/plugins xpt_DATA = @@ -39,6 +42,11 @@ ALL_IDLS += $(NARROWSPACE_IDLS) xpt_DATA += libtotem-narrowspace-plugin.xpt endif +if ENABLE_MULLY_PLUGIN +ALL_IDLS += $(MULLY_IDLS) +xpt_DATA += libtotem-mully-plugin.xpt +endif + noinst_DATA = \ $(ALL_IDLS:.idl=.xpt) \ $(ALL_IDLS:.idl=.h) @@ -56,7 +64,8 @@ EXTRA_DIST = \ $(BASIC_IDLS) \ $(GMP_IDLS) \ $(COMPLEX_IDLS) \ - $(NARROWSPACE_IDLS) + $(NARROWSPACE_IDLS) \ + $(MULLY_IDLS) %.h: %.idl $(MOZILLA_XPIDL) -w -m header -I $(MOZILLA_IDLDIR) -I $(srcdir) $< @@ -81,3 +90,7 @@ libtotem-gmp-plugin.xpt: $(GMP_IDLS:.idl=.xpt) libtotem-narrowspace-plugin.xpt: $(NARROWSPACE_IDLS:.idl=.xpt) $(MOZILLA_XPT_LINK) $@ $^ + +libtotem-mully-plugin.xpt: $(MULLY_IDLS:.idl=.xpt) + $(MOZILLA_XPT_LINK) $@ $^ + diff --git a/browser-plugin/idl/totemIMullYPlayer.idl b/browser-plugin/idl/totemIMullYPlayer.idl new file mode 100644 index 00000000..f9ac2dfb --- /dev/null +++ b/browser-plugin/idl/totemIMullYPlayer.idl @@ -0,0 +1,29 @@ +/* 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 "nsISupports.idl" + +[scriptable, uuid(9fd39e29-09ec-42ce-a075-a2f58bf40c7b)] +interface totemIMullYPlayer : nsISupports { + void Play (); + void Rewind (); + void Stop (); +}; diff --git a/browser-plugin/totemGMPPlugin.cpp b/browser-plugin/totemGMPPlugin.cpp index 4076b13e..c9cc147d 100644 --- a/browser-plugin/totemGMPPlugin.cpp +++ b/browser-plugin/totemGMPPlugin.cpp @@ -52,7 +52,6 @@ static const totemPluginMimeEntry kMimeTypes[] = { { "video/x-ms-asf", "asf", NULL }, { "video/x-ms-wmv", "wmv", "video/x-ms-wmv" }, { "video/x-wmv", "wmv", "video/x-ms-wmv" }, - { "video/divx", "divx", "video/x-msvideo" }, }; totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin) diff --git a/browser-plugin/totemMullYPlugin.cpp b/browser-plugin/totemMullYPlugin.cpp new file mode 100644 index 00000000..2efd1de9 --- /dev/null +++ b/browser-plugin/totemMullYPlugin.cpp @@ -0,0 +1,200 @@ +/* Totem MullY Plugin + * + * Copyright (C) 2004 Bastien Nocera <hadess@hadess.net> + * Copyright (C) 2002 David A. Schleef <ds@schleef.org> + * Copyright (C) 2006 Christian Persch + * + * 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. + * + * $Id$ + */ + +#include <mozilla-config.h> +#include "config.h" + +#include <glib.h> + +#include <nsIProgrammingLanguage.h> +#include <nsISupportsImpl.h> +#include <nsMemory.h> +#include <nsXPCOM.h> + +#include "totemIMullYPlayer.h" + +#include "totemMullYPlugin.h" + +/* 67DABFBF-D0AB-41fa-9C46-CC0F21721616 */ +static const nsCID kClassID = + { 0x67dabfbf, 0xd0ab, 0x41fa, + { 0x9c, 0x46, 0xcc, 0x0f, 0x21, 0x72, 0x16, 0x16 } }; + +static const char kClassDescription[] = "totemMullYPlugin"; +static const char kPluginDescription[] = "DivX\xC2\xAE Web Player"; + +static const totemPluginMimeEntry kMimeTypes[] = { + { "video/divx", "divx", "video/x-msvideo" }, +}; + +totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin) + : mPlugin(aPlugin) +{ + g_print ("%s ctor [%p]\n", kClassDescription, (void*) this); +} + +totemScriptablePlugin::~totemScriptablePlugin () +{ + g_print ("%s dtor [%p]\n", kClassDescription, (void*) this); +} + +/* static */ char * +totemScriptablePlugin::PluginDescription () +{ + return (char*) kPluginDescription; +} + +/* static */ void +totemScriptablePlugin::PluginMimeTypes (const totemPluginMimeEntry **_entries, + PRUint32 *_count) +{ + *_entries = kMimeTypes; + *_count = G_N_ELEMENTS (kMimeTypes); +} + +/* Interface implementations */ + +NS_IMPL_ISUPPORTS2 (totemScriptablePlugin, + totemIMullYPlayer, + nsIClassInfo) + +/* nsIClassInfo */ + +NS_IMETHODIMP +totemScriptablePlugin::GetFlags (PRUint32 *aFlags) +{ + *aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT; + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::GetImplementationLanguage (PRUint32 *aImplementationLanguage) +{ + *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::GetInterfaces (PRUint32 *count, + nsIID * **array) +{ + *array = NS_STATIC_CAST (nsIID**, nsMemory::Alloc (sizeof (nsIID))); + if (!*array) + return NS_ERROR_OUT_OF_MEMORY; + + *count = 1; + + (*array)[0] = NS_STATIC_CAST (nsIID*, + nsMemory::Clone (&NS_GET_IID (totemIMullYPlayer), + sizeof(nsIID))); + if (!(*array)[0]) { + NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY (0, *array); + return NS_ERROR_OUT_OF_MEMORY; + } + + g_message ("GetInterfaces"); + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::GetHelperForLanguage (PRUint32 language, + nsISupports **_retval) +{ + *_retval = nsnull; + g_message ("GetHelperForLanguage %d", language); + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::GetContractID (char * *aContractID) +{ + *aContractID = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::GetClassDescription (char * *aClassDescription) +{ + *aClassDescription = NS_STATIC_CAST (char*, + nsMemory::Clone (kClassDescription, + sizeof (kClassDescription))); + if (!*aClassDescription) + return NS_ERROR_OUT_OF_MEMORY; + + g_message ("GetClassDescription: %s", *aClassDescription); + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::GetClassID (nsCID * *aClassID) +{ + *aClassID = NS_STATIC_CAST (nsCID*, + nsMemory::Clone (&kClassID, + sizeof (nsCID*))); + if (!*aClassID) + return NS_ERROR_OUT_OF_MEMORY; + + g_message ("GetClassID"); + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::GetClassIDNoAlloc (nsCID *aClassIDNoAlloc) +{ + *aClassIDNoAlloc = kClassID; + g_message ("GetClassIDNoAlloc"); + return NS_OK; +} + +/* totemIMullYPlayer */ + +NS_IMETHODIMP +totemScriptablePlugin::Rewind () +{ + NS_ENSURE_STATE (mPlugin); + + totem_plugin_pause (mPlugin); + + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::Play () +{ + NS_ENSURE_STATE (mPlugin); + + totem_plugin_play (mPlugin); + + return NS_OK; +} + +NS_IMETHODIMP +totemScriptablePlugin::Stop () +{ + NS_ENSURE_STATE (mPlugin); + + totem_plugin_stop (mPlugin); + + return NS_OK; +} diff --git a/browser-plugin/totemMullYPlugin.h b/browser-plugin/totemMullYPlugin.h new file mode 100644 index 00000000..8117531f --- /dev/null +++ b/browser-plugin/totemMullYPlugin.h @@ -0,0 +1,54 @@ +/* Totem MullY 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. + * + * $Id$ + */ + +#ifndef __MULLY_PLAYER_H__ +#define __MULLY_PLAYER_H__ + +#include <nsIClassInfo.h> + +#include "totemIMullYPlayer.h" + +#include "totemPlugin.h" + +class totemScriptablePlugin : public totemIMullYPlayer, + public nsIClassInfo +{ + public: + NS_DECL_ISUPPORTS + NS_DECL_TOTEMIMULLYPLAYER + NS_DECL_NSICLASSINFO + + totemScriptablePlugin (totemPlugin *aPlugin); + + PRBool IsValid () { return mPlugin != nsnull; } + void UnsetPlugin () { mPlugin = nsnull; } + + static char *PluginDescription (); + static void PluginMimeTypes (const totemPluginMimeEntry **, PRUint32 *); + private: + ~totemScriptablePlugin (); + + totemPlugin *mPlugin; +}; + +#endif /* __MULLY_PLAYER_H__ */ diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp index 88e15d01..6640b1bb 100644 --- a/browser-plugin/totemPlugin.cpp +++ b/browser-plugin/totemPlugin.cpp @@ -61,6 +61,8 @@ #include "totemComplexPlugin.h" #elif defined(TOTEM_NARROWSPACE_PLUGIN) #include "totemNarrowSpacePlugin.h" +#elif defined(TOTEM_MULLY_PLUGIN) +#include "totemMullYPlugin.h" #else #error Unknown plugin type #endif diff --git a/configure.in b/configure.in index e03b5e2c..7b7ff050 100644 --- a/configure.in +++ b/configure.in @@ -451,12 +451,19 @@ AC_ARG_ENABLE([narrowspace-plugin], [],[enable_narrowspace_plugin=yes]) AC_MSG_RESULT([$enable_narrowspace_plugin]) +AC_MSG_CHECKING([whether to enable the MullY browser plugin]) +AC_ARG_ENABLE([mully-plugin], + AS_HELP_STRING([--enable-mully-plugin],[Whether to enable the MullY browser plugin]), + [],[enable_mully_plugin=yes]) +AC_MSG_RESULT([$enable_mully_plugin]) + fi AM_CONDITIONAL([ENABLE_BASIC_PLUGIN],[test "$enable_basic_plugin" = "yes"]) AM_CONDITIONAL([ENABLE_GMP_PLUGIN],[test "$enable_gmp_plugin" = "yes"]) AM_CONDITIONAL([ENABLE_COMPLEX_PLUGIN],[test "$enable_complex_plugin" = "yes"]) AM_CONDITIONAL([ENABLE_NARROWSPACE_PLUGIN],[test "$enable_narrowspace_plugin" = "yes"]) +AM_CONDITIONAL([ENABLE_MULLY_PLUGIN],[test "$enable_mully_plugin" = "yes"]) dnl ******** dnl Nautilus |