]> git.sesse.net Git - vlc/blob - bindings/cil/src/libvlc.cs
GetVLCInstance must return an non-abstract typed object ...
[vlc] / bindings / cil / src / libvlc.cs
1 /**
2  * @file libvlc.cs
3  * @brief Unmanaged LibVLC APIs
4  * @ingroup Internals
5  *
6  * @defgroup Internals LibVLC internals
7  * This covers internal marshalling functions to use the native LibVLC.
8  * Only VLC developpers should need to read this section.
9  */
10
11 /**********************************************************************
12  *  Copyright (C) 2007-2009 RĂ©mi Denis-Courmont.                      *
13  *  This program is free software; you can redistribute and/or modify *
14  *  it under the terms of the GNU General Public License as published *
15  *  by the Free Software Foundation; version 2 of the license, or (at *
16  *  your option) any later version.                                   *
17  *                                                                    *
18  *  This program is distributed in the hope that it will be useful,   *
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of    *
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
21  *  See the GNU General Public License for more details.              *
22  *                                                                    *
23  *  You should have received a copy of the GNU General Public License *
24  *  along with this program; if not, you can get it from:             *
25  *  http://www.gnu.org/copyleft/gpl.html                              *
26  **********************************************************************/
27
28 using System;
29 using System.Runtime.InteropServices;
30
31 namespace VideoLAN.LibVLC
32 {
33     /**
34      * @brief Native: unmanaged LibVLC APIs
35      * @ingroup Internals
36      */
37     internal static class LibVLC
38     {
39         /* core.c */
40         [DllImport ("libvlc.dll", EntryPoint="libvlc_get_version")]
41         public static extern IntPtr GetVersion ();
42
43         [DllImport ("libvlc.dll", EntryPoint="libvlc_get_compiler")]
44         public static extern IntPtr GetCompiler ();
45
46         [DllImport ("libvlc.dll", EntryPoint="libvlc_get_changeset")]
47         public static extern IntPtr GetChangeset ();
48
49         [DllImport ("libvlc.dll", EntryPoint="libvlc_new")]
50         public static extern
51         InstanceHandle Create (int argc, U8String[] argv, NativeException ex);
52
53         /*[DllImport ("libvlc.dll", EntryPoint="libvlc_retain")]
54         public static extern
55         void Retain (InstanceHandle h, NativeException ex);*/
56
57         [DllImport ("libvlc.dll", EntryPoint="libvlc_release")]
58         public static extern
59         void Release (IntPtr h, NativeException ex);
60
61         [DllImport ("libvlc.dll", EntryPoint="libvlc_add_intf")]
62         public static extern
63         void AddIntf (InstanceHandle h, U8String name, NativeException ex);
64
65         [DllImport ("libvlc.dll", EntryPoint="libvlc_wait")]
66         public static extern
67         void Wait (InstanceHandle h);
68
69         [DllImport ("libvlc.dll", EntryPoint="libvlc_get_vlc_instance")]
70         public static extern
71         IntPtr GetVLCInstance (InstanceHandle h);
72
73         /* media.c */
74         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_new")]
75         public static extern
76         MediaHandle MediaCreate (InstanceHandle inst, U8String mrl,
77                                  NativeException ex);
78
79         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_new_as_node")]
80         public static extern
81         MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name,
82                                        NativeException ex);
83
84         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_add_option")]
85         public static extern
86         void MediaAddOption (MediaHandle media, U8String options,
87                              NativeException ex);
88
89         [DllImport ("libvlc.dll",
90                     EntryPoint="libvlc_media_add_option_untrusted")]
91         public static extern
92         void MediaAddUntrustedOption (MediaHandle media, U8String options,
93                                       NativeException ex);
94
95         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_release")]
96         public static extern
97         void MediaRelease (IntPtr ptr);
98
99         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_mrl")]
100         public static extern
101         StringHandle MediaGetMRL (MediaHandle media, NativeException ex);
102
103         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_duplicate")]
104         public static extern
105         MediaHandle MediaDuplicate (MediaHandle media);
106
107         /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_read_meta")]
108         public static extern
109         MediaHandle MediaDuplicate (MediaHandle media, int type,
110                                     NativeException ex);*/
111
112         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_state")]
113         public static extern
114         State MediaGetState (MediaHandle media, NativeException ex);
115
116         /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_subitems")]
117         public static extern
118         MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/
119
120         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_event_manager")]
121         public static extern
122         EventManagerHandle MediaEventManager (MediaHandle media,
123                                               NativeException ex);
124
125         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_duration")]
126         public static extern
127         long MediaGetDuration (MediaHandle media, NativeException ex);
128
129         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_is_preparsed")]
130         public static extern
131         int MediaIsPreparsed (MediaHandle media, NativeException ex);
132
133         /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_set_user_data")]
134         public static extern
135         void MediaIsPreparsed (MediaHandle media, IntPtr data,
136                                NativeException ex);*/
137
138         /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_user_data")]
139         public static extern
140         IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/
141
142         /* media_player.c */
143         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_new")]
144         public static extern
145         PlayerHandle PlayerCreate (InstanceHandle inst, NativeException ex);
146
147         [DllImport ("libvlc.dll",
148                     EntryPoint="libvlc_media_player_new_from_media")]
149         public static extern
150         PlayerHandle PlayerCreateFromMedia (MediaHandle media,
151                                             NativeException ex);
152
153         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_release")]
154         public static extern
155         void PlayerRelease (IntPtr ptr);
156
157         /* PlayerRetain */
158
159         [DllImport ("libvlc.dll",
160                     EntryPoint="libvlc_media_player_set_media")]
161         public static extern
162         void PlayerSetMedia (PlayerHandle player, MediaHandle media,
163                              NativeException ex);
164
165         /*[DllImport ("libvlc.dll",
166                     EntryPoint="libvlc_media_player_get_media")]
167         public static extern
168         MediaHandle PlayerGetMedia (PlayerHandle player,
169                                     NativeException ex);*/
170
171         [DllImport ("libvlc.dll",
172                       EntryPoint="libvlc_media_player_event_manager")]
173         public static extern
174         EventManagerHandle PlayerEventManager (PlayerHandle media,
175                                                NativeException ex);
176
177         [DllImport ("libvlc.dll",
178                     EntryPoint="libvlc_media_player_is_playing")]
179         public static extern
180         int PlayerIsPlaying (PlayerHandle player, NativeException ex);
181
182         [DllImport ("libvlc.dll",
183                     EntryPoint="libvlc_media_player_play")]
184         public static extern
185         void PlayerPlay (PlayerHandle player, NativeException ex);
186
187         [DllImport ("libvlc.dll",
188                     EntryPoint="libvlc_media_player_pause")]
189         public static extern
190         void PlayerPause (PlayerHandle player, NativeException ex);
191
192         [DllImport ("libvlc.dll",
193                     EntryPoint="libvlc_media_player_stop")]
194         public static extern
195         void PlayerStop (PlayerHandle player, NativeException ex);
196
197         [DllImport ("libvlc.dll",
198                     EntryPoint="libvlc_media_player_set_xwindow")]
199         public static extern
200         void PlayerSetXWindow (PlayerHandle player, int xid,
201                                NativeException ex);
202
203         [DllImport ("libvlc.dll",
204                     EntryPoint="libvlc_media_player_get_xwindow")]
205         public static extern
206         int PlayerGetXWindow (PlayerHandle player);
207
208         [DllImport ("libvlc.dll",
209                     EntryPoint="libvlc_media_player_set_hwnd")]
210         public static extern
211         void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd,
212                             NativeException ex);
213
214         [DllImport ("libvlc.dll",
215                     EntryPoint="libvlc_media_player_get_hwnd")]
216         public static extern
217         SafeHandle PlayerGetHWND (PlayerHandle player);
218
219         [DllImport ("libvlc.dll",
220                     EntryPoint="libvlc_media_player_get_length")]
221         public static extern
222         long PlayerGetLength (PlayerHandle player, NativeException ex);
223
224         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_get_time")]
225         public static extern
226         long PlayerGetTime (PlayerHandle player, NativeException ex);
227
228         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_set_time")]
229         public static extern
230         void PlayerSetTime (PlayerHandle player, long time,
231                             NativeException ex);
232
233         [DllImport ("libvlc.dll",
234                     EntryPoint="libvlc_media_player_get_position")]
235         public static extern
236         float PlayerGetPosition (PlayerHandle player, NativeException ex);
237
238         [DllImport ("libvlc.dll",
239                     EntryPoint="libvlc_media_player_set_position")]
240         public static extern
241         void PlayerSetPosition (PlayerHandle player, float position,
242                                 NativeException ex);
243
244         [DllImport ("libvlc.dll",
245                     EntryPoint="libvlc_media_player_get_chapter")]
246         public static extern
247         int PlayerGetChapter (PlayerHandle player, NativeException ex);
248
249         [DllImport ("libvlc.dll",
250                     EntryPoint="libvlc_media_player_set_chapter")]
251         public static extern
252         void PlayerSetChapter (PlayerHandle player, int chapter,
253                                NativeException ex);
254
255         [DllImport ("libvlc.dll",
256                     EntryPoint="libvlc_media_player_get_chapter_count")]
257         public static extern
258         int PlayerGetChapterCount (PlayerHandle player, NativeException ex);
259
260         /* PlayerWillPlay */
261
262         [DllImport ("libvlc.dll",
263                 EntryPoint="libvlc_media_player_get_chapter_count_for_title")]
264         public static extern
265         int PlayerGetChapterCountForTitle (PlayerHandle player, int title,
266                                            NativeException ex);
267
268         [DllImport ("libvlc.dll",
269                     EntryPoint="libvlc_media_player_get_title")]
270         public static extern
271         int PlayerGetTitle (PlayerHandle player, NativeException ex);
272
273         [DllImport ("libvlc.dll",
274                     EntryPoint="libvlc_media_player_set_title")]
275         public static extern
276         void PlayerSetTitle (PlayerHandle player, int chapter,
277                              NativeException ex);
278
279         [DllImport ("libvlc.dll",
280                     EntryPoint="libvlc_media_player_get_title_count")]
281         public static extern
282         int PlayerGetTitleCount (PlayerHandle player, NativeException ex);
283
284         [DllImport ("libvlc.dll",
285                     EntryPoint="libvlc_media_player_next_chapter")]
286         public static extern
287         void PlayerNextChapter (PlayerHandle player, NativeException ex);
288
289         [DllImport ("libvlc.dll",
290                     EntryPoint="libvlc_media_player_previous_chapter")]
291         public static extern
292         void PlayerPreviousChapter (PlayerHandle player, NativeException ex);
293
294         [DllImport ("libvlc.dll",
295                     EntryPoint="libvlc_media_player_get_rate")]
296         public static extern
297         float PlayerGetRate (PlayerHandle player, NativeException ex);
298
299         [DllImport ("libvlc.dll",
300                     EntryPoint="libvlc_media_player_set_rate")]
301         public static extern
302         void PlayerSetRate (PlayerHandle player, float rate,
303                             NativeException ex);
304
305         [DllImport ("libvlc.dll",
306                     EntryPoint="libvlc_media_player_get_state")]
307         public static extern
308         State PlayerGetState (PlayerHandle player, NativeException ex);
309
310         [DllImport ("libvlc.dll",
311                     EntryPoint="libvlc_media_player_get_fps")]
312         public static extern
313         float PlayerGetFPS (PlayerHandle player, NativeException ex);
314
315         [DllImport ("libvlc.dll",
316                     EntryPoint="libvlc_media_player_has_vout")]
317         public static extern
318         int PlayerHasVout (PlayerHandle player, NativeException ex);
319
320         [DllImport ("libvlc.dll",
321                     EntryPoint="libvlc_media_player_is_seekable")]
322         public static extern
323         int PlayerIsSeekable (PlayerHandle player, NativeException ex);
324
325         [DllImport ("libvlc.dll",
326                     EntryPoint="libvlc_media_player_can_pause")]
327         public static extern
328         int PlayerCanPause (PlayerHandle player, NativeException ex);
329
330
331         /* TODO: video, audio */
332
333         /* event.c */
334         [DllImport ("libvlc.dll", EntryPoint="libvlc_event_attach")]
335         public static extern
336         void EventAttach (EventManagerHandle manager, EventType type,
337                           IntPtr callback, IntPtr user_data,
338                           NativeException ex);
339
340         [DllImport ("libvlc.dll", EntryPoint="libvlc_event_detach")]
341         public static extern
342         void EventDetach (EventManagerHandle manager, EventType type,
343                           IntPtr callback, IntPtr user_data,
344                           NativeException ex);
345
346         /* libvlc_event_type_name */
347     };
348
349     /**
350      * @brief EventCallback: LibVLC event handler
351      * @ingroup Internals
352      */
353     internal delegate void EventCallback (IntPtr ev, IntPtr data);
354
355     /**
356      * @brief EventType: LibVLC event types
357      * @ingroup Internals
358      */
359     internal enum EventType
360     {
361         MediaMetaChanged,
362         MediaSubItemAdded,
363         MediaDurationChanged,
364         MediaPreparsedChanged,
365         MediaFreed,
366         MediaStateChanged,
367
368         PlayerNothingSpecial,
369         PlayerOpening,
370         PlayerBuffering,
371         PlayerPlaying,
372         PlayerPaused,
373         PlayerStopped,
374         PlayerForward,
375         PlayerBackward,
376         PlayerEndReached,
377         PlayerEncounteredError,
378         PlayerTimeChanged,
379         PlayerPositionChanged,
380         PlayerSeekableChanged,
381         PlayerPausableChanged,
382
383         ListItemAdded,
384         ListWillAddItem,
385         ListItemDeleted,
386         ListWillDeleteItem,
387
388         ListViewItemAdded,
389         ListViewWillAddItem,
390         ListViewItemDeleted,
391         ListViewWillDeleteItem,
392
393         ListPlayerPlayed,
394         ListPlayerNextItemSet,
395         ListPlayerStopped,
396
397         DiscovererStarted,
398         DiscovererEnded,
399
400         PlayerTitleChanged,
401     };
402 };