Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }