Client LuaCsForBarotrauma
Video.Internal.cs
1 using System;
2 using System.Runtime.InteropServices;
3 
4 namespace Barotrauma.Media
5 {
6  partial class Video : IDisposable
7  {
8  private static class Internal
9  {
10  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
11  public delegate void EventCallback(IntPtr videoInternal, IntPtr data, Int32 dataElemSize, Int32 dataLen);
12 
13 #if WINDOWS
14  private const string DLL_NAME = "webm_mem_playback_x64.dll";
15 #elif LINUX
16  private const string DLL_NAME = "webm_mem_playback_x64.so";
17 #elif OSX
18  private const string DLL_NAME = "webm_mem_playback_x64.dylib";
19 #endif
20  private const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl;
21 
22  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
23  public static extern IntPtr loadVideo(string filename);
24 
25  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
26  public static extern Int32 getVideoWidth(IntPtr videoInternal);
27 
28  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
29  public static extern Int32 getVideoHeight(IntPtr videoInternal);
30 
31  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
32  public static extern Int32 videoHasAudio(IntPtr videoInternal);
33 
34  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
35  public static extern Int32 getVideoAudioSampleRate(IntPtr videoInternal);
36 
37  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
38  public static extern Int32 getVideoAudioChannelCount(IntPtr videoInternal);
39 
40  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
41  public static extern void deleteVideo(IntPtr videoInternal);
42 
43  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
44  public static extern void playVideo(IntPtr videoInternal);
45 
46  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
47  public static extern void stopVideo(IntPtr videoInternal);
48 
49  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
50  public static extern Int32 isVideoPlaying(IntPtr videoInternal);
51 
52  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
53  public static extern void setVideoFrameCallback(IntPtr videoInternal, IntPtr callback);
54 
55  [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
56  public static extern void setVideoAudioCallback(IntPtr videoInternal, IntPtr callback);
57  }
58  }
59 }