Mostly implement media player
[vlc.git] / 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         SafeHandle 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         MemoryHandle 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         int 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 MediaGetEventManager (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 PlayerGetEventManager (PlayerHandle media,
175                                                   NativeException ex);*/
176         [DllImport ("libvlc.dll",
177                     EntryPoint="libvlc_media_player_is_playing")]
178         public static extern
179         int PlayerIsPlaying (PlayerHandle player, NativeException ex);
180
181         [DllImport ("libvlc.dll",
182                     EntryPoint="libvlc_media_player_play")]
183         public static extern
184         void PlayerPlay (PlayerHandle player, NativeException ex);
185
186         [DllImport ("libvlc.dll",
187                     EntryPoint="libvlc_media_player_pause")]
188         public static extern
189         void PlayerPause (PlayerHandle player, NativeException ex);
190
191         [DllImport ("libvlc.dll",
192                     EntryPoint="libvlc_media_player_stop")]
193         public static extern
194         void PlayerStop (PlayerHandle player, NativeException ex);
195
196         [DllImport ("libvlc.dll",
197                     EntryPoint="libvlc_media_player_set_xwindow")]
198         public static extern
199         void PlayerSetXWindow (PlayerHandle player, int xid,
200                                NativeException ex);
201
202         [DllImport ("libvlc.dll",
203                     EntryPoint="libvlc_media_player_get_xwindow")]
204         public static extern
205         int PlayerGetXWindow (PlayerHandle player);
206
207         [DllImport ("libvlc.dll",
208                     EntryPoint="libvlc_media_player_set_hwnd")]
209         public static extern
210         void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd,
211                             NativeException ex);
212
213         [DllImport ("libvlc.dll",
214                     EntryPoint="libvlc_media_player_get_hwnd")]
215         public static extern
216         SafeHandle PlayerGetHWND (PlayerHandle player);
217
218         [DllImport ("libvlc.dll",
219                     EntryPoint="libvlc_media_player_get_length")]
220         public static extern
221         long PlayerGetLength (PlayerHandle player, NativeException ex);
222
223         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_get_time")]
224         public static extern
225         long PlayerGetTime (PlayerHandle player, NativeException ex);
226
227         [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_set_time")]
228         public static extern
229         void PlayerSetTime (PlayerHandle player, long time,
230                             NativeException ex);
231
232         [DllImport ("libvlc.dll",
233                     EntryPoint="libvlc_media_player_get_position")]
234         public static extern
235         float PlayerGetPosition (PlayerHandle player, NativeException ex);
236
237         [DllImport ("libvlc.dll",
238                     EntryPoint="libvlc_media_player_set_position")]
239         public static extern
240         void PlayerSetPosition (PlayerHandle player, float position,
241                                 NativeException ex);
242
243         [DllImport ("libvlc.dll",
244                     EntryPoint="libvlc_media_player_get_chapter")]
245         public static extern
246         int PlayerGetChapter (PlayerHandle player, NativeException ex);
247
248         [DllImport ("libvlc.dll",
249                     EntryPoint="libvlc_media_player_set_chapter")]
250         public static extern
251         void PlayerSetChapter (PlayerHandle player, int chapter,
252                                NativeException ex);
253
254         [DllImport ("libvlc.dll",
255                     EntryPoint="libvlc_media_player_get_chapter_count")]
256         public static extern
257         int PlayerGetChapterCount (PlayerHandle player, NativeException ex);
258
259         /* PlayerWillPlay */
260
261         [DllImport ("libvlc.dll",
262                 EntryPoint="libvlc_media_player_get_chapter_count_for_title")]
263         public static extern
264         int PlayerGetChapterCountForTitle (PlayerHandle player, int title,
265                                            NativeException ex);
266
267         [DllImport ("libvlc.dll",
268                     EntryPoint="libvlc_media_player_get_title")]
269         public static extern
270         int PlayerGetTitle (PlayerHandle player, NativeException ex);
271
272         [DllImport ("libvlc.dll",
273                     EntryPoint="libvlc_media_player_set_title")]
274         public static extern
275         void PlayerSetTitle (PlayerHandle player, int chapter,
276                              NativeException ex);
277
278         [DllImport ("libvlc.dll",
279                     EntryPoint="libvlc_media_player_get_title_count")]
280         public static extern
281         int PlayerGetTitleCount (PlayerHandle player, NativeException ex);
282
283         [DllImport ("libvlc.dll",
284                     EntryPoint="libvlc_media_player_next_chapter")]
285         public static extern
286         void PlayerNextChapter (PlayerHandle player, NativeException ex);
287
288         [DllImport ("libvlc.dll",
289                     EntryPoint="libvlc_media_player_previous_chapter")]
290         public static extern
291         void PlayerPreviousChapter (PlayerHandle player, NativeException ex);
292
293         [DllImport ("libvlc.dll",
294                     EntryPoint="libvlc_media_player_get_rate")]
295         public static extern
296         float PlayerGetRate (PlayerHandle player, NativeException ex);
297
298         [DllImport ("libvlc.dll",
299                     EntryPoint="libvlc_media_player_set_rate")]
300         public static extern
301         void PlayerSetRate (PlayerHandle player, float rate,
302                             NativeException ex);
303
304         /*[DllImport ("libvlc.dll",
305                     EntryPoint="libvlc_media_player_get_state")]
306         public static extern
307         void PlayerSetState (PlayerHandle player, float rate,
308                              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 };