7using System.Runtime.InteropServices;
11 public static class Bridge
13 private const string Assembly =
14#if UNITY_IOS && !UNITY_EDITOR
20 public delegate
void RecordingHandler(IntPtr context, IntPtr path);
22 [DllImport(Assembly, EntryPoint =
@"NCCreateMP4Recorder")]
23 public static extern IntPtr CreateMP4Recorder(
int width,
int height,
float framerate,
int bitrate,
24 int keyframeInterval,
int sampleRate,
int channelCount,
25 [MarshalAs(UnmanagedType.LPStr)]
string recordingPath, RecordingHandler callback, IntPtr context);
27 [DllImport(Assembly, EntryPoint =
@"NCCreateHEVCRecorder")]
28 public static extern IntPtr CreateHEVCRecorder(
int width,
int height,
float framerate,
int bitrate,
29 int keyframeInterval,
int sampleRate,
int channelCount,
30 [MarshalAs(UnmanagedType.LPStr)]
string recordingPath, RecordingHandler callback, IntPtr context);
32 [DllImport(Assembly, EntryPoint =
@"NCCreateGIFRecorder")]
33 public static extern IntPtr CreateGIFRecorder(
int width,
int height,
float frameDuration,
34 [MarshalAs(UnmanagedType.LPStr)]
string recordingPath, RecordingHandler callback, IntPtr context);
36 [DllImport(Assembly, EntryPoint =
@"NCFrameSize")]
37 public static extern void FrameSize(
this IntPtr recorder, out
int width, out
int height);
39 [DllImport(Assembly, EntryPoint =
@"NCCommitFrame")]
40 public static extern void CommitFrame(
this IntPtr recorder, IntPtr pixelBuffer,
long timestamp);
42 [DllImport(Assembly, EntryPoint =
@"NCCommitSamples")]
43 public static extern void CommitSamples(
this IntPtr recorder,
float[] sampleBuffer,
int sampleCount,
46 [DllImport(Assembly, EntryPoint =
@"NCFinishWriting")]
47 public static extern void FinishWriting(
this IntPtr recorder);