Commit 504ebda7 authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #1235 from WonderRico:bugfix_dshow

parents 98cd04c1 d067749c
......@@ -3164,18 +3164,18 @@ void CvCaptureCAM_DShow::close()
// Initialize camera input
bool CvCaptureCAM_DShow::open( int _index )
{
int try_index = _index;
int devices = 0;
close();
devices = VI.listDevices(true);
if (devices == 0)
return false;
try_index = try_index < 0 ? 0 : (try_index > devices-1 ? devices-1 : try_index);
VI.setupDevice(try_index);
if( !VI.isDeviceSetup(try_index) )
if (_index < 0 || _index > devices-1)
return false;
index = try_index;
VI.setupDevice(_index);
if( !VI.isDeviceSetup(_index) )
return false;
index = _index;
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment