bool initVideoCapture(const QString& devid, const VideoFormat& fmt) { QString use_devid = devid; if(use_devid.isEmpty()) { int count = 1; QVector<VideoCaptureDevice> devs(1); TT_GetVideoCaptureDevices(&devs[0], &count); if(count) use_devid = _Q(devs[0].szDeviceID); } return TT_InitVideoCaptureDevice(ttInst, _W(use_devid), &fmt); }
BOOL CVideoCapturePage::OnInitDialog() { CPropertyPage::OnInitDialog(); TRANSLATE(*this, IDD); AddString(m_wndVidCodec, _T("WebM VP8"), WEBM_VP8_CODEC); SetCurSelItemData(m_wndVidCodec, DEFAULT_VIDEOCODEC); m_wndVidBitrateSpinCtrl.SetRange(0, 1000); int count = 0; TT_GetVideoCaptureDevices(NULL, &count); m_videodevices.resize(count); if(count == 0) { //No devices... disable everything m_wndVidDev.EnableWindow(FALSE); m_wndVidRes.EnableWindow(FALSE); m_wndVidTest.EnableWindow(FALSE); m_wndRgb32.EnableWindow(FALSE); m_wndI420.EnableWindow(FALSE); m_wndYUY2.EnableWindow(FALSE); m_wndVidCodec.EnableWindow(FALSE); } else TT_GetVideoCaptureDevices(&m_videodevices[0], &count); for(size_t i=0;i<m_videodevices.size();i++) { int iDev = m_wndVidDev.AddString(m_videodevices[i].szDeviceName); if(m_videodevices[i].szDeviceID == m_szVidDevID) { m_wndVidDev.SetCurSel(iDev); m_nVidDev = i; } } if(m_nVidDev < 0) m_wndVidDev.SetCurSel(0); if(m_nVidDev >= 0 && m_nCapFormatIndex >= 0) { m_wndVidRes.SetCurSel(m_nCapFormatIndex); switch(m_videodevices[m_nVidDev].videoFormats[m_nCapFormatIndex].picFourCC) { case FOURCC_RGB32 : m_wndRgb32.SetCheck(BST_CHECKED); break; case FOURCC_I420 : m_wndI420.SetCheck(BST_CHECKED); break; case FOURCC_YUY2 : m_wndYUY2.SetCheck(BST_CHECKED); break; } } else m_wndRgb32.SetCheck(BST_CHECKED); OnCbnSelchangeComboViddev(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }