m_Palette = 0;
// Open handle in an invisible window
m_CapHandle = capCreateCaptureWindow((LPTSTR)"Capture Window",
#if 1
0,
0, 0, 160, 120,
#else
WS_BORDER | WS_VISIBLE,
0, 0, 320, 240,
#endif
(HWND) 0, 0);
if (!m_CapHandle) {
qWarning("Could not create capwindow handle.");
}
else {
// Connect to capture device
if (capDriverConnect(m_CapHandle, m_CapIndex)) {
// Register; this will make sure we are being callbacked (if you will excuse the grammar...)
CVideoCollector
::Instance((QWidget *) m_CapHandle
)->RegisterDevice
(m_CapHandle,
this);
ret = true;
// Get the size of the video format structure & allocate memory
m_BMISize = capGetVideoFormatSize(m_CapHandle);
assert(m_BMISize > 0);
m_pBMIBuf = new uchar[m_BMISize];
m_pVideoInfo = (BITMAPINFO *)m_pBMIBuf;
// Get the actual format structure; It contains width, height, and
// 'compression' info
if (capGetVideoFormat(m_CapHandle, m_pBMIBuf, m_BMISize)) {
qDebug("Got VideoFormat, struct size = %d", m_BMISize);
DumpVideoFormat(m_pVideoInfo);
}
else
qDebug("capGetVideoFormat failed.");
// Get initial capture status
capGetStatus(m_CapHandle, &m_CaptureStatus, sizeof(m_CaptureStatus));
m_ImageSize.setWidth(m_CaptureStatus.uiImageWidth);
m_ImageSize.setHeight(m_CaptureStatus.uiImageHeight);
}
else {
qWarning("Failed to connect to capDriver %d", m_CapIndex);
DestroyWindow(m_CapHandle);
m_CapHandle = 0;
}
}
m_Palette = 0;
// Open handle in an invisible window
m_CapHandle = capCreateCaptureWindow((LPTSTR)"Capture Window",
#if 1
0,
0, 0, 160, 120,
#else
WS_BORDER | WS_VISIBLE,
0, 0, 320, 240,
#endif
(HWND) 0, 0);
if (!m_CapHandle) {
qWarning("Could not create capwindow handle.");
}
else {
// Connect to capture device
if (capDriverConnect(m_CapHandle, m_CapIndex)) {
// Register; this will make sure we are being callbacked (if you will excuse the grammar...)
CVideoCollector::Instance((QWidget *) m_CapHandle)->RegisterDevice(m_CapHandle, this);
ret = true;
// Get the size of the video format structure & allocate memory
m_BMISize = capGetVideoFormatSize(m_CapHandle);
assert(m_BMISize > 0);
m_pBMIBuf = new uchar[m_BMISize];
m_pVideoInfo = (BITMAPINFO *)m_pBMIBuf;
// Get the actual format structure; It contains width, height, and
// 'compression' info
if (capGetVideoFormat(m_CapHandle, m_pBMIBuf, m_BMISize)) {
qDebug("Got VideoFormat, struct size = %d", m_BMISize);
DumpVideoFormat(m_pVideoInfo);
}
else
qDebug("capGetVideoFormat failed.");
// Get initial capture status
capGetStatus(m_CapHandle, &m_CaptureStatus, sizeof(m_CaptureStatus));
m_ImageSize.setWidth(m_CaptureStatus.uiImageWidth);
m_ImageSize.setHeight(m_CaptureStatus.uiImageHeight);
}
else {
qWarning("Failed to connect to capDriver %d", m_CapIndex);
DestroyWindow(m_CapHandle);
m_CapHandle = 0;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks