Commit c68490b3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Centralize run-time library name/path

parent 2c3c94bd
...@@ -101,14 +101,9 @@ namespace VideoLAN.LibVLC ...@@ -101,14 +101,9 @@ namespace VideoLAN.LibVLC
int code; int code;
IntPtr message; IntPtr message;
[DllImport ("libvlc.dll", EntryPoint="libvlc_exception_init")]
private static extern void Init (NativeException e);
[DllImport ("libvlc.dll", EntryPoint="libvlc_exception_clear")]
private static extern void Clear (NativeException e);
public NativeException () public NativeException ()
{ {
Init (this); LibVLC.ExceptionInit (this);
} }
/** /**
...@@ -130,7 +125,7 @@ namespace VideoLAN.LibVLC ...@@ -130,7 +125,7 @@ namespace VideoLAN.LibVLC
} }
finally finally
{ {
Clear (this); LibVLC.ExceptionClear (this);
} }
} }
...@@ -148,7 +143,7 @@ namespace VideoLAN.LibVLC ...@@ -148,7 +143,7 @@ namespace VideoLAN.LibVLC
private void Dispose (bool disposing) private void Dispose (bool disposing)
{ {
Clear (this); LibVLC.ExceptionClear (this);
} }
}; };
}; };
...@@ -36,293 +36,307 @@ namespace VideoLAN.LibVLC ...@@ -36,293 +36,307 @@ namespace VideoLAN.LibVLC
*/ */
internal static class LibVLC internal static class LibVLC
{ {
/* Where is the run-time?
* On ELF platforms, "libvlc.so.2" should be used instead. */
const string lib = "libvlc.dll";
/* exception.c */
[DllImport (lib, EntryPoint="libvlc_exception_init")]
public static extern void ExceptionInit (NativeException e);
[DllImport (lib, EntryPoint="libvlc_exception_clear")]
public static extern void ExceptionClear (NativeException e);
/* core.c */ /* core.c */
[DllImport ("libvlc.dll", EntryPoint="libvlc_get_version")] [DllImport (lib, EntryPoint="libvlc_get_version")]
public static extern IntPtr GetVersion (); public static extern IntPtr GetVersion ();
[DllImport ("libvlc.dll", EntryPoint="libvlc_get_compiler")] [DllImport (lib, EntryPoint="libvlc_get_compiler")]
public static extern IntPtr GetCompiler (); public static extern IntPtr GetCompiler ();
[DllImport ("libvlc.dll", EntryPoint="libvlc_get_changeset")] [DllImport (lib, EntryPoint="libvlc_get_changeset")]
public static extern IntPtr GetChangeset (); public static extern IntPtr GetChangeset ();
[DllImport ("libvlc.dll", EntryPoint="libvlc_new")] [DllImport (LibVLC.lib, EntryPoint="libvlc_free")]
public static extern void Free (IntPtr ptr);
[DllImport (lib, EntryPoint="libvlc_new")]
public static extern public static extern
InstanceHandle Create (int argc, U8String[] argv, NativeException ex); InstanceHandle Create (int argc, U8String[] argv, NativeException ex);
/*[DllImport ("libvlc.dll", EntryPoint="libvlc_retain")] /*[DllImport (lib, EntryPoint="libvlc_retain")]
public static extern public static extern
void Retain (InstanceHandle h, NativeException ex);*/ void Retain (InstanceHandle h, NativeException ex);*/
[DllImport ("libvlc.dll", EntryPoint="libvlc_release")] [DllImport (lib, EntryPoint="libvlc_release")]
public static extern public static extern
void Release (IntPtr h, NativeException ex); void Release (IntPtr h, NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_add_intf")] [DllImport (lib, EntryPoint="libvlc_add_intf")]
public static extern public static extern
void AddIntf (InstanceHandle h, U8String name, NativeException ex); void AddIntf (InstanceHandle h, U8String name, NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_wait")] [DllImport (lib, EntryPoint="libvlc_wait")]
public static extern public static extern
void Wait (InstanceHandle h); void Wait (InstanceHandle h);
[DllImport ("libvlc.dll", EntryPoint="libvlc_get_vlc_instance")] [DllImport (lib, EntryPoint="libvlc_get_vlc_instance")]
public static extern public static extern
IntPtr GetVLCInstance (InstanceHandle h); IntPtr GetVLCInstance (InstanceHandle h);
/* media.c */ /* media.c */
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_new")] [DllImport (lib, EntryPoint="libvlc_media_new")]
public static extern public static extern
MediaHandle MediaCreate (InstanceHandle inst, U8String mrl, MediaHandle MediaCreate (InstanceHandle inst, U8String mrl,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_new_as_node")] [DllImport (lib, EntryPoint="libvlc_media_new_as_node")]
public static extern public static extern
MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name, MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_add_option")] [DllImport (lib, EntryPoint="libvlc_media_add_option")]
public static extern public static extern
void MediaAddOption (MediaHandle media, U8String options, void MediaAddOption (MediaHandle media, U8String options,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_add_option_untrusted")] EntryPoint="libvlc_media_add_option_untrusted")]
public static extern public static extern
void MediaAddUntrustedOption (MediaHandle media, U8String options, void MediaAddUntrustedOption (MediaHandle media, U8String options,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_release")] [DllImport (lib, EntryPoint="libvlc_media_release")]
public static extern public static extern
void MediaRelease (IntPtr ptr); void MediaRelease (IntPtr ptr);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_mrl")] [DllImport (lib, EntryPoint="libvlc_media_get_mrl")]
public static extern public static extern
StringHandle MediaGetMRL (MediaHandle media, NativeException ex); StringHandle MediaGetMRL (MediaHandle media, NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_duplicate")] [DllImport (lib, EntryPoint="libvlc_media_duplicate")]
public static extern public static extern
MediaHandle MediaDuplicate (MediaHandle media); MediaHandle MediaDuplicate (MediaHandle media);
/*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_read_meta")] /*[DllImport (lib, EntryPoint="libvlc_media_read_meta")]
public static extern public static extern
MediaHandle MediaDuplicate (MediaHandle media, int type, MediaHandle MediaDuplicate (MediaHandle media, int type,
NativeException ex);*/ NativeException ex);*/
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_state")] [DllImport (lib, EntryPoint="libvlc_media_get_state")]
public static extern public static extern
State MediaGetState (MediaHandle media, NativeException ex); State MediaGetState (MediaHandle media, NativeException ex);
/*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_subitems")] /*[DllImport (lib, EntryPoint="libvlc_media_subitems")]
public static extern public static extern
MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/ MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_event_manager")] [DllImport (lib, EntryPoint="libvlc_media_event_manager")]
public static extern public static extern
EventManagerHandle MediaEventManager (MediaHandle media, EventManagerHandle MediaEventManager (MediaHandle media,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_duration")] [DllImport (lib, EntryPoint="libvlc_media_get_duration")]
public static extern public static extern
long MediaGetDuration (MediaHandle media, NativeException ex); long MediaGetDuration (MediaHandle media, NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_is_preparsed")] [DllImport (lib, EntryPoint="libvlc_media_is_preparsed")]
public static extern public static extern
int MediaIsPreparsed (MediaHandle media, NativeException ex); int MediaIsPreparsed (MediaHandle media, NativeException ex);
/*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_set_user_data")] /*[DllImport (lib, EntryPoint="libvlc_media_set_user_data")]
public static extern public static extern
void MediaIsPreparsed (MediaHandle media, IntPtr data, void MediaIsPreparsed (MediaHandle media, IntPtr data,
NativeException ex);*/ NativeException ex);*/
/*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_user_data")] /*[DllImport (lib, EntryPoint="libvlc_media_get_user_data")]
public static extern public static extern
IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/ IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/
/* media_player.c */ /* media_player.c */
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_new")] [DllImport (lib, EntryPoint="libvlc_media_player_new")]
public static extern public static extern
PlayerHandle PlayerCreate (InstanceHandle inst, NativeException ex); PlayerHandle PlayerCreate (InstanceHandle inst, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_new_from_media")] EntryPoint="libvlc_media_player_new_from_media")]
public static extern public static extern
PlayerHandle PlayerCreateFromMedia (MediaHandle media, PlayerHandle PlayerCreateFromMedia (MediaHandle media,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_release")] [DllImport (lib, EntryPoint="libvlc_media_player_release")]
public static extern public static extern
void PlayerRelease (IntPtr ptr); void PlayerRelease (IntPtr ptr);
/* PlayerRetain */ /* PlayerRetain */
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_set_media")] EntryPoint="libvlc_media_player_set_media")]
public static extern public static extern
void PlayerSetMedia (PlayerHandle player, MediaHandle media, void PlayerSetMedia (PlayerHandle player, MediaHandle media,
NativeException ex); NativeException ex);
/*[DllImport ("libvlc.dll", /*[DllImport (lib,
EntryPoint="libvlc_media_player_get_media")] EntryPoint="libvlc_media_player_get_media")]
public static extern public static extern
MediaHandle PlayerGetMedia (PlayerHandle player, MediaHandle PlayerGetMedia (PlayerHandle player,
NativeException ex);*/ NativeException ex);*/
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_event_manager")] EntryPoint="libvlc_media_player_event_manager")]
public static extern public static extern
EventManagerHandle PlayerEventManager (PlayerHandle media, EventManagerHandle PlayerEventManager (PlayerHandle media,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_is_playing")] EntryPoint="libvlc_media_player_is_playing")]
public static extern public static extern
int PlayerIsPlaying (PlayerHandle player, NativeException ex); int PlayerIsPlaying (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_play")] EntryPoint="libvlc_media_player_play")]
public static extern public static extern
void PlayerPlay (PlayerHandle player, NativeException ex); void PlayerPlay (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_pause")] EntryPoint="libvlc_media_player_pause")]
public static extern public static extern
void PlayerPause (PlayerHandle player, NativeException ex); void PlayerPause (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_stop")] EntryPoint="libvlc_media_player_stop")]
public static extern public static extern
void PlayerStop (PlayerHandle player, NativeException ex); void PlayerStop (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_set_xwindow")] EntryPoint="libvlc_media_player_set_xwindow")]
public static extern public static extern
void PlayerSetXWindow (PlayerHandle player, int xid, void PlayerSetXWindow (PlayerHandle player, int xid,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_xwindow")] EntryPoint="libvlc_media_player_get_xwindow")]
public static extern public static extern
int PlayerGetXWindow (PlayerHandle player); int PlayerGetXWindow (PlayerHandle player);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_set_hwnd")] EntryPoint="libvlc_media_player_set_hwnd")]
public static extern public static extern
void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd, void PlayerSetHWND (PlayerHandle player, SafeHandle hwnd,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_hwnd")] EntryPoint="libvlc_media_player_get_hwnd")]
public static extern public static extern
SafeHandle PlayerGetHWND (PlayerHandle player); SafeHandle PlayerGetHWND (PlayerHandle player);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_length")] EntryPoint="libvlc_media_player_get_length")]
public static extern public static extern
long PlayerGetLength (PlayerHandle player, NativeException ex); long PlayerGetLength (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_get_time")] [DllImport (lib, EntryPoint="libvlc_media_player_get_time")]
public static extern public static extern
long PlayerGetTime (PlayerHandle player, NativeException ex); long PlayerGetTime (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_media_player_set_time")] [DllImport (lib, EntryPoint="libvlc_media_player_set_time")]
public static extern public static extern
void PlayerSetTime (PlayerHandle player, long time, void PlayerSetTime (PlayerHandle player, long time,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_position")] EntryPoint="libvlc_media_player_get_position")]
public static extern public static extern
float PlayerGetPosition (PlayerHandle player, NativeException ex); float PlayerGetPosition (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_set_position")] EntryPoint="libvlc_media_player_set_position")]
public static extern public static extern
void PlayerSetPosition (PlayerHandle player, float position, void PlayerSetPosition (PlayerHandle player, float position,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_chapter")] EntryPoint="libvlc_media_player_get_chapter")]
public static extern public static extern
int PlayerGetChapter (PlayerHandle player, NativeException ex); int PlayerGetChapter (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_set_chapter")] EntryPoint="libvlc_media_player_set_chapter")]
public static extern public static extern
void PlayerSetChapter (PlayerHandle player, int chapter, void PlayerSetChapter (PlayerHandle player, int chapter,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_chapter_count")] EntryPoint="libvlc_media_player_get_chapter_count")]
public static extern public static extern
int PlayerGetChapterCount (PlayerHandle player, NativeException ex); int PlayerGetChapterCount (PlayerHandle player, NativeException ex);
/* PlayerWillPlay */ /* PlayerWillPlay */
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_chapter_count_for_title")] EntryPoint="libvlc_media_player_get_chapter_count_for_title")]
public static extern public static extern
int PlayerGetChapterCountForTitle (PlayerHandle player, int title, int PlayerGetChapterCountForTitle (PlayerHandle player, int title,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_title")] EntryPoint="libvlc_media_player_get_title")]
public static extern public static extern
int PlayerGetTitle (PlayerHandle player, NativeException ex); int PlayerGetTitle (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_set_title")] EntryPoint="libvlc_media_player_set_title")]
public static extern public static extern
void PlayerSetTitle (PlayerHandle player, int chapter, void PlayerSetTitle (PlayerHandle player, int chapter,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_title_count")] EntryPoint="libvlc_media_player_get_title_count")]
public static extern public static extern
int PlayerGetTitleCount (PlayerHandle player, NativeException ex); int PlayerGetTitleCount (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_next_chapter")] EntryPoint="libvlc_media_player_next_chapter")]
public static extern public static extern
void PlayerNextChapter (PlayerHandle player, NativeException ex); void PlayerNextChapter (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_previous_chapter")] EntryPoint="libvlc_media_player_previous_chapter")]
public static extern public static extern
void PlayerPreviousChapter (PlayerHandle player, NativeException ex); void PlayerPreviousChapter (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_rate")] EntryPoint="libvlc_media_player_get_rate")]
public static extern public static extern
float PlayerGetRate (PlayerHandle player, NativeException ex); float PlayerGetRate (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_set_rate")] EntryPoint="libvlc_media_player_set_rate")]
public static extern public static extern
void PlayerSetRate (PlayerHandle player, float rate, void PlayerSetRate (PlayerHandle player, float rate,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_state")] EntryPoint="libvlc_media_player_get_state")]
public static extern public static extern
State PlayerGetState (PlayerHandle player, NativeException ex); State PlayerGetState (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_get_fps")] EntryPoint="libvlc_media_player_get_fps")]
public static extern public static extern
float PlayerGetFPS (PlayerHandle player, NativeException ex); float PlayerGetFPS (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_has_vout")] EntryPoint="libvlc_media_player_has_vout")]
public static extern public static extern
int PlayerHasVout (PlayerHandle player, NativeException ex); int PlayerHasVout (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_is_seekable")] EntryPoint="libvlc_media_player_is_seekable")]
public static extern public static extern
int PlayerIsSeekable (PlayerHandle player, NativeException ex); int PlayerIsSeekable (PlayerHandle player, NativeException ex);
[DllImport ("libvlc.dll", [DllImport (lib,
EntryPoint="libvlc_media_player_can_pause")] EntryPoint="libvlc_media_player_can_pause")]
public static extern public static extern
int PlayerCanPause (PlayerHandle player, NativeException ex); int PlayerCanPause (PlayerHandle player, NativeException ex);
...@@ -331,13 +345,13 @@ namespace VideoLAN.LibVLC ...@@ -331,13 +345,13 @@ namespace VideoLAN.LibVLC
/* TODO: video, audio */ /* TODO: video, audio */
/* event.c */ /* event.c */
[DllImport ("libvlc.dll", EntryPoint="libvlc_event_attach")] [DllImport (lib, EntryPoint="libvlc_event_attach")]
public static extern public static extern
void EventAttach (EventManagerHandle manager, EventType type, void EventAttach (EventManagerHandle manager, EventType type,
IntPtr callback, IntPtr user_data, IntPtr callback, IntPtr user_data,
NativeException ex); NativeException ex);
[DllImport ("libvlc.dll", EntryPoint="libvlc_event_detach")] [DllImport (lib, EntryPoint="libvlc_event_detach")]
public static extern public static extern
void EventDetach (EventManagerHandle manager, EventType type, void EventDetach (EventManagerHandle manager, EventType type,
IntPtr callback, IntPtr user_data, IntPtr callback, IntPtr user_data,
......
...@@ -98,15 +98,12 @@ namespace VideoLAN.LibVLC ...@@ -98,15 +98,12 @@ namespace VideoLAN.LibVLC
*/ */
internal class MemoryHandle : NonNullHandle internal class MemoryHandle : NonNullHandle
{ {
[DllImport ("libvlc.dll", EntryPoint="libvlc_free")]
private static extern void Free (IntPtr ptr);
/** /**
* NonNullHandle.Destroy * NonNullHandle.Destroy
*/ */
protected override void Destroy () protected override void Destroy ()
{ {
Free (handle); LibVLC.Free (handle);
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment