/// <summary> /// Initialises a new instance of toxav. /// </summary> /// <param name="tox"></param> internal ToxAv(ToxHandle tox) { _tox = tox; var error = ToxAvErrorNew.Ok; _toxAv = ToxAvFunctions.New(tox, ref error); if (_toxAv == null || _toxAv.IsInvalid || error != ToxAvErrorNew.Ok) { throw new Exception("Could not create a new instance of toxav."); } //register audio/video callbacks early on //due to toxav being silly, we can't start calls without registering those beforehand RegisterAudioVideoCallbacks(); }
internal static extern void RegisterAudioReceiveFrameCallback(ToxAvHandle toxAv, ToxAvDelegates.AudioReceiveFrameCallback callback, IntPtr userData);
internal static extern void RegisterBitrateStatusCallback(ToxAvHandle toxAv, ToxAvDelegates.BitrateStatusCallback callback, IntPtr userData);
internal static extern void RegisterCallStateCallback(ToxAvHandle toxAv, ToxAvDelegates.CallStateCallback callback, IntPtr userData);
internal static extern bool AudioSendFrame(ToxAvHandle toxAv, uint friendNumber, short[] pcm, uint sampleCount, byte channels, uint samplingRate, ref ToxAvErrorSendFrame error);
internal static extern bool VideoSendFrame(ToxAvHandle toxAv, uint friendNumber, ushort width, ushort height, byte[] y, byte[] u, byte[] v, ref ToxAvErrorSendFrame error);
internal static extern bool BitrateSet(ToxAvHandle toxAv, uint friendNumber, int audioBitrate, int videoBitrate, ref ToxAvErrorSetBitrate error);
internal static extern bool CallControl(ToxAvHandle toxAv, uint friendNumber, ToxAvCallControl control, ref ToxAvErrorCallControl error);
internal static extern bool Answer(ToxAvHandle toxAv, uint friendNumber, uint audioBitrate, uint videoBitrate, ref ToxAvErrorAnswer error);
internal static extern bool Call(ToxAvHandle toxAv, uint friendNumber, uint audioBitrate, uint videoBitrate, ref ToxAvErrorCall error);
internal static extern void Iterate(ToxAvHandle toxAv);
internal static extern uint IterationInterval(ToxAvHandle toxAv);
internal static extern IntPtr GetTox(ToxAvHandle toxAv);