protected void ServiceMain() { eventLog1.WriteEntry("creating vg1"); vg1 = new VideoGrabber(); eventLog1.WriteEntry(vg1.Version); vg1.StoragePath = System.IO.Path.GetTempPath(); vg1.TextOverlay_Enabled = true; vg1.TextOverlay_String = "system date/time: %sys_time[dd/mm/yy hh:nn:ss]%"; eventLog1.WriteEntry("starting vg1 " + vg1.Version); vg1.StartPreview(); if (vg1.GraphState() == VidGrabNoForm.TGraphState.gs_Running) { eventLog1.WriteEntry("vg1 started on capture device " + vg1.VideoDeviceName); ThreadLoop(); vg1.StopPreview(); } else { eventLog1.WriteEntry("failed to start vg1"); } eventLog1.WriteEntry("stopping vg1"); eventLog1.WriteEntry("destroying vg1"); vg1.Dispose(); }
void videoGrabberMixer_OnLog(object sender, TOnLogEventArgs e) { VideoGrabber control = sender as VideoGrabber; if (control != null) { Log(string.Format("[{0}] {1} - {2}", control.Name, e.severity, e.infoMsg)); } }
void BeginWritingCamera() { try { videoGrabber = new VideoGrabber(); videoGrabber.BufferData += new VideoGrabberBufferDataEventHandler(videoGrabber_BufferData); videoGrabber.BeginGrabber(); } catch (Exception e) { MessageBox.Show(e.Message); } }