diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-19 13:31:22 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-19 13:31:22 +0200 |
commit | 04a72110203d70338849e47a24b12d6b13fdfed6 (patch) | |
tree | eee2d3324e66b669b1104d377464a4789696fdad /opentrack/camera-names.hpp | |
parent | 8339eb029f68840de30dfc6772848784781ff2f5 (diff) |
camera names on linux work, finally
Diffstat (limited to 'opentrack/camera-names.hpp')
-rw-r--r-- | opentrack/camera-names.hpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/opentrack/camera-names.hpp b/opentrack/camera-names.hpp index ee6d8ceb..fd869e6b 100644 --- a/opentrack/camera-names.hpp +++ b/opentrack/camera-names.hpp @@ -16,7 +16,8 @@ #ifdef __linux #include <fcntl.h> #include <sys/ioctl.h> -#include <linux/videodev.h> +#include <linux/videodev2.h> +#include <cerrno> #endif template<typename = void> @@ -89,13 +90,14 @@ QList<QString> get_camera_names() { int fd = open(buf, O_RDONLY); if (fd == -1) continue; - struct video_capability video_cap; - if(ioctl(fd, VIDIOCGCAP, &video_cap) == -1) + struct v4l2_capability video_cap; + if(ioctl(fd, VIDIOC_QUERYCAP, &video_cap) == -1) { + qDebug() << "VIDIOC_QUERYCAP" << errno; close(fd); continue; } - ret[ret.size()-1] = video_cap.name; + ret[ret.size()-1] = reinterpret_cast<const char*>(video_cap.card); close(fd); } } |