//keeps track of how many instances of VI are being used
//don't touch
-static int comInitCount = 0;
+//static int comInitCount = 0;
//////////////////////////////////////// VIDEO DEVICE ///////////////////////////////////
// ----------------------------------------------------------------------
bool videoInput::comInit(){
- HRESULT hr = NOERROR;
+ /*HRESULT hr = NOERROR;
//no need for us to start com more than once
if(comInitCount == 0 ){
}
}
- comInitCount++;
+ comInitCount++;*/
return true;
}
// ----------------------------------------------------------------------
bool videoInput::comUnInit(){
- if(comInitCount > 0)comInitCount--; //decrease the count of instances using com
+ /*if(comInitCount > 0)comInitCount--; //decrease the count of instances using com
if(comInitCount == 0){
CoUninitialize(); //if there are no instances left - uninitialize com
return true;
}
- return false;
+ return false;*/
+ return true;
}
{
public:
CvCaptureCAM_DShow();
- virtual ~CvCaptureCAM_DShow() { close(); }
+ virtual ~CvCaptureCAM_DShow();
virtual bool open( int index );
virtual void close();
index = -1;
frame = 0;
width = height = -1;
+ CoInitialize(0);
+}
+
+CvCaptureCAM_DShow::~CvCaptureCAM_DShow()
+{
+ close();
+ CoUninitialize();
}
void CvCaptureCAM_DShow::close()