CameraInfo* CMUCamera::getCameraInfos(int deviceNumber) { #ifdef AVG_ENABLE_CMU1394 C1394Camera* pCamera = new C1394Camera(); int err = pCamera->RefreshCameraList(); if (err <= 0) { return 0; } err = pCamera->SelectCamera(deviceNumber); if (err != CAM_SUCCESS) { AVG_ASSERT(false); } pCamera->InitCamera(true); long long uniqueID; pCamera->GetCameraUniqueID((PLARGE_INTEGER)&uniqueID); stringstream deviceID; deviceID << uniqueID; CameraInfo* pCamInfo = new CameraInfo("Firewire", deviceID.str()); getCameraImageFormats(pCamera, pCamInfo); getCameraControls(pCamera, pCamInfo); delete pCamera; return pCamInfo; #endif return NULL; }
CameraInfo* FWCamera::getCameraInfos(int deviceNumber) { #ifdef AVG_ENABLE_1394_2 dc1394_t* pDC1394 = dc1394_new(); if (pDC1394 == 0) { AVG_ASSERT(false); return NULL; } dc1394camera_list_t * pCameraList; int err=dc1394_camera_enumerate(pDC1394, &pCameraList); if (err != DC1394_SUCCESS) { AVG_ASSERT(false); return NULL; } if (pCameraList->num != 0) { dc1394camera_id_t id = pCameraList->ids[deviceNumber]; dc1394camera_t * pCamera = dc1394_camera_new_unit(pDC1394, id.guid, id.unit); if (pCamera) { stringstream deviceID; deviceID << hex << id.guid;//pCamera->guid; CameraInfo* camInfo = new CameraInfo("Firewire", deviceID.str()); getCameraControls(pCamera, camInfo); getCameraImageFormats(pCamera, camInfo); dc1394_camera_free(pCamera); dc1394_camera_free_list(pCameraList); dc1394_free(pDC1394); return camInfo; } } #endif return NULL; }