AP_HAL_Linux: add missing casts

These errors were all over the VideoIn.cpp file:

libraries/AP_HAL_Linux/VideoIn.cpp: In member function 'bool Linux::VideoIn::allocate_buffers(uint32_t)':
libraries/AP_HAL_Linux/VideoIn.cpp:107:15: error: invalid conversion from 'uint32_t {aka unsigned int}' to 'v4l2_memory' [-fpermissive]
     rb.memory = _memtype;
               ^
libraries/AP_HAL_Linux/VideoIn.cpp: In member function 'bool Linux::VideoIn::set_format(uint32_t*, uint32_t*, uint32_t*, uint32_t*, uint32_t*)':
libraries/AP_HAL_Linux/VideoIn.cpp:169:14: error: invalid conversion from 'int' to 'v4l2_buf_type' [-fpermissive]
     fmt.type = V4L2_CAP_VIDEO_CAPTURE;
              ^

Add proper casts to fix the compilation.
This commit is contained in:
Lucas De Marchi 2015-12-14 14:32:00 -02:00 committed by Andrew Tridgell
parent ba5dd88a0b
commit 2a953c4e35

View File

@ -103,8 +103,8 @@ bool VideoIn::allocate_buffers(uint32_t nbufs)
memset(&rb, 0, sizeof rb);
rb.count = nbufs;
rb.type = V4L2_CAP_VIDEO_CAPTURE;
rb.memory = _memtype;
rb.type = (v4l2_buf_type) V4L2_CAP_VIDEO_CAPTURE;
rb.memory = (v4l2_memory) _memtype;
ret = ioctl(_fd, VIDIOC_REQBUFS, &rb);
if (ret < 0) {
@ -166,7 +166,7 @@ bool VideoIn::set_format(uint32_t *width, uint32_t *height, uint32_t *format,
int ret;
memset(&fmt, 0, sizeof fmt);
fmt.type = V4L2_CAP_VIDEO_CAPTURE;
fmt.type = (v4l2_buf_type) V4L2_CAP_VIDEO_CAPTURE;
fmt.fmt.pix.width = *width;
fmt.fmt.pix.height = *height;
fmt.fmt.pix.pixelformat = *format;
@ -247,8 +247,8 @@ void VideoIn::_queue_buffer(int index)
memset(&buf, 0, sizeof buf);
buf.index = index;
buf.type = V4L2_CAP_VIDEO_CAPTURE;
buf.memory = _memtype;
buf.type = (v4l2_buf_type) V4L2_CAP_VIDEO_CAPTURE;
buf.memory = (v4l2_memory) _memtype;
buf.length = _buffers[index].size;
if (_memtype == V4L2_MEMORY_USERPTR) {
buf.m.userptr = (unsigned long) _buffers[index].mem;
@ -283,8 +283,8 @@ bool VideoIn::_dequeue_frame(Frame &frame)
/* Dequeue a buffer. */
memset(&buf, 0, sizeof buf);
buf.type = V4L2_CAP_VIDEO_CAPTURE;
buf.memory = _memtype;
buf.type = (v4l2_buf_type) V4L2_CAP_VIDEO_CAPTURE;
buf.memory = (v4l2_memory) _memtype;
ret = ioctl(_fd, VIDIOC_DQBUF, &buf);
if (ret < 0) {
if (errno != EIO) {
@ -292,8 +292,8 @@ bool VideoIn::_dequeue_frame(Frame &frame)
strerror(errno), errno);
return false;
}
buf.type = V4L2_CAP_VIDEO_CAPTURE;
buf.memory = _memtype;
buf.type = (v4l2_buf_type) V4L2_CAP_VIDEO_CAPTURE;
buf.memory = (v4l2_memory) _memtype;
if (_memtype == V4L2_MEMORY_USERPTR) {
buf.m.userptr = (unsigned long)_buffers[buf.index].mem;
}