Represents a handle for an instance of toxav.
Inheritance: SharpTox.Core.SafeHandleZeroOrMinusOneIsInvalid
コード例 #1
0
ファイル: ToxAv.cs プロジェクト: WELL-E/SharpTox
        /// <summary>
        /// Initialises a new instance of toxav.
        /// </summary>
        /// <param name="tox"></param>
        /// <param name="maxCalls"></param>
        public ToxAv(ToxHandle tox, int maxCalls)
        {
            _tox = tox;
            _toxAv = ToxAvFunctions.New(tox, maxCalls);

            if (_toxAv == null || _toxAv.IsInvalid)
                throw new Exception("Could not create a new instance of toxav.");

            MaxCalls = maxCalls;
        }
コード例 #2
0
ファイル: ToxAv.cs プロジェクト: hexafluoride/Detox
        /// <summary>
        /// Initialises a new instance of toxav.
        /// </summary>
        /// <param name="tox"></param>
        /// <param name="maxCalls"></param>
        public ToxAv(ToxHandle tox, int maxCalls)
        {
            _tox   = tox;
            _toxAv = ToxAvFunctions.New(tox, maxCalls);

            if (_toxAv == null || _toxAv.IsInvalid)
            {
                throw new Exception("Could not create a new instance of toxav.");
            }

            MaxCalls = maxCalls;
        }
コード例 #3
0
ファイル: ToxAv.cs プロジェクト: donaldlee2008/SharpTox
        /// <summary>
        /// Initialises a new instance of toxav.
        /// </summary>
        /// <param name="tox"></param>
        /// <param name="settings"></param>
        /// <param name="max_calls"></param>
        public ToxAv(ToxHandle tox, ToxAvCodecSettings settings, int max_calls)
        {
            toxav = ToxAvFunctions.New(tox, max_calls);

            if (toxav == null || toxav.IsInvalid)
            {
                throw new Exception("Could not create a new instance of toxav.");
            }

            MaxCalls      = max_calls;
            CodecSettings = settings;

            Invoker = new InvokeDelegate(dummyinvoker);

            callbacks();
        }
コード例 #4
0
ファイル: ToxAv.cs プロジェクト: Feignedhydra/Itrw322
        /// <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();
        }
コード例 #5
0
ファイル: ToxAv.cs プロジェクト: Tornjk/SharpTox
        /// <summary>
        /// Initialises a new instance of toxav.
        /// </summary>
        /// <param name="toxHandle"></param>
        public ToxAv([NotNull] ToxHandle toxHandle)
        {
            if (toxHandle.IsInvalid)
            {
                throw new ArgumentException(nameof(toxHandle));
            }

            this.toxHandle = toxHandle;

            var error = ToxAvErrorNew.Ok;

            this.AvHandle = ToxAvFunctions.New(toxHandle, ref error);

            if (this.AvHandle == null || this.AvHandle.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
            this.release = RegisterAudioVideoCallbacks();

            Action RegisterAudioVideoCallbacks()
            {
                this.OnVideoFrameReceived += StubVideoFrameReceive;
                this.OnAudioFrameReceived += StubAudioFrameReceive;

                return(() =>
                {
                    this.OnVideoFrameReceived -= StubVideoFrameReceive;
                    this.OnAudioFrameReceived -= StubAudioFrameReceive;
                });

                void StubVideoFrameReceive(object sender, ToxAvEventArgs.VideoFrameEventArgs e)
                {
                }

                void StubAudioFrameReceive(object sender, ToxAvEventArgs.AudioFrameEventArgs e)
                {
                }
            }
        }
コード例 #6
0
ファイル: ToxAv.cs プロジェクト: tf2017/toxofone
        //dispose pattern as described on msdn for a class that uses a safe handle
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                if (_cancelEvent != null)
                {
                    _cancelEvent.Set();
                    Thread.Sleep(0);

                    if (_canceledEvent != null && !_canceledEvent.WaitOne(0))
                    {
                        _canceledEvent.WaitOne(2000);
                    }

                    _cancelEvent.Close();
                    _cancelEvent = null;
                }

                if (_canceledEvent != null)
                {
                    _canceledEvent.Close();
                    _canceledEvent = null;
                }
            }

            if (_toxAv != null && !_toxAv.IsInvalid && !_toxAv.IsClosed)
            {
                _toxAv.Dispose();
                _toxAv = null;
            }

            _disposed = true;
        }
コード例 #7
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError Hangup(ToxAvHandle toxAv, int callIndex);
コード例 #8
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError Cancel(ToxAvHandle toxAv, int callIndex, int peerId, string reason);
コード例 #9
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern void RegisterVideoReceiveCallback(ToxAvHandle toxAv, ToxAvDelegates.VideoReceiveCallback callback, IntPtr userData);
コード例 #10
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern int PrepareVideoFrame(ToxAvHandle toxAv, int callIndex, byte[] dest, int destMax, IntPtr image);
コード例 #11
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvCallState GetCallState(ToxAvHandle toxAv, int callIndex);
コード例 #12
0
 public static extern ToxAvError Call(ToxAvHandle toxav, ref int call_index, int friend_number, ref ToxAvCodecSettings settings, int ringing_seconds);
コード例 #13
0
 public static extern int CapabilitySupported(ToxAvHandle toxav, int call_index, ToxAvCapabilities capability);
コード例 #14
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError SendAudio(ToxAvHandle toxAv, int callIndex, byte[] frame, uint frame_size);
コード例 #15
0
 public static extern ToxAvError SendAudio(ToxAvHandle toxav, int call_index, byte[] frame, uint frame_size);
コード例 #16
0
 public static extern int GetPeerID(ToxAvHandle toxav, int call_index, int peer);
コード例 #17
0
 public static extern ToxAvError KillTransmission(ToxAvHandle toxav, int call_index);
コード例 #18
0
 public static extern ToxAvError PrepareTransmission(ToxAvHandle toxav, int call_index, uint jbuf_size, uint VAD_treshold, int video_supported);
コード例 #19
0
 public static extern ToxAvError StopCall(ToxAvHandle toxav, int call_index);
コード例 #20
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError StopCall(ToxAvHandle toxAv, int callIndex);
コード例 #21
0
 public static extern IntPtr GetTox(ToxAvHandle toxav);
コード例 #22
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError KillTransmission(ToxAvHandle toxAv, int callIndex);
コード例 #23
0
 public static extern int HasActivity(ToxAvHandle toxav, int call_index, short[] pcm, ushort frame_size, float ref_energy);
コード例 #24
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern int CapabilitySupported(ToxAvHandle toxAv, int callIndex, ToxAvCapabilities capability);
コード例 #25
0
 public static extern ToxAvCallState GetCallState(ToxAvHandle toxav, int call_index);
コード例 #26
0
 public static extern ToxAvError ChangeSettings(ToxAvHandle toxav, int call_index, ref ToxAvCodecSettings settings);
コード例 #27
0
 public static extern int GetPeerCodecSettings(ToxAvHandle toxav, int call_index, int peer, ref ToxAvCodecSettings settings);
コード例 #28
0
 public static extern int PrepareVideoFrame(ToxAvHandle toxav, int call_index, byte[] dest, int dest_max, IntPtr image);
コード例 #29
0
 public static extern void RegisterCallstateCallback(ToxAvHandle toxav, ToxAvDelegates.CallstateCallback callback, ToxAvCallbackID id, IntPtr userdata);
コード例 #30
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern int PrepareAudioFrame(ToxAvHandle toxAv, int callIndex, byte[] dest, int destMax, short[] frame, int frameSize);
コード例 #31
0
 public static extern void RegisterVideoReceiveCallback(ToxAvHandle toxav, ToxAvDelegates.VideoReceiveCallback callback, IntPtr userdata);
コード例 #32
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError Call(ToxAvHandle toxAv, ref int callIndex, int friend_number, ref ToxAvCodecSettings settings, int ringingSeconds);
コード例 #33
0
 public static extern ToxAvError Reject(ToxAvHandle toxav, int call_index, string reason);
コード例 #34
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError Reject(ToxAvHandle toxAv, int callIndex, string reason);
コード例 #35
0
 public static extern ToxAvError Hangup(ToxAvHandle toxav, int call_index);
コード例 #36
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError ChangeSettings(ToxAvHandle toxAv, int callIndex, ref ToxAvCodecSettings settings);
コード例 #37
0
ファイル: ToxAv.cs プロジェクト: catterpiler/SharpTox
        /// <summary>
        /// Initialises a new instance of toxav.
        /// </summary>
        /// <param name="tox"></param>
        /// <param name="settings"></param>
        /// <param name="max_calls"></param>
        public ToxAv(ToxHandle tox, ToxAvCodecSettings settings, int max_calls)
        {
            toxav = ToxAvFunctions.New(tox, max_calls);

            if (toxav == null || toxav.IsInvalid)
                throw new Exception("Could not create a new instance of toxav.");

            MaxCalls = max_calls;
            CodecSettings = settings;

            Invoker = new InvokeDelegate(dummyinvoker);

            callbacks();
        }
コード例 #38
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError PrepareTransmission(ToxAvHandle toxAv, int callIndex, int videoSupported);
コード例 #39
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern uint DoInterval(ToxAvHandle toxAv);
コード例 #40
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern ToxAvError SendVideo(ToxAvHandle toxAv, int callIndex, byte[] frame, uint frameSize);
コード例 #41
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern int GetActiveCount(ToxAvHandle toxav);
コード例 #42
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern int GetPeerID(ToxAvHandle toxAv, int callIndex, int peer);
コード例 #43
0
 public static extern int PrepareAudioFrame(ToxAvHandle toxav, int call_index, byte[] dest, int dest_max, ushort[] frame, int frame_size);
コード例 #44
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern IntPtr GetTox(ToxAvHandle toxAv);
コード例 #45
0
 public static extern int SetVadTreshold(ToxAvHandle toxav, int callIndex, uint treshold);
コード例 #46
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern int GetPeerCodecSettings(ToxAvHandle toxAv, int callIndex, int peer, ref ToxAvCodecSettings settings);
コード例 #47
0
 public static extern ToxAvError Cancel(ToxAvHandle toxav, int call_index, int peer_id, string reason);
コード例 #48
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern void Do(ToxAvHandle toxAv);
コード例 #49
0
 internal static extern void RegisterAudioReceiveFrameCallback(ToxAvHandle toxAv, ToxAvDelegates.AudioReceiveFrameCallback callback, IntPtr userData);
コード例 #50
0
ファイル: ToxAvFunctions.cs プロジェクト: kelumKP/SharpTox
 public static extern void RegisterCallstateCallback(ToxAvHandle toxAv, ToxAvDelegates.CallstateCallback callback, ToxAvCallbackID id, IntPtr userData);
コード例 #51
0
 public static extern int HasActivity(ToxAvHandle toxAv, int callIndex, short[] pcm, ushort frameSize, float refEnergy);