示例#1
0
 public Image GetImage()
 {
     if (mVideoSource != null)
     {
         return(mVideoSource.GetFrame());
     }
     return(null);
 }
示例#2
0
        private Image GetFrame(IVideoSourceConfig config, int delay)
        {
            Image image = null;

            if (config != null)
            {
                IVideoSource vs = config.SystemContext.VideoSourceManager.GetVideoSource(config.Name);
                if (vs != null && vs.IsPlay)
                {
                    image = vs.GetFrame();
                }
                else
                {
                    IVideoSourceConfig tempVSConfig = config.Clone() as IVideoSourceConfig;
                    if (tempVSConfig != null)
                    {
                        tempVSConfig.ACEnabled = false;

                        ((CVideoSourceConfig)tempVSConfig).Name += ("_" + tempVSConfig.Handle);

                        vs = config.SystemContext.VideoSourceManager.Open(tempVSConfig, IntPtr.Zero);
                        if (vs != null)
                        {
                            vs.Play();

                            if (delay > 0)
                            {
                                Thread.Sleep(delay);
                            }

                            int n = 3;
                            image = vs.GetFrame();
                            while (image == null)
                            {
                                n--;
                                if (n < 0)
                                {
                                    break;
                                }

                                Thread.Sleep(100);
                                image = vs.GetFrame();
                            }
                            config.SystemContext.VideoSourceManager.Close(vs.Name);
                        }
                    }
                }
            }

            if (image != null)
            {
                label_imageSize.Text = string.Format("ͼÏñ³ß´ç£º{0}X{1}", image.Width, image.Height);
            }

            return(image);
        }
示例#3
0
        public Bitmap GetFrame(string name)
        {
            IVideoSource vs = GetVideoSource(name);

            if (vs != null)
            {
                return(vs.GetFrame());
            }
            return(null);
        }
示例#4
0
 public Bitmap GetCurFrame()
 {
     return((mVS != null && mVS.IsPlay) ? mVS.GetFrame() : null);
 }