public WebCam(string moniker, System.Windows.Forms.Form frm) { _filter = GetFilter(moniker); _parent = frm; cd = new CaptureDevice(); cd.VideoSource = _filter.MonikerString;// moniker; cd.NewFrame += new CameraEventHandler(cd_NewFrame); cd.VideoInputSizeDetermined += new VideoInputSizeDetermined(OnCaptureDeviceVideoInputSizeDetermined); }
public static dshow.Filter GetFilter(string moniker) { dshow.Filter retval = null; dshow.FilterCollection filters = new dshow.FilterCollection(dshow.Core.FilterCategory.VideoInputDevice); foreach (dshow.Filter filt in filters) { if (moniker.CompareTo(filt.MonikerString) == 0) { retval = filt; break; } } return(retval); }