commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
@ -188,8 +188,10 @@ std::vector<int> DisplayDeviceInformation(IEnumMoniker *pEnum)
|
||||
pPropBag->Release();
|
||||
pMoniker->Release();
|
||||
++counter_device;
|
||||
}
|
||||
|
||||
__LOG_CAM__<<"counter_device "<<counter_device<<"\n";
|
||||
}
|
||||
__LOG_CAM__<<"REtuen\n";
|
||||
return camera_ids;
|
||||
}
|
||||
|
||||
@ -210,30 +212,46 @@ bool Webcam::Open(int width_, int height_) {
|
||||
|
||||
std::vector<int> id_devices;
|
||||
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
bool mustUninitialize = true;
|
||||
__LOG_CAM__ << "A\n";
|
||||
|
||||
if (hr == RPC_E_CHANGED_MODE){
|
||||
hr = S_OK;
|
||||
mustUninitialize = false;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
__LOG_CAM__ << "B\n";
|
||||
IEnumMoniker *pEnum;
|
||||
|
||||
hr = EnumerateDevices(CLSID_VideoInputDeviceCategory, &pEnum);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
__LOG_CAM__ << "C\n";
|
||||
id_devices = DisplayDeviceInformation(pEnum);
|
||||
pEnum->Release();
|
||||
}
|
||||
|
||||
CoUninitialize();
|
||||
if(mustUninitialize)
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
__LOG_CAM__ << "id_devices size: "<<id_devices.size()<<"\n";
|
||||
if (id_devices.size() == 0)
|
||||
return false;
|
||||
|
||||
|
||||
InputVideo = new VideoCapture();
|
||||
int device_id = -1;
|
||||
__LOG_CAM__<<"D\n";
|
||||
for (int i = 0; i < id_devices.size(); i++)
|
||||
{
|
||||
InputVideo->open(id_devices[i]);
|
||||
__LOG_CAM__<<"E\n";
|
||||
InputVideo->open(id_devices[i],CAP_DSHOW);
|
||||
__LOG_CAM__<<"F\n";
|
||||
if(InputVideo->isOpened()){
|
||||
__LOG_CAM__<<"G\n";
|
||||
device_id = id_devices[i];
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user