]> git.sesse.net Git - vlc/blob - bindings/cil/src/libvlc.cs
Media meta data support
[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         /* Where is the run-time?
40          * On ELF platforms, "libvlc.so.2" should be used instead. */
41         const string lib = "libvlc.dll";
42
43         /* exception.c */
44         [DllImport (lib, EntryPoint="libvlc_exception_init")]
45         public static extern void ExceptionInit (NativeException e);
46
47         [DllImport (lib, EntryPoint="libvlc_exception_clear")]
48         public static extern void ExceptionClear (NativeException e);
49
50         /* core.c */
51         [DllImport (lib, EntryPoint="libvlc_get_version")]
52         public static extern IntPtr GetVersion ();
53
54         [DllImport (lib, EntryPoint="libvlc_get_compiler")]
55         public static extern IntPtr GetCompiler ();
56
57         [DllImport (lib, EntryPoint="libvlc_get_changeset")]
58         public static extern IntPtr GetChangeset ();
59
60         [DllImport (LibVLC.lib, EntryPoint="libvlc_free")]
61         public static extern void Free (IntPtr ptr);
62
63         [DllImport (lib, EntryPoint="libvlc_new")]
64         public static extern
65         InstanceHandle Create (int argc, U8String[] argv, NativeException ex);
66
67         /*[DllImport (lib, EntryPoint="libvlc_retain")]
68         public static extern
69         void Retain (InstanceHandle h, NativeException ex);*/
70
71         [DllImport (lib, EntryPoint="libvlc_release")]
72         public static extern
73         void Release (IntPtr h, NativeException ex);
74
75         [DllImport (lib, EntryPoint="libvlc_add_intf")]
76         public static extern
77         void AddIntf (InstanceHandle h, U8String name, NativeException ex);
78
79         [DllImport (lib, EntryPoint="libvlc_wait")]
80         public static extern
81         void Wait (InstanceHandle h);
82
83         [DllImport (lib, EntryPoint="libvlc_get_vlc_instance")]
84         public static extern
85         IntPtr GetVLCInstance (InstanceHandle h);
86
87         /* media.c */
88         [DllImport (lib, EntryPoint="libvlc_media_new")]
89         public static extern
90         MediaHandle MediaCreate (InstanceHandle inst, U8String mrl,
91                                  NativeException ex);
92
93         [DllImport (lib, EntryPoint="libvlc_media_new_as_node")]
94         public static extern
95         MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name,
96                                        NativeException ex);
97
98         [DllImport (lib, EntryPoint="libvlc_media_add_option")]
99         public static extern
100         void MediaAddOption (MediaHandle media, U8String options,
101                              NativeException ex);
102
103         [DllImport (lib,
104                     EntryPoint="libvlc_media_add_option_untrusted")]
105         public static extern
106         void MediaAddUntrustedOption (MediaHandle media, U8String options,
107                                       NativeException ex);
108
109         [DllImport (lib, EntryPoint="libvlc_media_release")]
110         public static extern
111         void MediaRelease (IntPtr ptr);
112
113         [DllImport (lib, EntryPoint="libvlc_media_get_mrl")]
114         public static extern
115         StringHandle MediaGetMRL (MediaHandle media, NativeException ex);
116
117         [DllImport (lib, EntryPoint="libvlc_media_duplicate")]
118         public static extern
119         MediaHandle MediaDuplicate (MediaHandle media);
120
121         [DllImport (lib, EntryPoint="libvlc_media_get_meta")]
122         public static extern
123         StringHandle MediaGetMeta (MediaHandle media, MetaType type,
124                                    NativeException ex);
125
126         [DllImport (lib, EntryPoint="libvlc_media_get_state")]
127         public static extern
128         State MediaGetState (MediaHandle media, NativeException ex);
129
130         /*[DllImport (lib, EntryPoint="libvlc_media_subitems")]
131         public static extern
132         MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/
133
134         [DllImport (lib, EntryPoint="libvlc_media_event_manager")]
135         public static extern
136         EventManagerHandle MediaEventManager (MediaHandle media,
137                                               NativeException ex);
138
139         [DllImport (lib, EntryPoint="libvlc_media_get_duration")]
140         public static extern
141         long MediaGetDuration (MediaHandle media, NativeException ex);
142
143         [DllImport (lib, EntryPoint="libvlc_media_is_preparsed")]
144         public static extern
145         int MediaIsPreparsed (MediaHandle media, NativeException ex);
146
147         /*[DllImport (lib, EntryPoint="libvlc_media_set_user_data")]
148         public static extern
149         void MediaIsPreparsed (MediaHandle media, IntPtr data,
150                                NativeException ex);*/
151
152         /*[DllImport (lib, EntryPoint="libvlc_media_get_user_data")]
153         public static extern
154         IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/
155
156         /* media_player.c */
157         [DllImport (lib, EntryPoint="libvlc_media_player_new")]
158         public static extern
159         PlayerHandle PlayerCreate (InstanceHandle inst, NativeException ex);
160
161         [DllImport (lib,
162                     EntryPoint="libvlc_media_player_new_from_media")]
163         public static extern
164         PlayerHandle PlayerCreateFromMedia (MediaHandle media,
165                                             NativeException ex);
166
167         [DllImport (lib, EntryPoint="libvlc_media_player_release")]
168         public static extern
169         void PlayerRelease (IntPtr ptr);
170
171         /* PlayerRetain */
172
173         [DllImport (lib,
174                     EntryPoint="libvlc_media_player_set_media")]
175         public static extern
176         void PlayerSetMedia (PlayerHandle player, MediaHandle media,
177                              NativeException ex);
178
179         /*[DllImport (lib,
180                     EntryPoint="libvlc_media_player_get_media")]
181         public static extern
182         MediaHandle PlayerGetMedia (PlayerHandle player,
183                                     NativeException ex);*/
184
185         [DllImport (lib,
186                       EntryPoint="libvlc_media_player_event_manager")]
187         public static extern
188         EventManagerHandle PlayerEventManager (PlayerHandle media,
189                                                NativeException ex);
190
191         [DllImport (lib,
192                     EntryPoint="libvlc_media_player_is_playing")]
193         public static extern
194         int PlayerIsPlaying (PlayerHandle player, NativeException ex);
195
196         [DllImport (lib,
197                     EntryPoint="libvlc_media_player_play")]
198         public static extern
199         void PlayerPlay (PlayerHandle player, NativeException ex);
200
201         [DllImport (lib,
202                     EntryPoint="libvlc_media_player_pause")]
203         public static extern
204         void PlayerPause (PlayerHandle player, NativeException ex);
205
206         [DllImport (lib,
207                     EntryPoint="libvlc_media_player_stop")]
208         public static extern
209         void PlayerStop (PlayerHandle player, NativeException ex);
210
211         [DllImport (lib,
212                     EntryPoint="libvlc_media_player_set_xwindow")]
213         public static extern
214         void PlayerSetXWindow (PlayerHandle player, int xid,
215                                NativeException ex);
216
217         [DllImport (lib,
218                     EntryPoint="libvlc_media_player_get_xwindow")]
219         public static extern
220         int PlayerGetXWindow (PlayerHandle player);
221
222         [DllImport (lib,
223                     EntryPoint="libvlc_media_player_set_hwnd")]
224         public static extern
225         void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd,
226                             NativeException ex);
227
228         [DllImport (lib,
229                     EntryPoint="libvlc_media_player_get_hwnd")]
230         public static extern
231         SafeHandle PlayerGetHWND (PlayerHandle player);
232
233         [DllImport (lib,
234                     EntryPoint="libvlc_media_player_get_length")]
235         public static extern
236         long PlayerGetLength (PlayerHandle player, NativeException ex);
237
238         [DllImport (lib, EntryPoint="libvlc_media_player_get_time")]
239         public static extern
240         long PlayerGetTime (PlayerHandle player, NativeException ex);
241
242         [DllImport (lib, EntryPoint="libvlc_media_player_set_time")]
243         public static extern
244         void PlayerSetTime (PlayerHandle player, long time,
245                             NativeException ex);
246
247         [DllImport (lib,
248                     EntryPoint="libvlc_media_player_get_position")]
249         public static extern
250         float PlayerGetPosition (PlayerHandle player, NativeException ex);
251
252         [DllImport (lib,
253                     EntryPoint="libvlc_media_player_set_position")]
254         public static extern
255         void PlayerSetPosition (PlayerHandle player, float position,
256                                 NativeException ex);
257
258         [DllImport (lib,
259                     EntryPoint="libvlc_media_player_get_chapter")]
260         public static extern
261         int PlayerGetChapter (PlayerHandle player, NativeException ex);
262
263         [DllImport (lib,
264                     EntryPoint="libvlc_media_player_set_chapter")]
265         public static extern
266         void PlayerSetChapter (PlayerHandle player, int chapter,
267                                NativeException ex);
268
269         [DllImport (lib,
270                     EntryPoint="libvlc_media_player_get_chapter_count")]
271         public static extern
272         int PlayerGetChapterCount (PlayerHandle player, NativeException ex);
273
274         /* PlayerWillPlay */
275
276         [DllImport (lib,
277                 EntryPoint="libvlc_media_player_get_chapter_count_for_title")]
278         public static extern
279         int PlayerGetChapterCountForTitle (PlayerHandle player, int title,
280                                            NativeException ex);
281
282         [DllImport (lib,
283                     EntryPoint="libvlc_media_player_get_title")]
284         public static extern
285         int PlayerGetTitle (PlayerHandle player, NativeException ex);
286
287         [DllImport (lib,
288                     EntryPoint="libvlc_media_player_set_title")]
289         public static extern
290         void PlayerSetTitle (PlayerHandle player, int chapter,
291                              NativeException ex);
292
293         [DllImport (lib,
294                     EntryPoint="libvlc_media_player_get_title_count")]
295         public static extern
296         int PlayerGetTitleCount (PlayerHandle player, NativeException ex);
297
298         [DllImport (lib,
299                     EntryPoint="libvlc_media_player_next_chapter")]
300         public static extern
301         void PlayerNextChapter (PlayerHandle player, NativeException ex);
302
303         [DllImport (lib,
304                     EntryPoint="libvlc_media_player_previous_chapter")]
305         public static extern
306         void PlayerPreviousChapter (PlayerHandle player, NativeException ex);
307
308         [DllImport (lib,
309                     EntryPoint="libvlc_media_player_get_rate")]
310         public static extern
311         float PlayerGetRate (PlayerHandle player, NativeException ex);
312
313         [DllImport (lib,
314                     EntryPoint="libvlc_media_player_set_rate")]
315         public static extern
316         void PlayerSetRate (PlayerHandle player, float rate,
317                             NativeException ex);
318
319         [DllImport (lib,
320                     EntryPoint="libvlc_media_player_get_state")]
321         public static extern
322         State PlayerGetState (PlayerHandle player, NativeException ex);
323
324         [DllImport (lib,
325                     EntryPoint="libvlc_media_player_get_fps")]
326         public static extern
327         float PlayerGetFPS (PlayerHandle player, NativeException ex);
328
329         [DllImport (lib,
330                     EntryPoint="libvlc_media_player_has_vout")]
331         public static extern
332         int PlayerHasVout (PlayerHandle player, NativeException ex);
333
334         [DllImport (lib,
335                     EntryPoint="libvlc_media_player_is_seekable")]
336         public static extern
337         int PlayerIsSeekable (PlayerHandle player, NativeException ex);
338
339         [DllImport (lib,
340                     EntryPoint="libvlc_media_player_can_pause")]
341         public static extern
342         int PlayerCanPause (PlayerHandle player, NativeException ex);
343
344
345         /* TODO: video, audio */
346
347         /* event.c */
348         [DllImport (lib, EntryPoint="libvlc_event_attach")]
349         public static extern
350         void EventAttach (EventManagerHandle manager, EventType type,
351                           IntPtr callback, IntPtr user_data,
352                           NativeException ex);
353
354         [DllImport (lib, EntryPoint="libvlc_event_detach")]
355         public static extern
356         void EventDetach (EventManagerHandle manager, EventType type,
357                           IntPtr callback, IntPtr user_data,
358                           NativeException ex);
359
360         /* libvlc_event_type_name */
361     };
362 };