Browse Source

Added opus libs

tags/docs-0.9
Brandon Smith 9 years ago
parent
commit
1c547a7a83
3 changed files with 8 additions and 17 deletions
  1. +8
    -17
      src/Opus.Net/API.cs
  2. BIN
      src/Opus.Net/lib/libopus.so
  3. BIN
      src/Opus.Net/lib/opus.dll

+ 8
- 17
src/Opus.Net/API.cs View File

@@ -9,37 +9,28 @@ namespace Opus.Net
{ {
internal class API internal class API
{ {
static API()
{
if (LoadLibrary(Environment.Is64BitProcess ? "lib/x64/opus.dll" : "lib/x86/opus.dll") == IntPtr.Zero)
throw new FileNotFoundException("Unable to find opus.dll", "opus.dll");
}

[DllImport("kernel32.dll")]
private static extern IntPtr LoadLibrary(string dllToLoad);

[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr opus_encoder_create(int Fs, int channels, int application, out IntPtr error); internal static extern IntPtr opus_encoder_create(int Fs, int channels, int application, out IntPtr error);


[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern void opus_encoder_destroy(IntPtr encoder); internal static extern void opus_encoder_destroy(IntPtr encoder);


[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern int opus_encode(IntPtr st, byte[] pcm, int frame_size, IntPtr data, int max_data_bytes); internal static extern int opus_encode(IntPtr st, byte[] pcm, int frame_size, IntPtr data, int max_data_bytes);


[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr opus_decoder_create(int Fs, int channels, out IntPtr error); internal static extern IntPtr opus_decoder_create(int Fs, int channels, out IntPtr error);


[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern void opus_decoder_destroy(IntPtr decoder); internal static extern void opus_decoder_destroy(IntPtr decoder);


[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern int opus_decode(IntPtr st, byte[] data, int len, IntPtr pcm, int frame_size, int decode_fec); internal static extern int opus_decode(IntPtr st, byte[] data, int len, IntPtr pcm, int frame_size, int decode_fec);


[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern int opus_encoder_ctl(IntPtr st, Ctl request, int value); internal static extern int opus_encoder_ctl(IntPtr st, Ctl request, int value);


[DllImport("opus.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("lib/opus", CallingConvention = CallingConvention.Cdecl)]
internal static extern int opus_encoder_ctl(IntPtr st, Ctl request, out int value); internal static extern int opus_encoder_ctl(IntPtr st, Ctl request, out int value);
} }




BIN
src/Opus.Net/lib/libopus.so View File


BIN
src/Opus.Net/lib/opus.dll View File


Loading…
Cancel
Save