17
17
* You should have received a copy of the GNU Library General Public
18
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
22
* $Id: totemBasicPlugin.cpp 5065 2008-02-04 14:32:50Z hadess $
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301 USA.
25
#include <mozilla-config.h>
30
#include <nsISupportsImpl.h>
33
#include <nsIProgrammingLanguage.h>
35
#define GNOME_ENABLE_DEBUG 1
36
/* define GNOME_ENABLE_DEBUG for more debug spew */
39
#include "totemClassInfo.h"
27
#include "totemPlugin.h"
41
28
#include "totemBasicPlugin.h"
43
/* 11ef8fce-9eb4-494e-804e-d56eae788625 */
44
static const nsCID kClassID =
45
{ 0x11ef8fce, 0x9eb4, 0x494e,
46
{ 0x80, 0x4e, 0xd5, 0x6e, 0xae, 0x78, 0x86, 0x25 } };
48
static const char kClassDescription[] = "totemBasicPlugin";
49
static const char kPluginDescription[] = "Totem Web Browser Plugin " VERSION;
51
static const totemPluginMimeEntry kMimeTypes[] = {
52
{ "application/x-ogg","ogg",NULL },
53
{ "application/ogg", "ogg", NULL },
54
{ "audio/ogg", "oga", NULL },
55
{ "audio/x-ogg", "ogg", NULL },
56
{ "video/ogg", "ogv", NULL },
57
{ "video/x-ogg", "ogg", NULL },
58
{ "application/annodex", "anx", NULL },
59
{ "audio/annodex", "axa", NULL },
60
{ "video/annodex", "axv", NULL },
61
{ "video/mpeg", "mpg, mpeg, mpe", NULL },
62
{ "audio/wav", "wav", NULL },
63
{ "audio/x-wav", "wav", NULL },
64
{ "audio/mpeg", "mp3", NULL },
65
{ "application/x-nsv-vp3-mp3", "nsv", "video/x-nsv" },
66
{ "video/flv", "flv", "application/x-flash-video" },
30
static const char *methodNames[] = {
69
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
72
D ("%s ctor [%p]", kClassDescription, (void*) this);
75
totemScriptablePlugin::~totemScriptablePlugin ()
77
D ("%s dtor [%p]", kClassDescription, (void*) this);
81
totemScriptablePlugin::PluginDescription ()
83
return (char*) kPluginDescription;
87
totemScriptablePlugin::PluginLongDescription ()
89
return (char*) totem_plugin_get_long_description();
93
totemScriptablePlugin::PluginMimeTypes (const totemPluginMimeEntry **_entries,
96
*_entries = kMimeTypes;
97
*_count = G_N_ELEMENTS (kMimeTypes);
100
/* Interface implementations */
102
NS_IMPL_ISUPPORTS2 (totemScriptablePlugin,
108
TOTEM_CLASSINFO_BEGIN (totemScriptablePlugin,
112
TOTEM_CLASSINFO_ENTRY (0, totemIBasicPlayer)
115
/* totemIBasicPlayer */
118
totemScriptablePlugin::Play ()
120
NS_ENSURE_STATE (IsValid ());
122
return mPlugin->DoCommand (TOTEM_COMMAND_PLAY);
126
totemScriptablePlugin::Rewind ()
128
NS_ENSURE_STATE (IsValid ());
130
return mPlugin->DoCommand (TOTEM_COMMAND_PAUSE);
134
totemScriptablePlugin::Stop ()
136
NS_ENSURE_STATE (IsValid ());
138
return mPlugin->DoCommand (TOTEM_COMMAND_STOP);
36
totemBasicPlayer::totemBasicPlayer (NPP aNPP)
37
: totemNPObject (aNPP)
42
totemBasicPlayer::~totemBasicPlayer ()
48
totemBasicPlayer::InvokeByIndex (int aIndex,
49
const NPVariant *argv,
53
TOTEM_LOG_INVOKE (aIndex, totemBasicPlayer);
55
VOID_TO_NPVARIANT (*_result);
57
switch (Methods (aIndex)) {
59
Plugin()->Command (TOTEM_COMMAND_PLAY);
60
return VoidVariant (_result);
63
Plugin()->Command (TOTEM_COMMAND_PAUSE);
64
return VoidVariant (_result);
67
Plugin()->Command (TOTEM_COMMAND_STOP);
68
return VoidVariant (_result);
74
/* totemBasicPlayerNPClass */
76
TOTEM_IMPLEMENT_NPCLASS (totemBasicPlayer,
78
methodNames, G_N_ELEMENTS (methodNames),