]> git.sesse.net Git - vlc/blob - mozilla/control/npolibvlc.h
Forward port of rev 17335. Implement versionInfo() method
[vlc] / mozilla / control / npolibvlc.h
1 /*****************************************************************************\r
2  * npolibvlc.h: official Javascript APIs\r
3  *****************************************************************************\r
4  * Copyright (C) 2002-2006 the VideoLAN team\r
5  *\r
6  * Authors: Damien Fouilleul <damien.fouilleul@laposte.net>\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; either version 2 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this program; if not, write to the Free Software\r
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\r
21  *****************************************************************************/\r
22 \r
23 /*\r
24 ** defined runtime script objects\r
25 */\r
26 #include <vlc/libvlc.h>\r
27 \r
28 #include "nporuntime.h"\r
29 \r
30 class LibvlcRootNPObject: public RuntimeNPObject\r
31 {\r
32 protected:\r
33     friend class RuntimeNPClass<LibvlcRootNPObject>;\r
34 \r
35     LibvlcRootNPObject(NPP instance, const NPClass *aClass);\r
36     virtual ~LibvlcRootNPObject();\r
37 \r
38     static const int propertyCount;\r
39     static const NPUTF8 * const propertyNames[];\r
40 \r
41     InvokeResult getProperty(int index, NPVariant &result);\r
42 \r
43     static const int methodCount;\r
44     static const NPUTF8 * const methodNames[];\r
45 \r
46     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
47 \r
48     NPObject *audioObj;\r
49     NPObject *inputObj;\r
50     NPObject *logObj;\r
51     NPObject *playlistObj;\r
52     NPObject *videoObj;\r
53 };\r
54 \r
55 class LibvlcAudioNPObject: public RuntimeNPObject\r
56 {\r
57 protected:\r
58     LibvlcAudioNPObject(NPP instance, const NPClass *aClass) :\r
59         RuntimeNPObject(instance, aClass) {};\r
60     virtual ~LibvlcAudioNPObject() {};\r
61 \r
62     friend class RuntimeNPClass<LibvlcAudioNPObject>;\r
63 \r
64     static const int propertyCount;\r
65     static const NPUTF8 * const propertyNames[];\r
66 \r
67     InvokeResult getProperty(int index, NPVariant &result);\r
68     InvokeResult setProperty(int index, const NPVariant &value);\r
69 \r
70     static const int methodCount;\r
71     static const NPUTF8 * const methodNames[];\r
72 \r
73     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
74 };\r
75 \r
76 class LibvlcInputNPObject: public RuntimeNPObject\r
77 {\r
78 protected:\r
79     friend class RuntimeNPClass<LibvlcInputNPObject>;\r
80 \r
81     LibvlcInputNPObject(NPP instance, const NPClass *aClass) :\r
82         RuntimeNPObject(instance, aClass) {};\r
83         \r
84     virtual ~LibvlcInputNPObject() {};\r
85 \r
86     static const int propertyCount;\r
87     static const NPUTF8 * const propertyNames[];\r
88 \r
89     InvokeResult getProperty(int index, NPVariant &result);\r
90     InvokeResult setProperty(int index, const NPVariant &value);\r
91 \r
92     static const int methodCount;\r
93     static const NPUTF8 * const methodNames[];\r
94 };\r
95 \r
96 class LibvlcMessageNPObject: public RuntimeNPObject\r
97 {\r
98 public:\r
99     void setMessage(struct libvlc_log_message_t &msg)\r
100     {\r
101         _msg = msg;\r
102     };\r
103 \r
104 protected:\r
105     friend class RuntimeNPClass<LibvlcMessageNPObject>;\r
106 \r
107     LibvlcMessageNPObject(NPP instance, const NPClass *aClass) :\r
108         RuntimeNPObject(instance, aClass) {};\r
109         \r
110     virtual ~LibvlcMessageNPObject() {};\r
111 \r
112     static const int propertyCount;\r
113     static const NPUTF8 * const propertyNames[];\r
114 \r
115     InvokeResult getProperty(int index, NPVariant &result);\r
116 \r
117     static const int methodCount;\r
118     static const NPUTF8 * const methodNames[];\r
119 \r
120 private:\r
121     struct libvlc_log_message_t _msg;\r
122 };\r
123 \r
124 class LibvlcLogNPObject;\r
125 \r
126 class LibvlcMessageIteratorNPObject: public RuntimeNPObject\r
127 {\r
128 public:\r
129     void setLog(LibvlcLogNPObject* p_vlclog);\r
130 \r
131 protected:\r
132     friend class RuntimeNPClass<LibvlcMessageIteratorNPObject>;\r
133 \r
134     LibvlcMessageIteratorNPObject(NPP instance, const NPClass *aClass) :\r
135         RuntimeNPObject(instance, aClass) {};\r
136         \r
137     virtual ~LibvlcMessageIteratorNPObject() {};\r
138 \r
139     static const int propertyCount;\r
140     static const NPUTF8 * const propertyNames[];\r
141 \r
142     InvokeResult getProperty(int index, NPVariant &result);\r
143 \r
144     static const int methodCount;\r
145     static const NPUTF8 * const methodNames[];\r
146 \r
147     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
148 \r
149 private:\r
150     LibvlcLogNPObject*      _p_vlclog;\r
151     libvlc_log_iterator_t*  _p_iter;\r
152 };\r
153 \r
154 class LibvlcMessagesNPObject: public RuntimeNPObject\r
155 {\r
156 public:\r
157     void setLog(LibvlcLogNPObject *p_log)\r
158     {\r
159         _p_vlclog = p_log;\r
160     }\r
161     \r
162 protected:\r
163     friend class RuntimeNPClass<LibvlcMessagesNPObject>;\r
164 \r
165     LibvlcMessagesNPObject(NPP instance, const NPClass *aClass) :\r
166         _p_vlclog(NULL),\r
167         RuntimeNPObject(instance, aClass) {};\r
168         \r
169     virtual ~LibvlcMessagesNPObject() {};\r
170 \r
171     static const int propertyCount;\r
172     static const NPUTF8 * const propertyNames[];\r
173 \r
174     InvokeResult getProperty(int index, NPVariant &result);\r
175 \r
176     static const int methodCount;\r
177     static const NPUTF8 * const methodNames[];\r
178 \r
179     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
180 \r
181 private:\r
182     LibvlcLogNPObject* _p_vlclog;\r
183 };\r
184 \r
185 class LibvlcLogNPObject: public RuntimeNPObject\r
186 {\r
187 protected:\r
188     friend class RuntimeNPClass<LibvlcLogNPObject>;\r
189     friend class LibvlcMessagesNPObject;\r
190     friend class LibvlcMessageIteratorNPObject;\r
191 \r
192     libvlc_log_t    *_p_log;\r
193 \r
194     LibvlcLogNPObject(NPP instance, const NPClass *aClass) :\r
195         RuntimeNPObject(instance, aClass),\r
196         _p_log(NULL)\r
197     {\r
198         _p_vlcmessages = static_cast<LibvlcMessagesNPObject*>(NPN_CreateObject(instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass()));\r
199         _p_vlcmessages->setLog(this);\r
200     };\r
201         \r
202     virtual ~LibvlcLogNPObject()\r
203     {\r
204         NPN_ReleaseObject(_p_vlcmessages);\r
205     };\r
206 \r
207     static const int propertyCount;\r
208     static const NPUTF8 * const propertyNames[];\r
209 \r
210     InvokeResult getProperty(int index, NPVariant &result);\r
211     InvokeResult setProperty(int index, const NPVariant &value);\r
212 \r
213     static const int methodCount;\r
214     static const NPUTF8 * const methodNames[];\r
215 \r
216 private:\r
217     LibvlcMessagesNPObject* _p_vlcmessages;\r
218 };\r
219 \r
220 class LibvlcPlaylistNPObject: public RuntimeNPObject\r
221 {\r
222 protected:\r
223     friend class RuntimeNPClass<LibvlcPlaylistNPObject>;\r
224 \r
225     LibvlcPlaylistNPObject(NPP instance, const NPClass *aClass) :\r
226         RuntimeNPObject(instance, aClass) {};\r
227     virtual ~LibvlcPlaylistNPObject() {};\r
228 \r
229     static const int propertyCount;\r
230     static const NPUTF8 * const propertyNames[];\r
231 \r
232     InvokeResult getProperty(int index, NPVariant &result);\r
233 \r
234     static const int methodCount;\r
235     static const NPUTF8 * const methodNames[];\r
236 \r
237     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
238 \r
239     void parseOptions(const NPString &s, int *i_options, char*** ppsz_options);\r
240     void parseOptions(NPObject *obj, int *i_options, char*** ppsz_options);\r
241 };\r
242 \r
243 class LibvlcVideoNPObject: public RuntimeNPObject\r
244 {\r
245 protected:\r
246     friend class RuntimeNPClass<LibvlcVideoNPObject>;\r
247 \r
248     LibvlcVideoNPObject(NPP instance, const NPClass *aClass) :\r
249         RuntimeNPObject(instance, aClass) {};\r
250     virtual ~LibvlcVideoNPObject() {};\r
251 \r
252     static const int propertyCount;\r
253     static const NPUTF8 * const propertyNames[];\r
254 \r
255     InvokeResult getProperty(int index, NPVariant &result);\r
256     InvokeResult setProperty(int index, const NPVariant &value);\r
257 \r
258     static const int methodCount;\r
259     static const NPUTF8 * const methodNames[];\r
260 \r
261     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
262 };\r
263 \r