3
* Copyright © 2004 Bastien Nocera <hadess@hadess.net>
4
* Copyright © 2002 David A. Schleef <ds@schleef.org>
5
* Copyright © 2006, 2008 Christian Persch
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301 USA.
29
#include "totemPlugin.h"
30
#include "totemGMPControls.h"
32
static const char *propertyNames[] = {
34
"currentAudioLanguage",
35
"currentAudioLanguageIndex",
39
"currentPositionString",
40
"currentPositionTimecode"
43
static const char *methodNames[] = {
46
"getAudioLanguageDescription",
59
TOTEM_IMPLEMENT_NPCLASS (totemGMPControls,
60
propertyNames, G_N_ELEMENTS (propertyNames),
61
methodNames, G_N_ELEMENTS (methodNames),
64
totemGMPControls::totemGMPControls (NPP aNPP)
65
: totemNPObject (aNPP)
70
totemGMPControls::~totemGMPControls ()
76
totemGMPControls::InvokeByIndex (int aIndex,
77
const NPVariant *argv,
81
TOTEM_LOG_INVOKE (aIndex, totemGMPControls);
83
switch (Methods (aIndex)) {
86
Plugin()->Command (TOTEM_COMMAND_PAUSE);
87
return VoidVariant (_result);
91
Plugin()->Command (TOTEM_COMMAND_PLAY);
92
return VoidVariant (_result);
96
Plugin()->Command (TOTEM_COMMAND_PAUSE);
97
return VoidVariant (_result);
99
case eGetAudioLanguageDescription:
100
/* AUTF8String getAudioLanguageDescription (in long index); */
101
TOTEM_WARN_1_INVOKE_UNIMPLEMENTED (aIndex,totemGMPControls);
102
return StringVariant (_result, "English");
104
case eGetLanguageName:
105
/* AUTF8String getLanguageName (in long LCID); */
106
TOTEM_WARN_1_INVOKE_UNIMPLEMENTED (aIndex,totemGMPControls);
107
return StringVariant (_result, "English");
110
/* boolean isAvailable (in ACString name); */
112
if (!GetStringFromArguments (argv, argc, 0, name))
114
if (g_ascii_strcasecmp (name, "currentItem") == 0
115
|| g_ascii_strcasecmp (name, "next") == 0
116
|| g_ascii_strcasecmp (name, "pause") == 0
117
|| g_ascii_strcasecmp (name, "play") == 0
118
|| g_ascii_strcasecmp (name, "previous") == 0
119
|| g_ascii_strcasecmp (name, "stop") == 0)
120
return BoolVariant (_result, true);
121
return BoolVariant (_result, false);
124
/* void fastForward (); */
126
/* void fastReverse (); */
127
case eGetAudioLanguageID:
128
/* long getAudioLanguageID (in long index); */
132
/* void playItem (in totemIGMPMedia theMediaItem); */
134
/* void previous (); */
136
/* void step (in long frameCount); */
137
TOTEM_WARN_INVOKE_UNIMPLEMENTED (aIndex,totemGMPControls);
138
return VoidVariant (_result);
145
totemGMPControls::GetPropertyByIndex (int aIndex,
148
TOTEM_LOG_SETTER (aIndex, totemGMPControls);
150
switch (Properties (aIndex)) {
151
case eCurrentPosition:
152
/* attribute double currentPosition; */
153
return DoubleVariant (_result, double (Plugin()->Time()) / 1000.0);
156
/* attribute totemIGMPMedia currentItem; */
157
case eCurrentPositionTimecode:
158
/* attribute ACString currentPositionTimecode; */
159
case eCurrentPositionString:
160
/* readonly attribute ACString currentPositionString; */
161
TOTEM_WARN_GETTER_UNIMPLEMENTED (aIndex, totemGMPControls);
162
return StringVariant (_result, "");
164
case eAudioLanguageCount:
165
/* readonly attribute long audioLanguageCount; */
166
case eCurrentAudioLanguage:
167
/* attribute long currentAudioLanguage; */
168
case eCurrentAudioLanguageIndex:
169
/* attribute long currentAudioLanguageIndex; */
171
/* attribute long currentMarker; */
172
TOTEM_WARN_GETTER_UNIMPLEMENTED (aIndex, totemGMPControls);
173
return Int32Variant (_result, 0);
180
totemGMPControls::SetPropertyByIndex (int aIndex,
181
const NPVariant *aValue)
183
TOTEM_LOG_SETTER (aIndex, totemGMPControls);
185
switch (Properties (aIndex)) {
186
case eCurrentAudioLanguage:
187
/* attribute long currentAudioLanguage; */
188
case eCurrentAudioLanguageIndex:
189
/* attribute long currentAudioLanguageIndex; */
191
/* attribute totemIGMPMedia currentItem; */
193
/* attribute long currentMarker; */
194
case eCurrentPosition:
195
/* attribute double currentPosition; */
196
case eCurrentPositionTimecode:
197
/* attribute ACString currentPositionTimecode; */
198
TOTEM_WARN_SETTER_UNIMPLEMENTED(aIndex, totemGMPControls);
201
case eAudioLanguageCount:
202
/* readonly attribute long audioLanguageCount; */
203
case eCurrentPositionString:
204
/* readonly attribute ACString currentPositionString; */
205
return ThrowPropertyNotWritable ();