totem r5577 - in trunk: . browser-plugin
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5577 - in trunk: . browser-plugin
- Date: Tue, 19 Aug 2008 15:22:34 +0000 (UTC)
Author: hadess
Date: Tue Aug 19 15:22:34 2008
New Revision: 5577
URL: http://svn.gnome.org/viewvc/totem?rev=5577&view=rev
Log:
2008-08-19 Bastien Nocera <hadess hadess net>
* browser-plugin/totemGMPControls.cpp:
* browser-plugin/totemGMPPlayer.cpp:
* browser-plugin/totemGMPPlayer.h:
* browser-plugin/totemPlugin.cpp: Add support for Player.playState
and Controls.isAvailable in the GMP plugin (Helps: #547659)
Modified:
trunk/ChangeLog
trunk/browser-plugin/totemGMPControls.cpp
trunk/browser-plugin/totemGMPPlayer.cpp
trunk/browser-plugin/totemGMPPlayer.h
trunk/browser-plugin/totemPlugin.cpp
Modified: trunk/browser-plugin/totemGMPControls.cpp
==============================================================================
--- trunk/browser-plugin/totemGMPControls.cpp (original)
+++ trunk/browser-plugin/totemGMPControls.cpp Tue Aug 19 15:22:34 2008
@@ -108,8 +108,18 @@
case eIsAvailable:
/* boolean isAvailable (in ACString name); */
- TOTEM_WARN_1_INVOKE_UNIMPLEMENTED (aIndex,totemGMPControls);
- return BoolVariant (_result, true);
+ const char *name;
+ TOTEM_LOG_INVOKE (aIndex,totemGMPControls);
+ if (!GetStringFromArguments (argv, argc, 0, name))
+ return false;
+ if (strcasecmp (name, "currentItem") == 0
+ || strcasecmp (name, "next") == 0
+ || strcasecmp (name, "pause") == 0
+ || strcasecmp (name, "play") == 0
+ || strcasecmp (name, "previous") == 0
+ || strcasecmp (name, "stop") == 0)
+ return BoolVariant (_result, true);
+ return BoolVariant (_result, false);
case eFastForward:
/* void fastForward (); */
Modified: trunk/browser-plugin/totemGMPPlayer.cpp
==============================================================================
--- trunk/browser-plugin/totemGMPPlayer.cpp (original)
+++ trunk/browser-plugin/totemGMPPlayer.cpp Tue Aug 19 15:22:34 2008
@@ -184,8 +184,8 @@
case ePlayState:
/* readonly attribute long playState; */
- TOTEM_WARN_1_GETTER_UNIMPLEMENTED (aIndex, totemGMPPlayer);
- return Int32Variant (_result, 0);
+ TOTEM_LOG_INVOKE (aIndex,totemGMPPlayer);
+ return Int32Variant (_result, mPluginState);
case eStretchToFit:
/* attribute boolean stretchToFit; */
Modified: trunk/browser-plugin/totemGMPPlayer.h
==============================================================================
--- trunk/browser-plugin/totemGMPPlayer.h (original)
+++ trunk/browser-plugin/totemGMPPlayer.h Tue Aug 19 15:22:34 2008
@@ -34,6 +34,23 @@
totemGMPPlayer (NPP);
virtual ~totemGMPPlayer ();
+ enum PluginState {
+ eState_Undefined,
+ eState_Stopped,
+ eState_Paused,
+ eState_Playing,
+ eState_ScanForward,
+ eState_ScanReverse,
+ eState_Buffering,
+ eState_Waiting,
+ eState_MediaEnded,
+ eState_Transitioning,
+ eState_Ready,
+ eState_Reconnecting
+ };
+
+ PluginState mPluginState;
+
private:
enum Methods {
Modified: trunk/browser-plugin/totemPlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemPlugin.cpp (original)
+++ trunk/browser-plugin/totemPlugin.cpp Tue Aug 19 15:22:34 2008
@@ -1055,6 +1055,13 @@
scriptable->mPluginState = totemNarrowSpacePlayer::eState_Playable;
}
#endif /* TOTEM_NARROWSPACE_PLUGIN */
+#ifdef TOTEM_GMP_PLUGIN
+ if (!mNPObjects[ePluginScriptable].IsNull ()) {
+ NPObject *object = mNPObjects[ePluginScriptable];
+ totemGMPPlayer *scriptable = static_cast<totemGMPPlayer*>(object);
+ scriptable->mPluginState = totemGMPPlayer::eState_Waiting;
+ }
+#endif /* TOTEM_GMP_PLUGIN */
}
void
@@ -1082,6 +1089,13 @@
scriptable->mPluginState = totemNarrowSpacePlayer::eState_Waiting;
}
#endif /* TOTEM_NARROWSPACE_PLUGIN */
+#ifdef TOTEM_GMP_PLUGIN
+ if (!mNPObjects[ePluginScriptable].IsNull ()) {
+ NPObject *object = mNPObjects[ePluginScriptable];
+ totemGMPPlayer *scriptable = static_cast<totemGMPPlayer*>(object);
+ scriptable->mPluginState = totemGMPPlayer::eState_MediaEnded;
+ }
+#endif /* TOTEM_GMP_PLUGIN */
}
/* Callbacks */
@@ -1165,6 +1179,26 @@
plugin->mTime = aTime;
plugin->mDuration = aDuration;
+
+#ifdef TOTEM_GMP_PLUGIN
+ if (!plugin->mNPObjects[ePluginScriptable].IsNull ()) {
+ NPObject *object = plugin->mNPObjects[ePluginScriptable];
+ totemGMPPlayer *scriptable = static_cast<totemGMPPlayer*>(object);
+ switch (plugin->mState) {
+ case TOTEM_STATE_PLAYING:
+ scriptable->mPluginState = totemGMPPlayer::eState_Playing;
+ break;
+ case TOTEM_STATE_PAUSED:
+ scriptable->mPluginState = totemGMPPlayer::eState_Paused;
+ break;
+ case TOTEM_STATE_STOPPED:
+ scriptable->mPluginState = totemGMPPlayer::eState_Stopped;
+ break;
+ default:
+ scriptable->mPluginState = totemGMPPlayer::eState_Undefined;
+ }
+ }
+#endif /* TOTEM_GMP_PLUGIN */
}
/* static */ void
@@ -1269,6 +1303,13 @@
scriptable->mPluginState = totemNarrowSpacePlayer::eState_Playable;
}
#endif /* TOTEM_NARROWSPACE_PLUGIN */
+#ifdef TOTEM_GMP_PLUGIN
+ if (!plugin->mNPObjects[ePluginScriptable].IsNull ()) {
+ NPObject *object = plugin->mNPObjects[ePluginScriptable];
+ totemGMPPlayer *scriptable = static_cast<totemGMPPlayer*>(object);
+ scriptable->mPluginState = totemGMPPlayer::eState_Waiting;
+ }
+#endif /* TOTEM_GMP_PLUGIN */
}
/* static */ void
@@ -1300,6 +1341,13 @@
scriptable->mPluginState = totemNarrowSpacePlayer::eState_Playable;
}
#endif /* TOTEM_NARROWSPACE_PLUGIN */
+#ifdef TOTEM_GMP_PLUGIN
+ if (!plugin->mNPObjects[ePluginScriptable].IsNull ()) {
+ NPObject *object = plugin->mNPObjects[ePluginScriptable];
+ totemGMPPlayer *scriptable = static_cast<totemGMPPlayer*>(object);
+ scriptable->mPluginState = totemGMPPlayer::eState_Ready;
+ }
+#endif /* TOTEM_GMP_PLUGIN */
/* FIXME this isn't the best way... */
if (plugin->mAutoPlay) {
@@ -2266,6 +2314,13 @@
scriptable->mPluginState = totemNarrowSpacePlayer::eState_Loading;
}
#endif /* TOTEM_NARROWSPACE_PLUGIN */
+#ifdef TOTEM_GMP_PLUGIN
+ if (!mNPObjects[ePluginScriptable].IsNull ()) {
+ NPObject *object = mNPObjects[ePluginScriptable];
+ totemGMPPlayer *scriptable = static_cast<totemGMPPlayer*>(object);
+ scriptable->mPluginState = totemGMPPlayer::eState_Buffering;
+ }
+#endif /* TOTEM_GMP_PLUGIN */
mStream = stream;
@@ -2482,6 +2537,13 @@
scriptable->mPluginState = totemNarrowSpacePlayer::eState_Complete;
}
#endif /* TOTEM_NARROWSPACE_PLUGIN */
+#ifdef TOTEM_GMP_PLUGIN
+ if (!mNPObjects[ePluginScriptable].IsNull ()) {
+ NPObject *object = mNPObjects[ePluginScriptable];
+ totemGMPPlayer *scriptable = static_cast<totemGMPPlayer*>(object);
+ scriptable->mPluginState = totemGMPPlayer::eState_Ready;
+ }
+#endif /* TOTEM_GMP_PLUGIN */
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]