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
39 /* Where is the run-time?
40 * On ELF platforms, "libvlc.so.2" should be used instead. */
41 const string lib = "libvlc.dll";
44 [DllImport (lib, EntryPoint="libvlc_exception_init")]
45 public static extern void ExceptionInit (NativeException e);
47 [DllImport (lib, EntryPoint="libvlc_exception_clear")]
48 public static extern void ExceptionClear (NativeException e);
51 [DllImport (lib, EntryPoint="libvlc_get_version")]
52 public static extern IntPtr GetVersion ();
54 [DllImport (lib, EntryPoint="libvlc_get_compiler")]
55 public static extern IntPtr GetCompiler ();
57 [DllImport (lib, EntryPoint="libvlc_get_changeset")]
58 public static extern IntPtr GetChangeset ();
60 [DllImport (LibVLC.lib, EntryPoint="libvlc_free")]
61 public static extern void Free (IntPtr ptr);
63 [DllImport (lib, EntryPoint="libvlc_new")]
65 InstanceHandle Create (int argc, U8String[] argv, NativeException ex);
67 /*[DllImport (lib, EntryPoint="libvlc_retain")]
69 void Retain (InstanceHandle h, NativeException ex);*/
71 [DllImport (lib, EntryPoint="libvlc_release")]
73 void Release (IntPtr h, NativeException ex);
75 [DllImport (lib, EntryPoint="libvlc_add_intf")]
77 void AddIntf (InstanceHandle h, U8String name, NativeException ex);
79 [DllImport (lib, EntryPoint="libvlc_wait")]
81 void Wait (InstanceHandle h);
83 [DllImport (lib, EntryPoint="libvlc_get_vlc_instance")]
85 IntPtr GetVLCInstance (InstanceHandle h);
88 [DllImport (lib, EntryPoint="libvlc_media_new")]
90 MediaHandle MediaCreate (InstanceHandle inst, U8String mrl,
93 [DllImport (lib, EntryPoint="libvlc_media_new_as_node")]
95 MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name,
98 [DllImport (lib, EntryPoint="libvlc_media_add_option")]
100 void MediaAddOption (MediaHandle media, U8String options,
104 EntryPoint="libvlc_media_add_option_untrusted")]
106 void MediaAddUntrustedOption (MediaHandle media, U8String options,
109 [DllImport (lib, EntryPoint="libvlc_media_release")]
111 void MediaRelease (IntPtr ptr);
113 [DllImport (lib, EntryPoint="libvlc_media_get_mrl")]
115 StringHandle MediaGetMRL (MediaHandle media, NativeException ex);
117 [DllImport (lib, EntryPoint="libvlc_media_duplicate")]
119 MediaHandle MediaDuplicate (MediaHandle media);
121 [DllImport (lib, EntryPoint="libvlc_media_get_meta")]
123 StringHandle MediaGetMeta (MediaHandle media, MetaType type,
126 [DllImport (lib, EntryPoint="libvlc_media_get_state")]
128 State MediaGetState (MediaHandle media, NativeException ex);
130 /*[DllImport (lib, EntryPoint="libvlc_media_subitems")]
132 MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/
134 [DllImport (lib, EntryPoint="libvlc_media_event_manager")]
136 EventManagerHandle MediaEventManager (MediaHandle media,
139 [DllImport (lib, EntryPoint="libvlc_media_get_duration")]
141 long MediaGetDuration (MediaHandle media, NativeException ex);
143 [DllImport (lib, EntryPoint="libvlc_media_is_preparsed")]
145 int MediaIsPreparsed (MediaHandle media, NativeException ex);
147 /*[DllImport (lib, EntryPoint="libvlc_media_set_user_data")]
149 void MediaIsPreparsed (MediaHandle media, IntPtr data,
150 NativeException ex);*/
152 /*[DllImport (lib, EntryPoint="libvlc_media_get_user_data")]
154 IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/
157 [DllImport (lib, EntryPoint="libvlc_media_player_new")]
159 PlayerHandle PlayerCreate (InstanceHandle inst, NativeException ex);
162 EntryPoint="libvlc_media_player_new_from_media")]
164 PlayerHandle PlayerCreateFromMedia (MediaHandle media,
167 [DllImport (lib, EntryPoint="libvlc_media_player_release")]
169 void PlayerRelease (IntPtr ptr);
174 EntryPoint="libvlc_media_player_set_media")]
176 void PlayerSetMedia (PlayerHandle player, MediaHandle media,
180 EntryPoint="libvlc_media_player_get_media")]
182 MediaHandle PlayerGetMedia (PlayerHandle player,
183 NativeException ex);*/
186 EntryPoint="libvlc_media_player_event_manager")]
188 EventManagerHandle PlayerEventManager (PlayerHandle media,
192 EntryPoint="libvlc_media_player_is_playing")]
194 int PlayerIsPlaying (PlayerHandle player, NativeException ex);
197 EntryPoint="libvlc_media_player_play")]
199 void PlayerPlay (PlayerHandle player, NativeException ex);
202 EntryPoint="libvlc_media_player_pause")]
204 void PlayerPause (PlayerHandle player, NativeException ex);
207 EntryPoint="libvlc_media_player_stop")]
209 void PlayerStop (PlayerHandle player, NativeException ex);
212 EntryPoint="libvlc_media_player_set_xwindow")]
214 void PlayerSetXWindow (PlayerHandle player, int xid,
218 EntryPoint="libvlc_media_player_get_xwindow")]
220 int PlayerGetXWindow (PlayerHandle player);
223 EntryPoint="libvlc_media_player_set_hwnd")]
225 void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd,
229 EntryPoint="libvlc_media_player_get_hwnd")]
231 SafeHandle PlayerGetHWND (PlayerHandle player);
234 EntryPoint="libvlc_media_player_get_length")]
236 long PlayerGetLength (PlayerHandle player, NativeException ex);
238 [DllImport (lib, EntryPoint="libvlc_media_player_get_time")]
240 long PlayerGetTime (PlayerHandle player, NativeException ex);
242 [DllImport (lib, EntryPoint="libvlc_media_player_set_time")]
244 void PlayerSetTime (PlayerHandle player, long time,
248 EntryPoint="libvlc_media_player_get_position")]
250 float PlayerGetPosition (PlayerHandle player, NativeException ex);
253 EntryPoint="libvlc_media_player_set_position")]
255 void PlayerSetPosition (PlayerHandle player, float position,
259 EntryPoint="libvlc_media_player_get_chapter")]
261 int PlayerGetChapter (PlayerHandle player, NativeException ex);
264 EntryPoint="libvlc_media_player_set_chapter")]
266 void PlayerSetChapter (PlayerHandle player, int chapter,
270 EntryPoint="libvlc_media_player_get_chapter_count")]
272 int PlayerGetChapterCount (PlayerHandle player, NativeException ex);
277 EntryPoint="libvlc_media_player_get_chapter_count_for_title")]
279 int PlayerGetChapterCountForTitle (PlayerHandle player, int title,
283 EntryPoint="libvlc_media_player_get_title")]
285 int PlayerGetTitle (PlayerHandle player, NativeException ex);
288 EntryPoint="libvlc_media_player_set_title")]
290 void PlayerSetTitle (PlayerHandle player, int chapter,
294 EntryPoint="libvlc_media_player_get_title_count")]
296 int PlayerGetTitleCount (PlayerHandle player, NativeException ex);
299 EntryPoint="libvlc_media_player_next_chapter")]
301 void PlayerNextChapter (PlayerHandle player, NativeException ex);
304 EntryPoint="libvlc_media_player_previous_chapter")]
306 void PlayerPreviousChapter (PlayerHandle player, NativeException ex);
309 EntryPoint="libvlc_media_player_get_rate")]
311 float PlayerGetRate (PlayerHandle player, NativeException ex);
314 EntryPoint="libvlc_media_player_set_rate")]
316 void PlayerSetRate (PlayerHandle player, float rate,
320 EntryPoint="libvlc_media_player_get_state")]
322 State PlayerGetState (PlayerHandle player, NativeException ex);
325 EntryPoint="libvlc_media_player_get_fps")]
327 float PlayerGetFPS (PlayerHandle player, NativeException ex);
330 EntryPoint="libvlc_media_player_has_vout")]
332 int PlayerHasVout (PlayerHandle player, NativeException ex);
335 EntryPoint="libvlc_media_player_is_seekable")]
337 int PlayerIsSeekable (PlayerHandle player, NativeException ex);
340 EntryPoint="libvlc_media_player_can_pause")]
342 int PlayerCanPause (PlayerHandle player, NativeException ex);
345 /* TODO: video, audio */
348 [DllImport (lib, EntryPoint="libvlc_event_attach")]
350 void EventAttach (EventManagerHandle manager, EventType type,
351 IntPtr callback, IntPtr user_data,
354 [DllImport (lib, EntryPoint="libvlc_event_detach")]
356 void EventDetach (EventManagerHandle manager, EventType type,
357 IntPtr callback, IntPtr user_data,
360 /* libvlc_event_type_name */