コード例 #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (button3.Text == "Stop Video")
     {
         videoSource.SignalToStop();
         button3.Text = "Start Video";
     }
     else if (button3.Text == "Start Video")
     {
         videoSource.Start();
         button3.Text = "Stop Video";
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            var options = new PicToAsciiOptions()
            {
                FixedDimension    = PicToAsciiOptions.Fix.Vertical,
                FixedSize         = 54,
                SymbolAspectRatio = 7f / 12f,
                AsciiTable        = PicToAsciiOptions.ASCIITABLE_SYMBOLIC_LIGHT
            };

            pic2ascii = new PicToAscii(options);

            font = new Font("Lucida Console", 12, FontStyle.Regular, GraphicsUnit.Pixel);

            writer = new VideoFileWriter( );
            writer.Open($"{MOV_PATH}~test.avi", width, height, 30, VideoCodec.MPEG4, 6000000);

            VideoFileSource videoSource = new VideoFileSource(MOVIESAMPLE_PATH);

            videoSource.NewFrame        += VideoSource_NewFrame;
            videoSource.PlayingFinished += VideoSource_PlayingFinished;
            videoSource.Start();

            Console.ReadLine();
            if (videoSource.IsRunning)
            {
                videoSource.SignalToStop();
                Console.ReadLine();
            }
        }
コード例 #3
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (((Button)sender).Text == "Start")
            {
                if (FinalFrame != null)
                {
                    videoSourcePlayer.SignalToStop();
                }
                startButton.Text = "Stop";

                if (cbListDevices.SelectedIndex == cbListDevices.Items.Count - 1) // browse
                {
                    pictureBox1.BringToFront();
                    if (videoSourcePlayer.IsRunning)
                    {
                        videoSourcePlayer.Stop();
                    }
                    videoSource2           = new VideoFileSource(filePath);
                    videoSource2.NewFrame += new Accord.Video.NewFrameEventHandler(video_NewFrame);
                    // start the video source (local video)
                    videoSource2.Start();
                }
                else
                {
                    if (videoSource2 != null)
                    {
                        videoSource2.SignalToStop();
                    }
                    videoSourcePlayer.BringToFront();
                    FinalFrame = new VideoCaptureDevice(videoSource[cbListDevices.SelectedIndex].MonikerString);
                    //videoSourcePlayer.NewFrame += new VideoSourcePlayer.NewFrameHandler(this.videoSourcePlayer_NewFrame);
                    videoSourcePlayer.VideoSource = FinalFrame;
                    videoSourcePlayer.Start();
                }
            }
            else   // stop
            {
                videoSourcePlayer.SignalToStop();
                //videoSourcePlayer.SignalToStop();
                if (videoSource2 != null)
                {
                    videoSource2.SignalToStop();
                }
                ((Button)sender).Text = "Start";
            }
        }
コード例 #4
0
        private void StopProcessing()
        {
            this.Running = false;
            _frameController.Stop();

            if (_videoSource != null && _videoSource.IsRunning)
            {
                _videoSource.SignalToStop();
                _videoSource = null;
            }
            if (_videoFileSource != null && _videoFileSource.IsRunning)
            {
                _videoFileSource.SignalToStop();
                _videoFileSource = null;
            }
            this.Log("Video capture stopped");
            this.UpdateView(this);
        }
コード例 #5
0
 /// <summary>
 /// Stops the video playback.
 /// </summary>
 public void Stop()
 {
     _source.SignalToStop();
 }