Пример #1
0
bool
xplayerGMPControls::GetPropertyByIndex (int aIndex,
                                      NPVariant *_result)
{
  XPLAYER_LOG_SETTER (aIndex, xplayerGMPControls);

  switch (Properties (aIndex)) {
    case eCurrentPosition:
      /* attribute double currentPosition; */
      return DoubleVariant (_result, double (Plugin()->GetTime()) / 1000.0);

    case eCurrentItem:
      /* attribute xplayerIGMPMedia currentItem; */
    case eCurrentPositionTimecode:
      /* attribute ACString currentPositionTimecode; */
    case eCurrentPositionString:
      /* readonly attribute ACString currentPositionString; */
      XPLAYER_WARN_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPControls);
      return StringVariant (_result, "");

    case eAudioLanguageCount:
      /* readonly attribute long audioLanguageCount; */
    case eCurrentAudioLanguage:
      /* attribute long currentAudioLanguage; */
    case eCurrentAudioLanguageIndex:
      /* attribute long currentAudioLanguageIndex; */
    case eCurrentMarker:
      /* attribute long currentMarker; */
      XPLAYER_WARN_GETTER_UNIMPLEMENTED (aIndex, xplayerGMPControls);
      return Int32Variant (_result, 0);
  }

  return false;
}
Пример #2
0
bool
totemConePlaylistItems::GetPropertyByIndex (int aIndex,
                                            NPVariant *_result)
{
  TOTEM_LOG_GETTER (aIndex, totemConePlaylistItems);

  switch (Properties (aIndex)) {
    case eCount:
      TOTEM_WARN_GETTER_UNIMPLEMENTED (aIndex, totemConePlaylistItems);
      return Int32Variant (_result, 1);
  }

  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;
}
Пример #4
0
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;
}
Пример #5
0
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;
}