]> git.sesse.net Git - vlc/blob - mozilla/control/npolibvlc.h
- mozilla: some cleanup, workarounds for potential crash scenarios
[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 private:\r
49     NPObject *audioObj;\r
50     NPObject *inputObj;\r
51     NPObject *logObj;\r
52     NPObject *playlistObj;\r
53     NPObject *videoObj;\r
54 };\r
55 \r
56 class LibvlcAudioNPObject: public RuntimeNPObject\r
57 {\r
58 protected:\r
59     LibvlcAudioNPObject(NPP instance, const NPClass *aClass) :\r
60         RuntimeNPObject(instance, aClass) {};\r
61     virtual ~LibvlcAudioNPObject() {};\r
62 \r
63     friend class RuntimeNPClass<LibvlcAudioNPObject>;\r
64 \r
65     static const int propertyCount;\r
66     static const NPUTF8 * const propertyNames[];\r
67 \r
68     InvokeResult getProperty(int index, NPVariant &result);\r
69     InvokeResult setProperty(int index, const NPVariant &value);\r
70 \r
71     static const int methodCount;\r
72     static const NPUTF8 * const methodNames[];\r
73 \r
74     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
75 };\r
76 \r
77 class LibvlcInputNPObject: public RuntimeNPObject\r
78 {\r
79 protected:\r
80     friend class RuntimeNPClass<LibvlcInputNPObject>;\r
81 \r
82     LibvlcInputNPObject(NPP instance, const NPClass *aClass) :\r
83         RuntimeNPObject(instance, aClass) {};\r
84 \r
85     virtual ~LibvlcInputNPObject() {};\r
86 \r
87     static const int propertyCount;\r
88     static const NPUTF8 * const propertyNames[];\r
89 \r
90     InvokeResult getProperty(int index, NPVariant &result);\r
91     InvokeResult setProperty(int index, const NPVariant &value);\r
92 \r
93     static const int methodCount;\r
94     static const NPUTF8 * const methodNames[];\r
95 };\r
96 \r
97 class LibvlcMessageNPObject: public RuntimeNPObject\r
98 {\r
99 public:\r
100     void setMessage(struct libvlc_log_message_t &msg)\r
101     {\r
102         _msg = msg;\r
103     };\r
104 \r
105 protected:\r
106     friend class RuntimeNPClass<LibvlcMessageNPObject>;\r
107 \r
108     LibvlcMessageNPObject(NPP instance, const NPClass *aClass) :\r
109         RuntimeNPObject(instance, aClass) {};\r
110 \r
111     virtual ~LibvlcMessageNPObject() {};\r
112 \r
113     static const int propertyCount;\r
114     static const NPUTF8 * const propertyNames[];\r
115 \r
116     InvokeResult getProperty(int index, NPVariant &result);\r
117 \r
118     static const int methodCount;\r
119     static const NPUTF8 * const methodNames[];\r
120 \r
121 private:\r
122     struct libvlc_log_message_t _msg;\r
123 };\r
124 \r
125 class LibvlcLogNPObject;\r
126 \r
127 class LibvlcMessageIteratorNPObject: public RuntimeNPObject\r
128 {\r
129 protected:\r
130     friend class RuntimeNPClass<LibvlcMessageIteratorNPObject>;\r
131 \r
132     LibvlcMessageIteratorNPObject(NPP instance, const NPClass *aClass);\r
133     virtual ~LibvlcMessageIteratorNPObject();\r
134 \r
135     static const int propertyCount;\r
136     static const NPUTF8 * const propertyNames[];\r
137 \r
138     InvokeResult getProperty(int index, NPVariant &result);\r
139 \r
140     static const int methodCount;\r
141     static const NPUTF8 * const methodNames[];\r
142 \r
143     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
144 \r
145 private:\r
146     libvlc_log_iterator_t*  _p_iter;\r
147 };\r
148 \r
149 class LibvlcMessagesNPObject: public RuntimeNPObject\r
150 {\r
151 protected:\r
152     friend class RuntimeNPClass<LibvlcMessagesNPObject>;\r
153 \r
154     LibvlcMessagesNPObject(NPP instance, const NPClass *aClass) :\r
155         RuntimeNPObject(instance, aClass) {};\r
156 \r
157     virtual ~LibvlcMessagesNPObject() {};\r
158 \r
159     static const int propertyCount;\r
160     static const NPUTF8 * const propertyNames[];\r
161 \r
162     InvokeResult getProperty(int index, NPVariant &result);\r
163 \r
164     static const int methodCount;\r
165     static const NPUTF8 * const methodNames[];\r
166 \r
167     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
168 };\r
169 \r
170 class LibvlcLogNPObject: public RuntimeNPObject\r
171 {\r
172 protected:\r
173     friend class RuntimeNPClass<LibvlcLogNPObject>;\r
174 \r
175     LibvlcLogNPObject(NPP instance, const NPClass *aClass);\r
176     virtual ~LibvlcLogNPObject();\r
177 \r
178     static const int propertyCount;\r
179     static const NPUTF8 * const propertyNames[];\r
180 \r
181     InvokeResult getProperty(int index, NPVariant &result);\r
182     InvokeResult setProperty(int index, const NPVariant &value);\r
183 \r
184     static const int methodCount;\r
185     static const NPUTF8 * const methodNames[];\r
186 \r
187 private:\r
188     NPObject* _p_vlcmessages;\r
189 };\r
190 \r
191 class LibvlcPlaylistItemsNPObject: public RuntimeNPObject\r
192 {\r
193 protected:\r
194     friend class RuntimeNPClass<LibvlcPlaylistItemsNPObject>;\r
195 \r
196     LibvlcPlaylistItemsNPObject(NPP instance, const NPClass *aClass) :\r
197         RuntimeNPObject(instance, aClass) {};\r
198     virtual ~LibvlcPlaylistItemsNPObject() {};\r
199 \r
200     static const int propertyCount;\r
201     static const NPUTF8 * const propertyNames[];\r
202 \r
203     InvokeResult getProperty(int index, NPVariant &result);\r
204 \r
205     static const int methodCount;\r
206     static const NPUTF8 * const methodNames[];\r
207 \r
208     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
209 };\r
210 \r
211 class LibvlcPlaylistNPObject: public RuntimeNPObject\r
212 {\r
213 protected:\r
214     friend class RuntimeNPClass<LibvlcPlaylistNPObject>;\r
215 \r
216     LibvlcPlaylistNPObject(NPP instance, const NPClass *aClass);\r
217     virtual ~LibvlcPlaylistNPObject();\r
218 \r
219     static const int propertyCount;\r
220     static const NPUTF8 * const propertyNames[];\r
221 \r
222     InvokeResult getProperty(int index, NPVariant &result);\r
223 \r
224     static const int methodCount;\r
225     static const NPUTF8 * const methodNames[];\r
226 \r
227     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
228 \r
229     void parseOptions(const NPString &s, int *i_options, char*** ppsz_options);\r
230     void parseOptions(NPObject *obj, int *i_options, char*** ppsz_options);\r
231 \r
232 private:\r
233     NPObject*  _p_vlcplaylistitems;\r
234 };\r
235 \r
236 class LibvlcVideoNPObject: public RuntimeNPObject\r
237 {\r
238 protected:\r
239     friend class RuntimeNPClass<LibvlcVideoNPObject>;\r
240 \r
241     LibvlcVideoNPObject(NPP instance, const NPClass *aClass) :\r
242         RuntimeNPObject(instance, aClass) {};\r
243     virtual ~LibvlcVideoNPObject() {};\r
244 \r
245     static const int propertyCount;\r
246     static const NPUTF8 * const propertyNames[];\r
247 \r
248     InvokeResult getProperty(int index, NPVariant &result);\r
249     InvokeResult setProperty(int index, const NPVariant &value);\r
250 \r
251     static const int methodCount;\r
252     static const NPUTF8 * const methodNames[];\r
253 \r
254     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
255 };\r