bool totemConePlaylistItems::InvokeByIndex (int aIndex, const NPVariant *argv, uint32_t argc, NPVariant *_result) { TOTEM_LOG_INVOKE (aIndex, totemConePlaylistItems); switch (Methods (aIndex)) { case eClear: Plugin()->ClearPlaylist (); return VoidVariant (_result); } return false; }
bool xplayerConeVideo::GetPropertyByIndex (int aIndex, NPVariant *_result) { XPLAYER_LOG_GETTER (aIndex, xplayerConeVideo); switch (Properties (aIndex)) { case eFullscreen: return BoolVariant (_result, Plugin()->IsFullscreen()); case eAspectRatio: case eHeight: case eSubtitle: case eTeletext: case eWidth: XPLAYER_WARN_GETTER_UNIMPLEMENTED (aIndex, _result); return VoidVariant (_result); } return false; }
bool idolConeAudio::GetPropertyByIndex (int aIndex, NPVariant *_result) { IDOL_LOG_GETTER (aIndex, idolConeAudio); switch (Properties (aIndex)) { case eMute: return BoolVariant (_result, Plugin()->IsMute()); case eVolume: return Int32Variant (_result, Plugin()->Volume() * 200.0); case eChannel: case eTrack: IDOL_WARN_GETTER_UNIMPLEMENTED (aIndex, _result); return VoidVariant (_result); } return false; }
bool xplayerConeVideo::InvokeByIndex (int aIndex, const NPVariant *argv, uint32_t argc, NPVariant *_result) { XPLAYER_LOG_INVOKE (aIndex, xplayerConeVideo); switch (Methods (aIndex)) { case eToggleFullscreen: { /* FIXMEchpe this sucks */ NPVariant fullscreen; BOOLEAN_TO_NPVARIANT (!Plugin()->IsFullscreen(), fullscreen); return SetPropertyByIndex (eFullscreen, &fullscreen); } case eToggleTeletext: XPLAYER_WARN_INVOKE_UNIMPLEMENTED (aIndex, xplayerConeVideo); return VoidVariant (_result); } return false; }
bool xplayerGMPPlayer::GetPropertyByIndex (int aIndex, NPVariant *_result) { XPLAYER_LOG_GETTER (aIndex, xplayerGMPPlayer); switch (Properties (aIndex)) { case eControls: /* readonly attribute xplayerIGMPControls controls; */ return ObjectVariant (_result, Plugin()->GetNPObject (xplayerPlugin::eGMPControls)); case eNetwork: /* readonly attribute xplayerIGMPNetwork network; */ return ObjectVariant (_result, Plugin()->GetNPObject (xplayerPlugin::eGMPNetwork)); case eSettings: /* readonly attribute xplayerIGMPSettings settings; */ return ObjectVariant (_result, Plugin()->GetNPObject (xplayerPlugin::eGMPSettings)); case eVersionInfo: /* readonly attribute ACString versionInfo; */ return StringVariant (_result, XPLAYER_GMP_VERSION_BUILD); case eFullScreen: /* attribute boolean fullScreen; */ return BoolVariant (_result, Plugin()->IsFullscreen()); case eWindowlessVideo: /* attribute boolean windowlessVideo; */ return BoolVariant (_result, Plugin()->IsWindowless()); case eIsOnline: /* readonly attribute boolean isOnline; */ XPLAYER_WARN_1_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return BoolVariant (_result, true); case eEnableContextMenu: /* attribute boolean enableContextMenu; */ return BoolVariant (_result, Plugin()->AllowContextMenu()); case eClosedCaption: /* readonly attribute xplayerIGMPClosedCaption closedCaption; */ case eCurrentMedia: /* attribute xplayerIGMPMedia currentMedia; */ case eCurrentPlaylist: /* attribute xplayerIGMPPlaylist currentPlaylist; */ case eError: /* readonly attribute xplayerIGMPError error; */ XPLAYER_WARN_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return NullVariant (_result); case eStatus: /* readonly attribute AUTF8String status; */ XPLAYER_WARN_1_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return StringVariant (_result, "OK"); case eURL: /* attribute AUTF8String URL; */ XPLAYER_WARN_1_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return StringVariant (_result, Plugin()->Src()); /* FIXMEchpe use URL()? */ case eEnabled: /* attribute boolean enabled; */ XPLAYER_WARN_1_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return BoolVariant (_result, true); case eOpenState: /* readonly attribute long openState; */ XPLAYER_WARN_1_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return Int32Variant (_result, 0); case ePlayState: /* readonly attribute long playState; */ return Int32Variant (_result, mPluginState); case eStretchToFit: /* attribute boolean stretchToFit; */ XPLAYER_WARN_1_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return BoolVariant (_result, false); case eUiMode: /* attribute ACString uiMode; */ XPLAYER_WARN_1_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPPlayer); return VoidVariant (_result); case eCdromCollection: /* readonly attribute xplayerIGMPCdromCollection cdromCollection; */ case eDvd: /* readonly attribute xplayerIGMPDVD dvd; */ case eMediaCollection: /* readonly attribute xplayerIGMPMediaCollection mediaCollection; */ case ePlayerApplication: /* readonly attribute xplayerIGMPPlayerApplication playerApplication; */ case ePlaylistCollection: /* readonly attribute xplayerIGMPPlaylistCollection playlistCollection; */ case eIsRemote: /* readonly attribute boolean isRemote; */ return ThrowSecurityError (); } return false; }
bool xplayerGMPControls::InvokeByIndex (int aIndex, const NPVariant *argv, uint32_t argc, NPVariant *_result) { XPLAYER_LOG_INVOKE (aIndex, xplayerGMPControls); switch (Methods (aIndex)) { case ePause: /* void pause (); */ Plugin()->Command (XPLAYER_COMMAND_PAUSE); return VoidVariant (_result); case ePlay: /* void play (); */ Plugin()->Command (XPLAYER_COMMAND_PLAY); return VoidVariant (_result); case eStop: /* void stop (); */ Plugin()->Command (XPLAYER_COMMAND_PAUSE); return VoidVariant (_result); case eGetAudioLanguageDescription: /* AUTF8String getAudioLanguageDescription (in long index); */ XPLAYER_WARN_1_INVOKE_UNIMPLEMENTED (aIndex,xplayerGMPControls); return StringVariant (_result, "English"); case eGetLanguageName: /* AUTF8String getLanguageName (in long LCID); */ XPLAYER_WARN_1_INVOKE_UNIMPLEMENTED (aIndex,xplayerGMPControls); return StringVariant (_result, "English"); case eIsAvailable: /* boolean isAvailable (in ACString name); */ NPString name; if (!GetNPStringFromArguments (argv, argc, 0, name)) return false; if (g_ascii_strncasecmp (name.UTF8Characters, "currentItem", name.UTF8Length) == 0 || g_ascii_strncasecmp (name.UTF8Characters, "next", name.UTF8Length) == 0 || g_ascii_strncasecmp (name.UTF8Characters, "pause", name.UTF8Length) == 0 || g_ascii_strncasecmp (name.UTF8Characters, "play", name.UTF8Length) == 0 || g_ascii_strncasecmp (name.UTF8Characters, "previous", name.UTF8Length) == 0 || g_ascii_strncasecmp (name.UTF8Characters, "stop", name.UTF8Length) == 0) return BoolVariant (_result, true); return BoolVariant (_result, false); case eFastForward: /* void fastForward (); */ case eFastReverse: /* void fastReverse (); */ case eGetAudioLanguageID: /* long getAudioLanguageID (in long index); */ case eNext: /* void next (); */ case ePlayItem: /* void playItem (in xplayerIGMPMedia theMediaItem); */ case ePrevious: /* void previous (); */ case eStep: /* void step (in long frameCount); */ XPLAYER_WARN_INVOKE_UNIMPLEMENTED (aIndex,xplayerGMPControls); return VoidVariant (_result); } return false; }
bool xplayerMullYPlayer::InvokeByIndex (int aIndex, const NPVariant *argv, uint32_t argc, NPVariant *_result) { XPLAYER_LOG_INVOKE (aIndex, xplayerMullYPlayer); switch (Methods (aIndex)) { case eGetVersion: return StringVariant (_result, XPLAYER_MULLY_VERSION); case ePlay: Plugin()->Command (XPLAYER_COMMAND_PLAY); return VoidVariant (_result); case ePause: Plugin()->Command (XPLAYER_COMMAND_PAUSE); return VoidVariant (_result); case eStop: Plugin()->Command (XPLAYER_COMMAND_STOP); return VoidVariant (_result); case eSetVolume: { // FIXMEchpe where's getVolume? break; } case eMute: Plugin()->SetMute (true); return VoidVariant (_result); case eUnMute: Plugin()->SetMute (false); return VoidVariant (_result); case eSetMinVersion: case eSetMode: case eSetAllowContextMenu: case eSetAutoPlay: case eSetLoop: case eSetBufferingMode: case eSetBannerEnabled: case eSetMovieTitle: case eSetPreviewImage: case eSetPreviewMessage: case eSetPreviewMessageFontSize: case eOpen: case eStepForward: case eStepBackward: case eFF: case eRW: case eSeek: case eResize: case eGetTotalTime: case eGetVideoWidth: case eGetVideoHeight: case eGetTotalVideoFrames: case eGetVideoFramerate: case eGetNumberOfAudioTracks: case eGetNumberOfSubtitleTracks: case eGetAudioTrackLanguage: case eGetSubtitleTrackLanguage: case eGetAudioTrackName: case eGetSubtitleTrackName: case eGetCurrentAudioTrack: case eGetCurrentSubtitleTrack: case eSetCurrentAudioTrack: case eSetCurrentSubtitleTrack: XPLAYER_WARN_INVOKE_UNIMPLEMENTED (aIndex, xplayerMullYPlayer); return VoidVariant (_result); case eGoEmbedded: case eGoWindowed: case eGoFullscreen: case eAbout: case eShowPreferences: case eShowContextMenu: /* We don't allow the page's JS to do this. Don't throw though, just silently do nothing. */ return VoidVariant (_result); } return false; }
bool totemConePlaylist::InvokeByIndex (int aIndex, const NPVariant *argv, uint32_t argc, NPVariant *_result) { TOTEM_LOG_INVOKE (aIndex, totemConePlaylist); switch (Methods (aIndex)) { case eAdd: { /* long add (in AUTF8String MRL, [in AUTF8String name, in AUTF8String options]); */ if (!CheckArgc (argc, 1, 3)) return false; NPString mrl; if (!GetNPStringFromArguments (argv, argc, 0, mrl)) return false; NPString title; if (argc != 3 || !GetNPStringFromArguments (argv, argc, 1, title)) title.UTF8Characters = NULL; NPString options; if (argc != 3 || !GetNPStringFromArguments (argv, argc, 2, options)) options.UTF8Characters = NULL; //FIXME handle options as array //http://wiki.videolan.org/Documentation:WebPlugin#Playlist_object char *subtitle = NULL; if (options.UTF8Characters && options.UTF8Length) { char *str, **items; guint i; str = g_strndup (options.UTF8Characters, options.UTF8Length); items = g_strsplit (str, " ", -1); g_free (str); for (i = 0; items[i] != NULL; i++) { if (g_str_has_prefix (items[i], ":sub-file=")) { subtitle = g_strdup (items[i] + strlen (":sub-file=")); break; } } g_strfreev (items); } Plugin()->AddItem (mrl, title, subtitle); g_free (subtitle); //FIXME we're supposed to return a unique number here return Int32Variant (_result, 1); } case ePlay: Plugin()->Command (TOTEM_COMMAND_PLAY); return VoidVariant (_result); case eStop: Plugin()->Command (TOTEM_COMMAND_STOP); return VoidVariant (_result); case eTogglePause: if (Plugin()->State() == TOTEM_STATE_PLAYING) { Plugin()->Command (TOTEM_COMMAND_PAUSE); } else if (Plugin()->State() == TOTEM_STATE_PAUSED) { Plugin()->Command (TOTEM_COMMAND_PLAY); } return VoidVariant (_result); case eNext: case ePlayItem: case ePrev: case eRemoveItem: TOTEM_WARN_INVOKE_UNIMPLEMENTED (aIndex, totemConePlaylist); return VoidVariant (_result); } return false; }