summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera_proxy.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-01-04 06:48:10 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-01-07 22:29:47 +0200
commitb4415f1c9863a2fda42e1882ed4857de9d9366b1 (patch)
tree714cea9ba50ee4bf2b8a5b9f6d5c561f3955c4cb /src/v4l2/v4l2_camera_proxy.cpp
parent94f62f6b590857e9bcee379aec8e818625aebdf8 (diff)
v4l2: Use Object::invokeMethod() return value
Now that Object::invokeMethod() supports returning a value, use it and drop the return value method argument. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/v4l2/v4l2_camera_proxy.cpp')
-rw-r--r--src/v4l2/v4l2_camera_proxy.cpp51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 559caba6..2eeb1239 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -40,9 +40,8 @@ int V4L2CameraProxy::open(bool nonBlocking)
{
LOG(V4L2Compat, Debug) << "Servicing open";
- int ret;
- vcam_->invokeMethod(&V4L2Camera::open, ConnectionTypeBlocking,
- &ret);
+ int ret = vcam_->invokeMethod(&V4L2Camera::open,
+ ConnectionTypeBlocking);
if (ret < 0) {
errno = -ret;
return -1;
@@ -91,9 +90,8 @@ void *V4L2CameraProxy::mmap(size_t length, int prot, int flags, off_t offset)
return MAP_FAILED;
}
- void *val;
- vcam_->invokeMethod(&V4L2Camera::mmap, ConnectionTypeBlocking,
- &val, index);
+ void *val = vcam_->invokeMethod(&V4L2Camera::mmap,
+ ConnectionTypeBlocking, index);
buffers_[index].flags |= V4L2_BUF_FLAG_MAPPED;
mmaps_[val] = index;
@@ -245,9 +243,11 @@ int V4L2CameraProxy::vidioc_s_fmt(struct v4l2_format *arg)
return ret;
Size size(arg->fmt.pix.width, arg->fmt.pix.height);
- vcam_->invokeMethod(&V4L2Camera::configure, ConnectionTypeBlocking,
- &ret, &streamConfig_, size,
- v4l2ToDrm(arg->fmt.pix.pixelformat), bufferCount_);
+ ret = vcam_->invokeMethod(&V4L2Camera::configure,
+ ConnectionTypeBlocking,
+ &streamConfig_, size,
+ v4l2ToDrm(arg->fmt.pix.pixelformat),
+ bufferCount_);
if (ret < 0)
return -EINVAL;
@@ -297,9 +297,8 @@ int V4L2CameraProxy::freeBuffers()
{
LOG(V4L2Compat, Debug) << "Freeing libcamera bufs";
- int ret;
- vcam_->invokeMethod(&V4L2Camera::streamOff,
- ConnectionTypeBlocking, &ret);
+ int ret = vcam_->invokeMethod(&V4L2Camera::streamOff,
+ ConnectionTypeBlocking);
if (ret < 0) {
LOG(V4L2Compat, Error) << "Failed to stop stream";
return ret;
@@ -327,10 +326,11 @@ int V4L2CameraProxy::vidioc_reqbufs(struct v4l2_requestbuffers *arg)
return freeBuffers();
Size size(curV4L2Format_.fmt.pix.width, curV4L2Format_.fmt.pix.height);
- vcam_->invokeMethod(&V4L2Camera::configure, ConnectionTypeBlocking,
- &ret, &streamConfig_, size,
- v4l2ToDrm(curV4L2Format_.fmt.pix.pixelformat),
- arg->count);
+ ret = vcam_->invokeMethod(&V4L2Camera::configure,
+ ConnectionTypeBlocking,
+ &streamConfig_, size,
+ v4l2ToDrm(curV4L2Format_.fmt.pix.pixelformat),
+ arg->count);
if (ret < 0)
return -EINVAL;
@@ -343,8 +343,8 @@ int V4L2CameraProxy::vidioc_reqbufs(struct v4l2_requestbuffers *arg)
arg->count = streamConfig_.bufferCount;
bufferCount_ = arg->count;
- vcam_->invokeMethod(&V4L2Camera::allocBuffers,
- ConnectionTypeBlocking, &ret, arg->count);
+ ret = vcam_->invokeMethod(&V4L2Camera::allocBuffers,
+ ConnectionTypeBlocking, arg->count);
if (ret < 0) {
arg->count = 0;
return ret;
@@ -392,9 +392,8 @@ int V4L2CameraProxy::vidioc_qbuf(struct v4l2_buffer *arg)
arg->index >= bufferCount_)
return -EINVAL;
- int ret;
- vcam_->invokeMethod(&V4L2Camera::qbuf, ConnectionTypeBlocking,
- &ret, arg->index);
+ int ret = vcam_->invokeMethod(&V4L2Camera::qbuf, ConnectionTypeBlocking,
+ arg->index);
if (ret < 0)
return ret;
@@ -437,9 +436,8 @@ int V4L2CameraProxy::vidioc_streamon(int *arg)
if (!validateBufferType(*arg))
return -EINVAL;
- int ret;
- vcam_->invokeMethod(&V4L2Camera::streamOn,
- ConnectionTypeBlocking, &ret);
+ int ret = vcam_->invokeMethod(&V4L2Camera::streamOn,
+ ConnectionTypeBlocking);
return ret;
}
@@ -451,9 +449,8 @@ int V4L2CameraProxy::vidioc_streamoff(int *arg)
if (!validateBufferType(*arg))
return -EINVAL;
- int ret;
- vcam_->invokeMethod(&V4L2Camera::streamOff,
- ConnectionTypeBlocking, &ret);
+ int ret = vcam_->invokeMethod(&V4L2Camera::streamOff,
+ ConnectionTypeBlocking);
for (struct v4l2_buffer &buf : buffers_)
buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE);