summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/video4linux/video4linux.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/video4linux/video4linux.cc')
-rw-r--r--2005/i/robert/src/video4linux/video4linux.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/2005/i/robert/src/video4linux/video4linux.cc b/2005/i/robert/src/video4linux/video4linux.cc
index 4f0d432..f1ad9e2 100644
--- a/2005/i/robert/src/video4linux/video4linux.cc
+++ b/2005/i/robert/src/video4linux/video4linux.cc
@@ -24,6 +24,7 @@
//
// }}}
#include "video4linux.hh"
+#include "pwc-ioctl.h"
#include "utils/errno_exception.hh"
#include "utils/fd_set.hh"
@@ -32,6 +33,9 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <stdexcept>
+#include <iostream>
+
+static const int framerate = 5;
/// Constructeur.
Video4Linux::Video4Linux (const char *dev, int width, int height,
@@ -148,17 +152,24 @@ Video4Linux::open (const char *dev)
throw errno_exception (dev, errno);
// Récupères les infos sur la camera.
video_window win;
+ ioctl (fd_, VIDIOCGWIN, &win);
win.width = width_;
win.height = height_;
+ // Set new framerate
+ win.flags &= ~PWC_FPS_FRMASK;
+ win.flags |= (framerate << PWC_FPS_SHIFT);
ioctl (fd_, VIDIOCSWIN, &win);
ioctl (fd_, VIDIOCGWIN, &win);
width_ = win.width;
height_ = win.height;
+ std::cout << win.width << "x" << win.height << " " << (win.flags & PWC_FPS_FRMASK >> PWC_FPS_SHIFT) << "fps" << std::endl;
+ //pwc_imagesize is;
+ //ioctl (fd_, VIDIOCPWCGREALSIZE, &is);
+ //std::cout << is.width << "x" << is.height << std::endl;
// Initialisation mmap.
video_mbuf mbuf;
ioctl (fd_, VIDIOCGMBUF, &mbuf);
bufSize_ = mbuf.size;
-
// On récupère les cap.
video_capability cap;
if (ioctl (fd_, VIDIOCGCAP, &cap) == -1)