v4l: fix auto mode opens usable device twice (#139)

This commit is contained in:
redPanther 2016-07-24 22:45:26 +02:00 committed by brindosch
parent 108e06ed46
commit 6840d93206

View File

@ -4,16 +4,18 @@
#include <cstdio> #include <cstdio>
#include <cassert> #include <cassert>
#include <cstdlib> #include <cstdlib>
#include <fcntl.h>
#include <unistd.h>
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <QDirIterator> #include <QDirIterator>
#include <QFileInfo> #include <QFileInfo>
@ -97,12 +99,11 @@ bool V4L2Grabber::init()
_deviceName = "unknown"; _deviceName = "unknown";
for (auto& dev: _v4lDevices) for (auto& dev: _v4lDevices)
{ {
//Debug(_log, "check v4l2 device: %s (%s)",dev.first.c_str(), dev.second.c_str());
_deviceName = dev.first; _deviceName = dev.first;
if ( init() ) if ( init() )
{ {
Info(_log, "found usable v4l2 device: %s (%s)",dev.first.c_str(), dev.second.c_str()); Info(_log, "found usable v4l2 device: %s (%s)",dev.first.c_str(), dev.second.c_str());
break; return _initialized;
} }
} }
} }