3 * @brief Unmanaged LibVLC APIs
6 * @defgroup Internals LibVLC internals
7 * This covers internal marshalling functions to use the native LibVLC.
8 * Only VLC developers 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 enum MediaOptionFlag
43 internal static class LibVLC
45 /* Where is the run-time?
46 * On ELF platforms, "libvlc.so.2" should be used instead. */
47 const string lib = "libvlc.dll";
50 [DllImport (lib, EntryPoint="libvlc_exception_init")]
51 public static extern void ExceptionInit (NativeException e);
53 [DllImport (lib, EntryPoint="libvlc_exception_clear")]
54 public static extern void ExceptionClear (NativeException e);
57 [DllImport (lib, EntryPoint="libvlc_get_version")]
58 public static extern IntPtr GetVersion ();
60 [DllImport (lib, EntryPoint="libvlc_get_compiler")]
61 public static extern IntPtr GetCompiler ();
63 [DllImport (lib, EntryPoint="libvlc_get_changeset")]
64 public static extern IntPtr GetChangeset ();
66 [DllImport (LibVLC.lib, EntryPoint="libvlc_free")]
67 public static extern void Free (IntPtr ptr);
69 [DllImport (lib, EntryPoint="libvlc_new")]
71 InstanceHandle Create (int argc, U8String[] argv, NativeException ex);
73 /*[DllImport (lib, EntryPoint="libvlc_retain")]
75 void Retain (InstanceHandle h, NativeException ex);*/
77 [DllImport (lib, EntryPoint="libvlc_release")]
79 void Release (IntPtr h, NativeException ex);
81 [DllImport (lib, EntryPoint="libvlc_add_intf")]
83 void AddIntf (InstanceHandle h, U8String name, NativeException ex);
85 [DllImport (lib, EntryPoint="libvlc_wait")]
87 void Wait (InstanceHandle h);
89 [DllImport (lib, EntryPoint="libvlc_get_vlc_instance")]
91 IntPtr GetVLCInstance (InstanceHandle h);
94 [DllImport (lib, EntryPoint="libvlc_media_new")]
96 MediaHandle MediaCreate (InstanceHandle inst, U8String mrl,
99 [DllImport (lib, EntryPoint="libvlc_media_new_as_node")]
101 MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name,
104 [DllImport (lib, EntryPoint="libvlc_media_add_option")]
106 void MediaAddOption (MediaHandle media, U8String options,
110 EntryPoint="libvlc_media_add_option_flag")]
112 void MediaAddOptionWithFlag (MediaHandle media, U8String options,
113 MediaOptionFlag flag,
116 [DllImport (lib, EntryPoint="libvlc_media_release")]
118 void MediaRelease (IntPtr ptr);
120 [DllImport (lib, EntryPoint="libvlc_media_get_mrl")]
122 StringHandle MediaGetMRL (MediaHandle media, NativeException ex);
124 [DllImport (lib, EntryPoint="libvlc_media_duplicate")]
126 MediaHandle MediaDuplicate (MediaHandle media);
128 [DllImport (lib, EntryPoint="libvlc_media_get_meta")]
130 StringHandle MediaGetMeta (MediaHandle media, MetaType type,
133 [DllImport (lib, EntryPoint="libvlc_media_get_state")]
135 State MediaGetState (MediaHandle media, NativeException ex);
137 /*[DllImport (lib, EntryPoint="libvlc_media_subitems")]
139 MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/
141 [DllImport (lib, EntryPoint="libvlc_media_event_manager")]
143 EventManagerHandle MediaEventManager (MediaHandle media,
146 [DllImport (lib, EntryPoint="libvlc_media_get_duration")]
148 long MediaGetDuration (MediaHandle media, NativeException ex);
150 [DllImport (lib, EntryPoint="libvlc_media_is_preparsed")]
152 int MediaIsPreparsed (MediaHandle media, NativeException ex);
154 /*[DllImport (lib, EntryPoint="libvlc_media_set_user_data")]
156 void MediaIsPreparsed (MediaHandle media, IntPtr data,
157 NativeException ex);*/
159 /*[DllImport (lib, EntryPoint="libvlc_media_get_user_data")]
161 IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/
164 [DllImport (lib, EntryPoint="libvlc_media_player_new")]
166 PlayerHandle PlayerCreate (InstanceHandle inst, NativeException ex);
169 EntryPoint="libvlc_media_player_new_from_media")]
171 PlayerHandle PlayerCreateFromMedia (MediaHandle media,
174 [DllImport (lib, EntryPoint="libvlc_media_player_release")]
176 void PlayerRelease (IntPtr ptr);
181 EntryPoint="libvlc_media_player_set_media")]
183 void PlayerSetMedia (PlayerHandle player, MediaHandle media,
187 EntryPoint="libvlc_media_player_get_media")]
189 MediaHandle PlayerGetMedia (PlayerHandle player,
190 NativeException ex);*/
193 EntryPoint="libvlc_media_player_event_manager")]
195 EventManagerHandle PlayerEventManager (PlayerHandle media,
199 EntryPoint="libvlc_media_player_is_playing")]
201 int PlayerIsPlaying (PlayerHandle player, NativeException ex);
204 EntryPoint="libvlc_media_player_play")]
206 void PlayerPlay (PlayerHandle player, NativeException ex);
209 EntryPoint="libvlc_media_player_pause")]
211 void PlayerPause (PlayerHandle player, NativeException ex);
214 EntryPoint="libvlc_media_player_stop")]
216 void PlayerStop (PlayerHandle player, NativeException ex);
219 EntryPoint="libvlc_media_player_set_xwindow")]
221 void PlayerSetXWindow (PlayerHandle player, int xid,
225 EntryPoint="libvlc_media_player_get_xwindow")]
227 int PlayerGetXWindow (PlayerHandle player);
230 EntryPoint="libvlc_media_player_set_hwnd")]
232 void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd,
236 EntryPoint="libvlc_media_player_get_hwnd")]
238 SafeHandle PlayerGetHWND (PlayerHandle player);
241 EntryPoint="libvlc_media_player_get_length")]
243 long PlayerGetLength (PlayerHandle player, NativeException ex);
245 [DllImport (lib, EntryPoint="libvlc_media_player_get_time")]
247 long PlayerGetTime (PlayerHandle player, NativeException ex);
249 [DllImport (lib, EntryPoint="libvlc_media_player_set_time")]
251 void PlayerSetTime (PlayerHandle player, long time,
255 EntryPoint="libvlc_media_player_get_position")]
257 float PlayerGetPosition (PlayerHandle player, NativeException ex);
260 EntryPoint="libvlc_media_player_set_position")]
262 void PlayerSetPosition (PlayerHandle player, float position,
266 EntryPoint="libvlc_media_player_get_chapter")]
268 int PlayerGetChapter (PlayerHandle player, NativeException ex);
271 EntryPoint="libvlc_media_player_set_chapter")]
273 void PlayerSetChapter (PlayerHandle player, int chapter,
277 EntryPoint="libvlc_media_player_get_chapter_count")]
279 int PlayerGetChapterCount (PlayerHandle player, NativeException ex);
284 EntryPoint="libvlc_media_player_get_chapter_count_for_title")]
286 int PlayerGetChapterCountForTitle (PlayerHandle player, int title,
290 EntryPoint="libvlc_media_player_get_title")]
292 int PlayerGetTitle (PlayerHandle player, NativeException ex);
295 EntryPoint="libvlc_media_player_set_title")]
297 void PlayerSetTitle (PlayerHandle player, int chapter,
301 EntryPoint="libvlc_media_player_get_title_count")]
303 int PlayerGetTitleCount (PlayerHandle player, NativeException ex);
306 EntryPoint="libvlc_media_player_next_chapter")]
308 void PlayerNextChapter (PlayerHandle player, NativeException ex);
311 EntryPoint="libvlc_media_player_previous_chapter")]
313 void PlayerPreviousChapter (PlayerHandle player, NativeException ex);
316 EntryPoint="libvlc_media_player_get_rate")]
318 float PlayerGetRate (PlayerHandle player, NativeException ex);
321 EntryPoint="libvlc_media_player_set_rate")]
323 void PlayerSetRate (PlayerHandle player, float rate,
327 EntryPoint="libvlc_media_player_get_state")]
329 State PlayerGetState (PlayerHandle player, NativeException ex);
332 EntryPoint="libvlc_media_player_get_fps")]
334 float PlayerGetFPS (PlayerHandle player, NativeException ex);
337 EntryPoint="libvlc_media_player_has_vout")]
339 int PlayerHasVout (PlayerHandle player, NativeException ex);
342 EntryPoint="libvlc_media_player_is_seekable")]
344 int PlayerIsSeekable (PlayerHandle player, NativeException ex);
347 EntryPoint="libvlc_media_player_can_pause")]
349 int PlayerCanPause (PlayerHandle player, NativeException ex);
352 /* TODO: video, audio */
355 [DllImport (lib, EntryPoint="libvlc_event_attach")]
357 void EventAttach (EventManagerHandle manager, EventType type,
358 IntPtr callback, IntPtr user_data,
361 [DllImport (lib, EntryPoint="libvlc_event_detach")]
363 void EventDetach (EventManagerHandle manager, EventType type,
364 IntPtr callback, IntPtr user_data,
367 /* libvlc_event_type_name */