private void Form1_FormClosing(object sender, FormClosingEventArgs e) { // Turn off device notifications if (m_rdn != null) { m_rdn.Dispose(); m_rdn = null; } // End any active captures if (m_pCapture != null) { m_pCapture.EndCaptureSession(); m_pCapture = null; } // Shut down MF MFExtern.MFShutdown(); }
private void StopCapture() { HResult hr = 0; if (m_pCapture != null) { hr = m_pCapture.EndCaptureSession(); } m_pCapture = null; UpdateDeviceList(); UpdateUI(); if (hr < 0) { NotifyError("Error stopping capture. File might be corrupt.", hr); } }
private void StartCapture() { CCapture.EncodingParameters eparams; if (rbWMV.Checked) { eparams.subtype = MFMediaType.WMV3; } else { eparams.subtype = MFMediaType.H264; } eparams.bitrate = TARGET_BIT_RATE; HResult hr = 0; IMFActivate pActivate = null; // Create the media source for the capture device. hr = GetSelectedDevice(out pActivate); // Start capturing. if (hr >= 0) { m_pCapture = new CCapture(this.Handle, WM_APP_PREVIEW_ERROR); hr = m_pCapture.StartCapture(pActivate, tbOutputFile.Text, eparams); } if (hr >= 0) { UpdateUI(); } if (hr < 0) { NotifyError("Error starting capture.", hr); } }
private void StopCapture() { int hr = 0; if (m_pCapture != null) { hr = m_pCapture.EndCaptureSession(); } m_pCapture = null; UpdateDeviceList(); UpdateUI(); if (hr < 0) { NotifyError("Error stopping capture. File might be corrupt.", hr); } }
private void StartCapture() { CCapture.EncodingParameters eparams; if (rbWMV.Checked) { eparams.subtype = MFMediaType.WMV3; } else { eparams.subtype = MFMediaType.H264; } eparams.bitrate = TARGET_BIT_RATE; int hr = 0; IMFActivate pActivate = null; // Create the media source for the capture device. hr = GetSelectedDevice(out pActivate); // Start capturing. if (hr >= 0) { m_pCapture = new CCapture(this.Handle, WM_APP_PREVIEW_ERROR); hr = m_pCapture.StartCapture(pActivate, tbOutputFile.Text, eparams); } if (hr >= 0) { UpdateUI(); } if (hr < 0) { NotifyError("Error starting capture.", hr); } }