[totem] browser-plugin: Add new Vegas plugin
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] browser-plugin: Add new Vegas plugin
- Date: Sun, 4 Dec 2011 15:49:29 +0000 (UTC)
commit bd1d1eb17478eb5ad61909c4005258238f7953a0
Author: Bastien Nocera <hadess hadess net>
Date: Sun Dec 4 16:39:50 2011 +0100
browser-plugin: Add new Vegas plugin
Disabled by default.
This plugin uses totem-pl-parser's quvi front-end to grab
a real video URL for a particular embedded object.
This allows playback without Flash for a number of popular video
websites. Note that Totem doesn't contain any code specific to
particular websites, as all the work is done in quvi's scripts.
browser-plugin/Makefile.am | 21 +++++++++++++
browser-plugin/totem-plugin-viewer.c | 4 ++-
browser-plugin/totemPlugin.cpp | 30 +++++++++++++++++++
browser-plugin/totemVegasPlugin.cpp | 54 ++++++++++++++++++++++++++++++++++
browser-plugin/totemVegasPlugin.h | 48 ++++++++++++++++++++++++++++++
configure.in | 12 +++++++
6 files changed, 168 insertions(+), 1 deletions(-)
---
diff --git a/browser-plugin/Makefile.am b/browser-plugin/Makefile.am
index 39a10f4..dbaa3a4 100644
--- a/browser-plugin/Makefile.am
+++ b/browser-plugin/Makefile.am
@@ -173,6 +173,27 @@ libtotem_narrowspace_plugin_la_LIBADD = $(plugin_libadd)
libtotem_narrowspace_plugin_la_LDFLAGS = $(plugin_ldflags)
endif
+# Totem Vegas Plugin
+if ENABLE_VEGAS_PLUGIN
+plugin_LTLIBRARIES += libtotem-vegas-plugin.la
+
+libtotem_vegas_plugin_la_SOURCES = \
+ $(plugin_sources) \
+ totemVegasPlugin.cpp \
+ totemVegasPlugin.h
+
+libtotem_vegas_plugin_la_CPPFLAGS = \
+ -DXP_UNIX \
+ -DMOZ_X11 \
+ -DTOTEM_VEGAS_PLUGIN \
+ -DTOTEM_PL_PARSER_MINI \
+ $(AM_CPPFLAGS)
+
+libtotem_vegas_plugin_la_CXXFLAGS = $(plugin_cxxflags)
+libtotem_vegas_plugin_la_LIBADD = $(plugin_libadd)
+libtotem_vegas_plugin_la_LDFLAGS = $(plugin_ldflags)
+endif
+
# Totem MULLY Plugin
if ENABLE_MULLY_PLUGIN
plugin_LTLIBRARIES += libtotem-mully-plugin.la
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 793d8c8..9462cc9 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -78,6 +78,7 @@ typedef enum {
TOTEM_PLUGIN_TYPE_NARROWSPACE,
TOTEM_PLUGIN_TYPE_MULLY,
TOTEM_PLUGIN_TYPE_CONE,
+ TOTEM_PLUGIN_TYPE_VEGAS,
TOTEM_PLUGIN_TYPE_LAST
} TotemPluginType;
@@ -2175,7 +2176,8 @@ parse_plugin_type (const gchar *option_name,
"gmp",
"narrowspace",
"mully",
- "cone"
+ "cone",
+ "vegas"
};
TotemPluginType type;
diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp
index b385830..5545e73 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -74,6 +74,8 @@
#include "totemConePlaylist.h"
#include "totemConePlaylistItems.h"
#include "totemConeVideo.h"
+#elif defined(TOTEM_VEGAS_PLUGIN)
+#include "totemVegasPlugin.h"
#else
#error Unknown plugin type
#endif
@@ -105,6 +107,8 @@ static const totemPluginMimeEntry kMimeTypes[] = {
{ "image/x-quicktime", "pict, pict1, pict2", "image/x-pict" },
{ "video/x-m4v", "m4v", NULL },
{ "application/vnd.apple.mpegurl", "m3u8", NULL },
+#elif defined(TOTEM_VEGAS_PLUGIN)
+ { "application/x-shockwave-flash", "swf", "Shockwave Flash" },
#elif defined(TOTEM_MULLY_PLUGIN)
{ "video/divx", "divx", "video/x-msvideo" },
#elif defined(TOTEM_CONE_PLUGIN)
@@ -139,6 +143,8 @@ static const char kPluginDescription[] =
"Windows Media Player Plug-in 10 (compatible; Totem)";
#elif defined(TOTEM_NARROWSPACE_PLUGIN)
"QuickTime Plug-in " TOTEM_NARROWSPACE_VERSION;
+#elif defined(TOTEM_VEGAS_PLUGIN)
+ "Shockwave Flash";
#elif defined(TOTEM_MULLY_PLUGIN)
"DivX\xC2\xAE Web Player";
#elif defined(TOTEM_CONE_PLUGIN)
@@ -150,6 +156,8 @@ static const char kPluginDescription[] =
static const char kPluginLongDescription[] =
#if defined(TOTEM_MULLY_PLUGIN)
"DivX Web Player version " TOTEM_MULLY_VERSION;
+#elif defined(TOTEM_VEGAS_PLUGIN)
+ "Shockwave Flash 11.1 r102";
#else
"The <a href=\"http://www.gnome.org/projects/totem/\">Totem</a> " PACKAGE_VERSION " plugin handles video and audio streams.";
#endif
@@ -525,6 +533,8 @@ totemPlugin::ViewerFork ()
g_ptr_array_add (arr, g_strdup ("mully"));
#elif defined(TOTEM_CONE_PLUGIN)
g_ptr_array_add (arr, g_strdup ("cone"));
+#elif defined(TOTEM_VEGAS_PLUGIN)
+ g_ptr_array_add (arr, g_strdup ("vegas"));
#else
#error Unknown plugin type
#endif
@@ -2012,6 +2022,22 @@ totemPlugin::Init (NPMIMEType mimetype,
}
#endif /* TOTEM_CONE_PLUGIN */
+#ifdef TOTEM_VEGAS_PLUGIN
+ /* Never try to load the SWF file */
+ SetSrc ("");
+
+ if (totem_pl_parser_can_parse_from_uri (mDocumentURI, TRUE)) {
+ value = (const char *) g_hash_table_lookup (args, "flashvars");
+ if (value != NULL) {
+ TotemQueueCommand *cmd;
+ cmd = g_new0 (TotemQueueCommand, 1);
+ cmd->type = TOTEM_QUEUE_TYPE_SET_PLAYLIST;
+ cmd->string = g_strdup (mDocumentURI);
+ QueueCommand (cmd);
+ }
+ }
+#endif
+
#if 0 //def TOTEM_MULLY_PLUGIN
/* Click to play behaviour of the DivX plugin */
char *previewimage = (const char *) g_hash_table_lookup (args, "previewimage");
@@ -2544,6 +2570,8 @@ totemPlugin::GetNPObject (ObjectEnum which)
npclass = totemNarrowSpacePlayerNPClass::Instance();
#elif defined(TOTEM_MULLY_PLUGIN)
npclass = totemMullYPlayerNPClass::Instance();
+#elif defined(TOTEM_VEGAS_PLUGIN)
+ npclass = totemVegasPlayerNPClass::Instance();
#elif defined(TOTEM_CONE_PLUGIN)
switch (which) {
case ePluginScriptable:
@@ -2623,6 +2651,8 @@ totemPlugin::Shutdown ()
totemConePlaylistNPClass::Shutdown ();
totemConePlaylistItemsNPClass::Shutdown ();
totemConeVideoNPClass::Shutdown ();
+#elif defined(TOTEM_VEGAS_PLUGIN)
+ totemVegasPlayerNPClass::Shutdown ();
#else
#error Unknown plugin type
#endif
diff --git a/browser-plugin/totemVegasPlugin.cpp b/browser-plugin/totemVegasPlugin.cpp
new file mode 100644
index 0000000..14c772f
--- /dev/null
+++ b/browser-plugin/totemVegasPlugin.cpp
@@ -0,0 +1,54 @@
+/* Totem Vegas Plugin
+ *
+ * Copyright  2011 Bastien Nocera <hadess hadess net>
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+
+#include "totemPlugin.h"
+#include "totemVegasPlugin.h"
+
+static const char *methodNames[] = {
+};
+
+TOTEM_IMPLEMENT_NPCLASS (totemVegasPlayer,
+ NULL, 0,
+ methodNames, G_N_ELEMENTS (methodNames),
+ NULL);
+
+totemVegasPlayer::totemVegasPlayer (NPP aNPP)
+ : totemNPObject (aNPP)
+{
+ TOTEM_LOG_CTOR ();
+}
+
+totemVegasPlayer::~totemVegasPlayer ()
+{
+ TOTEM_LOG_DTOR ();
+}
+
+bool
+totemVegasPlayer::InvokeByIndex (int aIndex,
+ const NPVariant *argv,
+ uint32_t argc,
+ NPVariant *_result)
+{
+ TOTEM_LOG_INVOKE (aIndex, totemVegasPlayer);
+
+ return false;
+}
diff --git a/browser-plugin/totemVegasPlugin.h b/browser-plugin/totemVegasPlugin.h
new file mode 100644
index 0000000..65a8413
--- /dev/null
+++ b/browser-plugin/totemVegasPlugin.h
@@ -0,0 +1,48 @@
+/* Totem Vegas plugin scriptable
+ *
+ * Copyright  2011 Bastien Nocera <hadess hadess net>
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __VEGAS_PLUGIN_H__
+#define __VEGAS_PLUGIN_H__
+
+#include "totemNPClass.h"
+#include "totemNPObject.h"
+
+class totemVegasPlayer : public totemNPObject
+{
+ public:
+ totemVegasPlayer (NPP);
+ virtual ~totemVegasPlayer ();
+
+ enum PluginState {
+ };
+
+ PluginState mPluginState;
+
+ private:
+
+ enum Methods {
+ };
+
+ virtual bool InvokeByIndex (int aIndex, const NPVariant *argv, uint32_t argc, NPVariant *_result);
+};
+
+TOTEM_DEFINE_NPCLASS (totemVegasPlayer);
+
+#endif /* __VEGAS_PLUGIN_H__ */
diff --git a/configure.in b/configure.in
index 3459fa2..dc4acbf 100644
--- a/configure.in
+++ b/configure.in
@@ -621,12 +621,19 @@ AC_ARG_ENABLE([cone-plugin],
[],[enable_cone_plugin=yes])
AC_MSG_RESULT([$enable_cone_plugin])
+AC_MSG_CHECKING([whether to enable the Vegas browser plugin])
+AC_ARG_ENABLE([vegas-plugin],
+ AS_HELP_STRING([--enable-vegas-plugin],[Whether to enable the Vegas browser plugin]),
+ [enable_vegas_plugin=yes],[enable_vegas_plugin=no])
+AC_MSG_RESULT([$enable_vegas_plugin])
+
fi
AM_CONDITIONAL([ENABLE_GMP_PLUGIN],[test "$enable_gmp_plugin" = "yes"])
AM_CONDITIONAL([ENABLE_NARROWSPACE_PLUGIN],[test "$enable_narrowspace_plugin" = "yes"])
AM_CONDITIONAL([ENABLE_MULLY_PLUGIN],[test "$enable_mully_plugin" = "yes"])
AM_CONDITIONAL([ENABLE_CONE_PLUGIN],[test "$enable_cone_plugin" = "yes"])
+AM_CONDITIONAL([ENABLE_VEGAS_PLUGIN],[test "$enable_vegas_plugin" = "yes"])
dnl ********
dnl Nautilus
@@ -831,6 +838,11 @@ if test x$enable_browser_plugins = xyes ; then
else
AC_MSG_NOTICE([ Cone (VLC) plugin disabled])
fi
+ if test x$enable_vegas_plugin = xyes ; then
+ AC_MSG_NOTICE([** Vegas (Flash) plugin enabled])
+ else
+ AC_MSG_NOTICE([ Vegas (Flash) plugin disabled])
+ fi
else
AC_MSG_NOTICE([ Browser plugin disabled])
fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]