AForge.Video.MJPEGStream.Stop C# (CSharp) 메소드

Stop() 공개 메소드

Stop video source.

Stops video source aborting its thread.

Since the method aborts background thread, its usage is highly not preferred and should be done only if there are no other options. The correct way of stopping camera is signaling it stop and then waiting for background thread's completion.

public Stop ( ) : void
리턴 void
		public void Stop( )
		{
			if ( this.IsRunning )
			{
				stopEvent.Set( );
				thread.Abort( );
				WaitForStop( );
			}
		}

Usage Example

예제 #1
0
파일: CamWrapper.cs 프로젝트: natm/feedtoby
        public static void VidTest()
        {
            List<Bitmap> frames = new List<Bitmap>();

            AVIWriter aw = new AVIWriter("DIB ");
            aw.FrameRate = 15;
            aw.Open("test2.avi",320,240);
            int i = 0;
            string surl = "";
            MJPEGStream ms = new MJPEGStream();
            ms.Login = "";
            ms.Password = "";
            ms.Source = surl;
            ms.NewFrame += (sender, e) =>
            {
                i++;
                //frames.Add(e.Frame);
                aw.AddFrame(e.Frame);
                e.Frame.Save("test" + i.ToString() + ".jpg", ImageFormat.Jpeg);

            //	            ((MJPEGStream)sender).Stop();
            };

            ms.Start();
            System.Threading.Thread.Sleep(4000);
            ms.Stop();
            aw.Close();

            //
        }