3 * @brief Unmanaged LibVLC APIs
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.
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. *
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. *
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 **********************************************************************/
29 using System.Runtime.InteropServices;
31 namespace VideoLAN.LibVLC
34 * @brief Native: unmanaged LibVLC APIs
37 internal static class LibVLC
40 [DllImport ("libvlc.dll", EntryPoint="libvlc_get_version")]
41 public static extern IntPtr GetVersion ();
43 [DllImport ("libvlc.dll", EntryPoint="libvlc_get_compiler")]
44 public static extern IntPtr GetCompiler ();
46 [DllImport ("libvlc.dll", EntryPoint="libvlc_get_changeset")]
47 public static extern IntPtr GetChangeset ();
49 [DllImport ("libvlc.dll", EntryPoint="libvlc_new")]
51 InstanceHandle Create (int argc, U8String[] argv, NativeException ex);
53 /*[DllImport ("libvlc.dll", EntryPoint="libvlc_retain")]
55 void Retain (InstanceHandle h, NativeException ex);*/
57 [DllImport ("libvlc.dll", EntryPoint="libvlc_release")]
59 void Release (IntPtr h, NativeException ex);
61 [DllImport ("libvlc.dll", EntryPoint="libvlc_add_intf")]
63 void AddIntf (InstanceHandle h, U8String name, NativeException ex);
65 [DllImport ("libvlc.dll", EntryPoint="libvlc_wait")]
67 void Wait (InstanceHandle h);
69 [DllImport ("libvlc.dll", EntryPoint="libvlc_get_vlc_instance")]
71 IntPtr GetVLCInstance (InstanceHandle h);
74 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_new")]
76 MediaHandle MediaCreate (InstanceHandle inst, U8String mrl,
79 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_new_as_node")]
81 MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name,
84 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_add_option")]
86 void MediaAddOption (MediaHandle media, U8String options,
89 [DllImport ("libvlc.dll",
90 EntryPoint="libvlc_media_add_option_untrusted")]
92 void MediaAddUntrustedOption (MediaHandle media, U8String options,
95 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_release")]
97 void MediaRelease (IntPtr ptr);
99 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_mrl")]
101 StringHandle MediaGetMRL (MediaHandle media, NativeException ex);
103 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_duplicate")]
105 MediaHandle MediaDuplicate (MediaHandle media);
107 /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_read_meta")]
109 MediaHandle MediaDuplicate (MediaHandle media, int type,
110 NativeException ex);*/
112 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_state")]
114 State MediaGetState (MediaHandle media, NativeException ex);
116 /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_subitems")]
118 MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/
120 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_event_manager")]
122 EventManagerHandle MediaEventManager (MediaHandle media,
125 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_duration")]
127 long MediaGetDuration (MediaHandle media, NativeException ex);
129 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_is_preparsed")]
131 int MediaIsPreparsed (MediaHandle media, NativeException ex);
133 /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_set_user_data")]
135 void MediaIsPreparsed (MediaHandle media, IntPtr data,
136 NativeException ex);*/
138 /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_user_data")]
140 IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/
143 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_new")]
145 PlayerHandle PlayerCreate (InstanceHandle inst, NativeException ex);
147 [DllImport ("libvlc.dll",
148 EntryPoint="libvlc_media_player_new_from_media")]
150 PlayerHandle PlayerCreateFromMedia (MediaHandle media,
153 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_release")]
155 void PlayerRelease (IntPtr ptr);
159 [DllImport ("libvlc.dll",
160 EntryPoint="libvlc_media_player_set_media")]
162 void PlayerSetMedia (PlayerHandle player, MediaHandle media,
165 /*[DllImport ("libvlc.dll",
166 EntryPoint="libvlc_media_player_get_media")]
168 MediaHandle PlayerGetMedia (PlayerHandle player,
169 NativeException ex);*/
171 [DllImport ("libvlc.dll",
172 EntryPoint="libvlc_media_player_event_manager")]
174 EventManagerHandle PlayerEventManager (PlayerHandle media,
177 [DllImport ("libvlc.dll",
178 EntryPoint="libvlc_media_player_is_playing")]
180 int PlayerIsPlaying (PlayerHandle player, NativeException ex);
182 [DllImport ("libvlc.dll",
183 EntryPoint="libvlc_media_player_play")]
185 void PlayerPlay (PlayerHandle player, NativeException ex);
187 [DllImport ("libvlc.dll",
188 EntryPoint="libvlc_media_player_pause")]
190 void PlayerPause (PlayerHandle player, NativeException ex);
192 [DllImport ("libvlc.dll",
193 EntryPoint="libvlc_media_player_stop")]
195 void PlayerStop (PlayerHandle player, NativeException ex);
197 [DllImport ("libvlc.dll",
198 EntryPoint="libvlc_media_player_set_xwindow")]
200 void PlayerSetXWindow (PlayerHandle player, int xid,
203 [DllImport ("libvlc.dll",
204 EntryPoint="libvlc_media_player_get_xwindow")]
206 int PlayerGetXWindow (PlayerHandle player);
208 [DllImport ("libvlc.dll",
209 EntryPoint="libvlc_media_player_set_hwnd")]
211 void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd,
214 [DllImport ("libvlc.dll",
215 EntryPoint="libvlc_media_player_get_hwnd")]
217 SafeHandle PlayerGetHWND (PlayerHandle player);
219 [DllImport ("libvlc.dll",
220 EntryPoint="libvlc_media_player_get_length")]
222 long PlayerGetLength (PlayerHandle player, NativeException ex);
224 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_get_time")]
226 long PlayerGetTime (PlayerHandle player, NativeException ex);
228 [DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_set_time")]
230 void PlayerSetTime (PlayerHandle player, long time,
233 [DllImport ("libvlc.dll",
234 EntryPoint="libvlc_media_player_get_position")]
236 float PlayerGetPosition (PlayerHandle player, NativeException ex);
238 [DllImport ("libvlc.dll",
239 EntryPoint="libvlc_media_player_set_position")]
241 void PlayerSetPosition (PlayerHandle player, float position,
244 [DllImport ("libvlc.dll",
245 EntryPoint="libvlc_media_player_get_chapter")]
247 int PlayerGetChapter (PlayerHandle player, NativeException ex);
249 [DllImport ("libvlc.dll",
250 EntryPoint="libvlc_media_player_set_chapter")]
252 void PlayerSetChapter (PlayerHandle player, int chapter,
255 [DllImport ("libvlc.dll",
256 EntryPoint="libvlc_media_player_get_chapter_count")]
258 int PlayerGetChapterCount (PlayerHandle player, NativeException ex);
262 [DllImport ("libvlc.dll",
263 EntryPoint="libvlc_media_player_get_chapter_count_for_title")]
265 int PlayerGetChapterCountForTitle (PlayerHandle player, int title,
268 [DllImport ("libvlc.dll",
269 EntryPoint="libvlc_media_player_get_title")]
271 int PlayerGetTitle (PlayerHandle player, NativeException ex);
273 [DllImport ("libvlc.dll",
274 EntryPoint="libvlc_media_player_set_title")]
276 void PlayerSetTitle (PlayerHandle player, int chapter,
279 [DllImport ("libvlc.dll",
280 EntryPoint="libvlc_media_player_get_title_count")]
282 int PlayerGetTitleCount (PlayerHandle player, NativeException ex);
284 [DllImport ("libvlc.dll",
285 EntryPoint="libvlc_media_player_next_chapter")]
287 void PlayerNextChapter (PlayerHandle player, NativeException ex);
289 [DllImport ("libvlc.dll",
290 EntryPoint="libvlc_media_player_previous_chapter")]
292 void PlayerPreviousChapter (PlayerHandle player, NativeException ex);
294 [DllImport ("libvlc.dll",
295 EntryPoint="libvlc_media_player_get_rate")]
297 float PlayerGetRate (PlayerHandle player, NativeException ex);
299 [DllImport ("libvlc.dll",
300 EntryPoint="libvlc_media_player_set_rate")]
302 void PlayerSetRate (PlayerHandle player, float rate,
305 [DllImport ("libvlc.dll",
306 EntryPoint="libvlc_media_player_get_state")]
308 State PlayerGetState (PlayerHandle player, NativeException ex);
310 [DllImport ("libvlc.dll",
311 EntryPoint="libvlc_media_player_get_fps")]
313 float PlayerGetFPS (PlayerHandle player, NativeException ex);
315 [DllImport ("libvlc.dll",
316 EntryPoint="libvlc_media_player_has_vout")]
318 int PlayerHasVout (PlayerHandle player, NativeException ex);
320 [DllImport ("libvlc.dll",
321 EntryPoint="libvlc_media_player_is_seekable")]
323 int PlayerIsSeekable (PlayerHandle player, NativeException ex);
325 [DllImport ("libvlc.dll",
326 EntryPoint="libvlc_media_player_can_pause")]
328 int PlayerCanPause (PlayerHandle player, NativeException ex);
331 /* TODO: video, audio */
334 [DllImport ("libvlc.dll", EntryPoint="libvlc_event_attach")]
336 void EventAttach (EventManagerHandle manager, EventType type,
337 IntPtr callback, IntPtr user_data,
340 [DllImport ("libvlc.dll", EntryPoint="libvlc_event_detach")]
342 void EventDetach (EventManagerHandle manager, EventType type,
343 IntPtr callback, IntPtr user_data,
346 /* libvlc_event_type_name */
350 * @brief EventCallback: LibVLC event handler
353 internal delegate void EventCallback (IntPtr ev, IntPtr data);
356 * @brief EventType: LibVLC event types
359 internal enum EventType
363 MediaDurationChanged,
364 MediaPreparsedChanged,
368 PlayerNothingSpecial,
377 PlayerEncounteredError,
379 PlayerPositionChanged,
380 PlayerSeekableChanged,
381 PlayerPausableChanged,
391 ListViewWillDeleteItem,
394 ListPlayerNextItemSet,