Changeset 349 in flair-src for trunk/lib/FlairSensorActuator/src/V4LCamera.cpp
- Timestamp:
- Feb 19, 2020, 10:18:36 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/V4LCamera.cpp
r348 r349 31 31 #include <VisionFilter.h> 32 32 33 #define DEFAULT_V4L_BUFFERS 434 35 33 using std::string; 36 34 using namespace flair::core; … … 65 63 } 66 64 67 /* This is just a technicality, but all buffers must be filled up before any68 staggered SYNC is applied. SO, filler up. (see V4L HowTo) */69 65 70 66 allocBuffers(); … … 151 147 if(-1 == xioctl (device, VIDIOC_S_FMT, &form)) { 152 148 Thread::Err("Could not set specifics of capture window.\n"); 153 return -1;154 }155 156 /* Get window info again, to get the real value */157 if(-1 == xioctl (device, VIDIOC_G_FMT, &form)) {158 Thread::Err("Could not obtain specifics of capture window.\n");159 149 return -1; 160 150 } … … 320 310 321 311 int V4LCamera::AllocBuffers(void) { 322 struct v4l2_requestbuffers requestbuffers; 323 memset(&requestbuffers, 0, sizeof (v4l2_requestbuffers)); 324 325 unsigned int buffer_number = DEFAULT_V4L_BUFFERS; 326 327 try_again: 328 329 requestbuffers.count = buffer_number; 330 requestbuffers.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 331 requestbuffers.memory = V4L2_MEMORY_USERPTR; 332 333 if (xioctl (device, VIDIOC_REQBUFS, &requestbuffers)==-1) { 312 struct v4l2_requestbuffers req; 313 memset(&req, 0, sizeof (v4l2_requestbuffers)); 314 nbBuffers=DEFAULT_V4L_BUFFERS; 315 316 req.count = nbBuffers; 317 req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 318 req.memory = V4L2_MEMORY_USERPTR; 319 320 if (xioctl (device, VIDIOC_REQBUFS, &req)==-1) { 334 321 if (errno==EINVAL) { 335 322 Thread::Err("VIDIOC_REQBUFS user memory not supported\n"); … … 340 327 } 341 328 342 nbBuffers=DEFAULT_V4L_BUFFERS;343 329 for (int i=0; i<nbBuffers; i++) { 344 330 buffers[i] =AllocFunction(output->GetDataType().GetSize()); … … 517 503 memset(&buf, 0, sizeof (v4l2_buffer)); 518 504 buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 519 buf.memory = V4L2_MEMORY_USERPTR; //V4L2_MEMORY_MMAP;505 buf.memory = V4L2_MEMORY_USERPTR; 520 506 buf.index = (unsigned long)index; 521 507 buf.m.userptr=(unsigned long)(buffers[index]);
Note:
See TracChangeset
for help on using the changeset viewer.