Exemple #1
0
 private void videoSourcePlayerWebCam_NewFrame(object sender, ref Bitmap image)
 {
     if (_filterIndex < _maxFilter)
     {
         if (IsChangeFilter)
         {
             if (FilterList[_filterIndex].IsAudio())
             {
                 if (_audioFilter == null && !string.IsNullOrEmpty(AudioFilePath))
                 {
                     _audioFilter = FilterList[_filterIndex];
                     FilterList[_filterIndex].PlayAudio(AudioFilePath);
                 }
             }
             else
             {
                 if (_audioFilter != null)
                 {
                     _audioFilter.StopAudio();
                 }
                 try
                 {
                     var filteredImage = FilterList[_filterIndex].GetNewFrame(image);
                     image = filteredImage;
                 }
                 catch (Exception)
                 {
                 }
             }
         }
         else
         {
             for (int i = 0; i < _filterIndex + 1; i++)
             {
                 try
                 {
                     if (i < _maxFilter)
                     {
                         if (FilterList[i].IsAudio())
                         {
                             if (_audioFilter == null && !string.IsNullOrEmpty(AudioFilePath))
                             {
                                 _audioFilter = FilterList[i];
                                 FilterList[i].PlayAudio(AudioFilePath);
                             }
                         }
                         else
                         {
                             image = FilterList[i].GetNewFrame(image);
                         }
                     }
                 }
                 catch (Exception)
                 { }
             }
         }
     }
 }
Exemple #2
0
 public VideoPlayForm()
 {
     InitializeComponent();
     InitVideoFilePath = string.Empty;
     axWindowsMediaPlayer.PlayStateChange += AxWindowsMediaPlayer_PlayStateChange;
     brightnessCorrection.AdjustValue      = 100;
     levelLinear.InRed   = new IntRange(30, 230);
     levelLinear.InGreen = new IntRange(50, 240);
     levelLinear.InBlue  = new IntRange(10, 210);
     _timer       = new Timer();
     _timer.Tick += _timer_Tick;
     _filterIndex = 0;
     _audioFilter = null;
 }
Exemple #3
0
        private void VideoPlayForm_Shown(object sender, EventArgs e)
        {
            videoSourcePlayerWebCam.Visible = IsPlayerForWebCamIsVisible;
            axWindowsMediaPlayer.Visible    = IsPlayerForFileVisible;
            _maxFilter      = FilterList.Count;
            _filterIndex    = 0;
            _timer.Interval = TimeFilter * 1000;
            _audioFilter    = null;
            VideoCaptureDevice videoSource = Device;

            OpenVideoSource(videoSourcePlayerWebCam, videoSource);
            if (!string.IsNullOrEmpty(InitVideoFilePath))
            {
                axWindowsMediaPlayer.URL = InitVideoFilePath;
                axWindowsMediaPlayer.Ctlcontrols.play();
                axWindowsMediaPlayer.Ctlenabled = false;
            }
            else
            {
                _timer.Start();
            }
        }