[libcamera-devel] [PATCH 2/2] Fixed naming, delete unused include and simplify frameDuration calculation
Nejc Galof
galof.nejc at gmail.com
Fri Feb 25 15:14:03 CET 2022
Signed-off-by: Nejc Galof <galof.nejc at gmail.com>
---
src/v4l2/v4l2_camera.h | 2 --
src/v4l2/v4l2_camera_proxy.cpp | 7 +++----
src/v4l2/v4l2_camera_proxy.h | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
index 9e6c895a..4c203e31 100644
--- a/src/v4l2/v4l2_camera.h
+++ b/src/v4l2/v4l2_camera.h
@@ -10,8 +10,6 @@
#include <deque>
#include <utility>
-#include <linux/videodev2.h>
-
#include <libcamera/base/mutex.h>
#include <libcamera/base/semaphore.h>
#include <libcamera/base/shared_fd.h>
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 8da42068..493c41c0 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -758,7 +758,7 @@ int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg)
return ret;
}
-int V4L2CameraProxy::vidioc_s_param(V4L2CameraFile *file, struct v4l2_streamparm *arg)
+int V4L2CameraProxy::vidioc_s_parm(V4L2CameraFile *file, struct v4l2_streamparm *arg)
{
LOG(V4L2Compat, Debug)
<< "[" << file->description() << "] " << __func__ << "()";
@@ -767,8 +767,7 @@ int V4L2CameraProxy::vidioc_s_param(V4L2CameraFile *file, struct v4l2_streamparm
return -EINVAL;
struct v4l2_fract *timeperframe = &arg->parm.capture.timeperframe;
- utils::Duration frameDuration = 1s * (static_cast<double>(timeperframe->numerator) /
- static_cast<double>(timeperframe->denominator));
+ utils::Duration frameDuration = 1.0s * timeperframe->numerator / timeperframe->denominator;
int64_t uDuration = frameDuration.get<std::micro>();
vcam_->controls().set(controls::FrameDurationLimits, { uDuration, uDuration });
@@ -875,7 +874,7 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar
ret = vidioc_streamoff(file, static_cast<int *>(arg));
break;
case VIDIOC_S_PARM:
- ret = vidioc_s_param(file, static_cast<struct v4l2_streamparm *>(arg));
+ ret = vidioc_s_parm(file, static_cast<struct v4l2_streamparm *>(arg));
break;
default:
ret = -ENOTTY;
diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h
index 30a3f492..c1aeaff9 100644
--- a/src/v4l2/v4l2_camera_proxy.h
+++ b/src/v4l2/v4l2_camera_proxy.h
@@ -65,7 +65,7 @@ private:
int vidioc_expbuf(V4L2CameraFile *file, struct v4l2_exportbuffer *arg);
int vidioc_streamon(V4L2CameraFile *file, int *arg);
int vidioc_streamoff(V4L2CameraFile *file, int *arg);
- int vidioc_s_param(V4L2CameraFile *file, struct v4l2_streamparm *arg);
+ int vidioc_s_parm(V4L2CameraFile *file, struct v4l2_streamparm *arg);
bool hasOwnership(V4L2CameraFile *file);
int acquire(V4L2CameraFile *file);
--
2.17.1
More information about the libcamera-devel
mailing list