private void VideoDevicePreview_Click(object sender, EventArgs e) { if (VideoDeviceMenu.SelectedIndex < 0) { MessageBox.Show("Please select a capture device first", "HCS Config"); return; } HCS_Encoder.VideoCapture cam = null; try { cam = new HCS_Encoder.VideoCapture(VideoDeviceMenu.SelectedIndex, (int)FrameRate.Value, (int)CaptureWidth.Value, (int)CaptureHeight.Value); FrameRate.Value = cam.m_frameRate; CaptureHeight.Value = cam.Height; CaptureWidth.Value = cam.Width; // preview with scaling: cam.TargetFrameSize = new Size((int)OutputWidth.Value, (int)OutputHeight.Value); VideoPreview prev = new VideoPreview(cam); prev.ShowDialog(); } catch { MessageBox.Show("Those settings don't work.\r\n(capture device refused to initialise, please check your device's documentation)", "HCS Config"); if (cam != null) { cam.Dispose(); } } }
private void TestVideoSettings_Click(object sender, EventArgs e) { if (VideoDeviceMenu.SelectedIndex < 0) { MessageBox.Show("Please select a capture device first", "HCS Config"); return; } HCS_Encoder.VideoCapture cam = null; try { cam = new HCS_Encoder.VideoCapture(VideoDeviceMenu.SelectedIndex, (int)FrameRate.Value, (int)CaptureWidth.Value, (int)CaptureHeight.Value); FrameRate.Value = cam.m_frameRate; CaptureHeight.Value = cam.Height; CaptureWidth.Value = cam.Width; MessageBox.Show("Video device initialised OK.\r\nCapture settings may have been updated", "HCS Config"); } catch { MessageBox.Show("Those settings don't work.\r\n(capture device refused to initialise, please check your device's documentation)", "HCS Config"); } finally { if (cam != null) { cam.Dispose(); } } }
public VideoPreview(HCS_Encoder.VideoCapture CaptureDevice) { InitializeComponent(); cam = CaptureDevice; cam.FrameAvailable += new EventHandler <HCS_Encoder.VideoDataEventArgs>(cam_FrameAvailable); this.SetClientSizeCore(cam.TargetFrameSize.Width, cam.TargetFrameSize.Height); cam.Start(); }
public VideoPreview(HCS_Encoder.VideoCapture CaptureDevice) { InitializeComponent(); cam = CaptureDevice; cam.FrameAvailable += new EventHandler<HCS_Encoder.VideoDataEventArgs>(cam_FrameAvailable); this.SetClientSizeCore(cam.TargetFrameSize.Width, cam.TargetFrameSize.Height); cam.Start(); }
private void VideoDevicePreview_Click(object sender, EventArgs e) { if (VideoDeviceMenu.SelectedIndex < 0) { MessageBox.Show("Please select a capture device first", "HCS Config"); return; } HCS_Encoder.VideoCapture cam = null; try { cam = new HCS_Encoder.VideoCapture(VideoDeviceMenu.SelectedIndex, (int)FrameRate.Value, (int)CaptureWidth.Value, (int)CaptureHeight.Value); FrameRate.Value = cam.m_frameRate; CaptureHeight.Value = cam.Height; CaptureWidth.Value = cam.Width; // preview with scaling: cam.TargetFrameSize = new Size((int)OutputWidth.Value, (int)OutputHeight.Value); VideoPreview prev = new VideoPreview(cam); prev.ShowDialog(); } catch { MessageBox.Show("Those settings don't work.\r\n(capture device refused to initialise, please check your device's documentation)", "HCS Config"); if (cam != null) cam.Dispose(); } }
private void TestVideoSettings_Click(object sender, EventArgs e) { if (VideoDeviceMenu.SelectedIndex < 0) { MessageBox.Show("Please select a capture device first", "HCS Config"); return; } HCS_Encoder.VideoCapture cam = null; try { cam = new HCS_Encoder.VideoCapture(VideoDeviceMenu.SelectedIndex, (int)FrameRate.Value, (int)CaptureWidth.Value, (int)CaptureHeight.Value); FrameRate.Value = cam.m_frameRate; CaptureHeight.Value = cam.Height; CaptureWidth.Value = cam.Width; MessageBox.Show("Video device initialised OK.\r\nCapture settings may have been updated", "HCS Config"); } catch { MessageBox.Show("Those settings don't work.\r\n(capture device refused to initialise, please check your device's documentation)", "HCS Config"); } finally { if (cam != null) cam.Dispose(); } }