AForge.Video.Kinect.KinectNative.freenect_stop_depth C# (CSharp) Method

freenect_stop_depth() public static method

public static freenect_stop_depth ( IntPtr device ) : int
device IntPtr
return int
        public static int freenect_stop_depth( IntPtr device )
        {
            lock ( sync )
            {
                return native_freenect_stop_depth( device );
            }
        }
        

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Stop video source.
        /// </summary>
        ///
        /// <remarks><para>The method stop the video source, so it no longer provides new video frames
        /// and does not consume any resources.</para>
        /// </remarks>
        ///
        public void Stop( )
        {
            lock ( sync )
            {
                lock ( runningCameras )
                {
                    if (device != null)
                    {
                        bool deviceFailed = device.IsDeviceFailed(deviceID);

                        if (!deviceFailed)
                        {
                            KinectNative.freenect_stop_depth(device.RawDevice);
                        }

                        device.Dispose( );
                        device = null;
                        runningCameras.Remove(deviceID);

                        if (PlayingFinished != null)
                        {
                            PlayingFinished(this, (!deviceFailed) ?
                                            ReasonToFinishPlaying.StoppedByUser : ReasonToFinishPlaying.DeviceLost);
                        }
                    }

                    if (imageBuffer != IntPtr.Zero)
                    {
                        Marshal.FreeHGlobal(imageBuffer);
                        imageBuffer = IntPtr.Zero;
                    }

                    videoCallback = null;
                }
            }
        }