diff options
author | Christian Persch <chpe@svn.gnome.org> | 2007-02-19 16:01:17 +0000 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2007-02-19 16:01:17 +0000 |
commit | 922ee73706cfca09440e7acdd44ef9d0c31d5029 (patch) | |
tree | 6c96ad91e3217064bc1dab9bb4ca1fddc4c1639b | |
parent | 40fa40fb8d8cd4847181eec72c894b3ee5203c75 (diff) | |
download | totem-922ee73706cfca09440e7acdd44ef9d0c31d5029.tar.gz |
Also allow "-1" for boolean values, and semi-implement a few bits of the
2007-02-19 Christian Persch <chpe@svn.gnome.org>
* browser-plugin/totemGMPPlugin.cpp:
* browser-plugin/totemGMPPlugin.h:
* browser-plugin/totemPlugin.cpp:
* browser-plugin/totemPlugin.h: Also allow "-1" for boolean values,
and semi-implement a few bits of the JS interfaces. Should get us a
bit closer to support webtv.tv2.no; bug #355881.
svn path=/trunk/; revision=4052
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | browser-plugin/totemGMPPlugin.cpp | 23 | ||||
-rw-r--r-- | browser-plugin/totemGMPPlugin.h | 2 | ||||
-rw-r--r-- | browser-plugin/totemPlugin.cpp | 30 | ||||
-rw-r--r-- | browser-plugin/totemPlugin.h | 1 |
5 files changed, 48 insertions, 17 deletions
@@ -1,3 +1,12 @@ +2007-02-19 Christian Persch <chpe@svn.gnome.org> + + * browser-plugin/totemGMPPlugin.cpp: + * browser-plugin/totemGMPPlugin.h: + * browser-plugin/totemPlugin.cpp: + * browser-plugin/totemPlugin.h: Also allow "-1" for boolean values, + and semi-implement a few bits of the JS interfaces. Should get us a + bit closer to support webtv.tv2.no; bug #355881. + 2007-02-19 Tim-Philipp Müller <tim at centricular dot net> * configure.in: diff --git a/browser-plugin/totemGMPPlugin.cpp b/browser-plugin/totemGMPPlugin.cpp index ed140b388..3461c124c 100644 --- a/browser-plugin/totemGMPPlugin.cpp +++ b/browser-plugin/totemGMPPlugin.cpp @@ -48,6 +48,9 @@ #include "totemGMPPlugin.h" +/* FIXME */ +#define TOTEM_GMP_VERSION_BUILD "11.0.0.1024" + /* 89cf81a7-1156-456f-b060-c2187df9a27c */ static const nsCID kClassID = { 0x89cf81a7, 0x1156, 0x456f, @@ -356,7 +359,9 @@ totemScriptablePlugin::GetStatus(nsACString & aStatus) { TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED (); - return NS_ERROR_NOT_IMPLEMENTED; + /* FIXME */ + aStatus.Assign ("OK"); + return NS_OK; } /* attribute boolean stretchToFit; */ @@ -414,9 +419,8 @@ totemScriptablePlugin::SetURL(const nsACString & aURL) NS_IMETHODIMP totemScriptablePlugin::GetVersionInfo(nsACString & aVersionInfo) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED (); - - return NS_ERROR_NOT_IMPLEMENTED; + aVersionInfo.Assign (TOTEM_GMP_VERSION_BUILD); + return NS_OK; } /* attribute boolean windowlessVideo; */ @@ -425,7 +429,8 @@ totemScriptablePlugin::GetWindowlessVideo(PRBool *aWindowlessVideo) { TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED (); - return NS_ERROR_NOT_IMPLEMENTED; + *aWindowlessVideo = mWindowlessVideo; + return NS_OK; } NS_IMETHODIMP @@ -433,7 +438,8 @@ totemScriptablePlugin::SetWindowlessVideo(PRBool aWindowlessVideo) { TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED (); - return NS_ERROR_NOT_IMPLEMENTED; + mWindowlessVideo = aWindowlessVideo != PR_FALSE; + return NS_OK; } /* void close (); */ @@ -570,7 +576,8 @@ totemScriptablePlugin::GetCurrentPosition(double *aCurrentPosition) { TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED (); - return NS_ERROR_NOT_IMPLEMENTED; + *aCurrentPosition = 0.0; + return NS_OK; } NS_IMETHODIMP @@ -578,7 +585,7 @@ totemScriptablePlugin::SetCurrentPosition(double aCurrentPosition) { TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED (); - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* readonly attribute ACString currentPositionString; */ diff --git a/browser-plugin/totemGMPPlugin.h b/browser-plugin/totemGMPPlugin.h index 4a386ef6b..087caae8e 100644 --- a/browser-plugin/totemGMPPlugin.h +++ b/browser-plugin/totemGMPPlugin.h @@ -61,6 +61,8 @@ class totemScriptablePlugin : public totemIGMPPlayer, totemPlugin *mPlugin; totemGMPSettings *mSettingsTearOff; + + PRUint32 mWindowlessVideo; }; #endif /* __GMP_PLAYER_H__ */ diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp index ba4070500..9785f2f2c 100644 --- a/browser-plugin/totemPlugin.cpp +++ b/browser-plugin/totemPlugin.cpp @@ -2,7 +2,7 @@ * * Copyright © 2004-2006 Bastien Nocera <hadess@hadess.net> * Copyright © 2002 David A. Schleef <ds@schleef.org> - * Copyright © 2006 Christian Persch + * Copyright © 2006, 2007 Christian Persch * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -1075,13 +1075,18 @@ totemPlugin::ParseBoolean (const char *key, { if (value == NULL || strcmp (value, "") == 0) return default_val; - if (g_ascii_strcasecmp (value, "false") == 0 - || g_ascii_strcasecmp (value, "0") == 0) + if (g_ascii_strcasecmp (value, "false") == 0) return PR_FALSE; - if (g_ascii_strcasecmp (value, "true") == 0 - || g_ascii_strcasecmp (value, "1") == 0) + if (g_ascii_strcasecmp (value, "true") == 0) return PR_TRUE; + char *endptr = NULL; + errno = 0; + long num = g_ascii_strtoll (value, &endptr, 0); + if (!endptr && errno == 0) { + return num > 0; + } + D ("Unknown value '%s' for parameter '%s'", value, key); return default_val; @@ -1636,14 +1641,19 @@ totemPlugin::Init (NPMIMEType mimetype, D ("Real mimetype for '%s' is '%s'", mimetype, mMimeType.get()); /* Now parse the attributes */ + /* Note: argv[i] is NULL for the "PARAM" arg which separates the attributes + * of an <object> tag from the <param> values under it. + */ GHashTable *args = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free); for (int16_t i = 0; i < argc; i++) { - printf ("argv[%d] %s %s\n", i, argn[i], argv[i]); - g_hash_table_insert (args, g_ascii_strdown (argn[i], -1), - g_strdup (argv[i])); + printf ("argv[%d] %s %s\n", i, argn[i], argv[i] ? argv[i] : ""); + if (argv[i]) { + g_hash_table_insert (args, g_ascii_strdown (argn[i], -1), + g_strdup (argv[i])); + } } const char *value; @@ -1763,6 +1773,8 @@ totemPlugin::Init (NPMIMEType mimetype, mControllerHidden = !GetBooleanValue (args, "controller", PR_TRUE); + mAutoPlay = GetBooleanValue (args, "autoplay", PR_TRUE); + #endif /* TOTEM_NARROWSPACE_PLUGIN */ #if defined(TOTEM_COMPLEX_PLUGIN) && defined(HAVE_NSTARRAY_H) @@ -1837,7 +1849,7 @@ totemPlugin::Init (NPMIMEType mimetype, #ifdef TOTEM_NARROWSPACE_PLUGIN /* We need to autostart if we're using an HREF * otherwise the start image isn't shown */ - if (!mHref.Equals (NS_LITERAL_CSTRING (""))) { + if (!mHref.IsEmpty ()) { mExpectingStream = PR_TRUE; mAutostart = PR_TRUE; } diff --git a/browser-plugin/totemPlugin.h b/browser-plugin/totemPlugin.h index 4167ffde4..855062512 100644 --- a/browser-plugin/totemPlugin.h +++ b/browser-plugin/totemPlugin.h @@ -253,6 +253,7 @@ class totemPlugin { private: PRUint32 mAutostart : 1; + PRUint32 mAutoPlay : 1; PRUint32 mCache : 1; PRUint32 mCheckedForPlaylist : 1; PRUint32 mControllerHidden : 1; |