2 using System.Runtime.InteropServices;
6 partial class Video : IDisposable
8 private static class Internal
10 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
11 public delegate
void EventCallback(IntPtr videoInternal, IntPtr data, Int32 dataElemSize, Int32 dataLen);
14 private const string DLL_NAME =
"webm_mem_playback_x64.dll";
16 private const string DLL_NAME =
"webm_mem_playback_x64.so";
18 private const string DLL_NAME =
"webm_mem_playback_x64.dylib";
20 private const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl;
22 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
23 public static extern IntPtr loadVideo(
string filename);
25 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
26 public static extern Int32 getVideoWidth(IntPtr videoInternal);
28 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
29 public static extern Int32 getVideoHeight(IntPtr videoInternal);
31 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
32 public static extern Int32 videoHasAudio(IntPtr videoInternal);
34 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
35 public static extern Int32 getVideoAudioSampleRate(IntPtr videoInternal);
37 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
38 public static extern Int32 getVideoAudioChannelCount(IntPtr videoInternal);
40 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
41 public static extern void deleteVideo(IntPtr videoInternal);
43 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
44 public static extern void playVideo(IntPtr videoInternal);
46 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
47 public static extern void stopVideo(IntPtr videoInternal);
49 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
50 public static extern Int32 isVideoPlaying(IntPtr videoInternal);
52 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
53 public static extern void setVideoFrameCallback(IntPtr videoInternal, IntPtr callback);
55 [DllImport(DLL_NAME, CallingConvention = CALLING_CONVENTION, CharSet = CharSet.Ansi)]
56 public static extern void setVideoAudioCallback(IntPtr videoInternal, IntPtr callback);