public Image GetImage() { if (mVideoSource != null) { return(mVideoSource.GetFrame()); } return(null); }
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); }
public Bitmap GetFrame(string name) { IVideoSource vs = GetVideoSource(name); if (vs != null) { return(vs.GetFrame()); } return(null); }
public Bitmap GetCurFrame() { return((mVS != null && mVS.IsPlay) ? mVS.GetFrame() : null); }