diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-05 04:03:37 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-07 22:35:26 +0200 |
commit | aff0b680aa9b05d5854ef1c1fb4f268f26383b02 (patch) | |
tree | 67f007556b878d5fafcd3bb94627a27cf405df2d /src/v4l2/v4l2_camera_proxy.cpp | |
parent | 7088041a805d3be8a1d8b7d4c28cc1cecccf4396 (diff) |
v4l2: camera_proxy: Rationalize arguments to format helpers
To clarify code, adopt the following rules for format helpers:
- All variables representing V4L2 pixel formats shall use uint32_t
- All variables representing DRM pixel formats shall use PixelFormat
- Functions returning positive values only shall not have a signed
return type
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.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 2eeb1239..c7ef4d51 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -509,7 +509,7 @@ int V4L2CameraProxy::ioctl(unsigned long request, void *arg) } /* \todo make libcamera export these */ -int V4L2CameraProxy::bplMultiplier(unsigned int format) +unsigned int V4L2CameraProxy::bplMultiplier(uint32_t format) { switch (format) { case V4L2_PIX_FMT_NV12: @@ -534,8 +534,8 @@ int V4L2CameraProxy::bplMultiplier(unsigned int format) }; } -int V4L2CameraProxy::imageSize(unsigned int format, - unsigned int width, unsigned int height) +unsigned int V4L2CameraProxy::imageSize(uint32_t format, unsigned int width, + unsigned int height) { switch (format) { case V4L2_PIX_FMT_NV12: @@ -562,9 +562,9 @@ int V4L2CameraProxy::imageSize(unsigned int format, }; } -unsigned int V4L2CameraProxy::v4l2ToDrm(unsigned int pixelformat) +PixelFormat V4L2CameraProxy::v4l2ToDrm(uint32_t format) { - switch (pixelformat) { + switch (format) { /* RGB formats. */ case V4L2_PIX_FMT_RGB24: return DRM_FORMAT_BGR888; @@ -597,13 +597,13 @@ unsigned int V4L2CameraProxy::v4l2ToDrm(unsigned int pixelformat) case V4L2_PIX_FMT_NV42: return DRM_FORMAT_NV42; default: - return pixelformat; + return format; }; } -unsigned int V4L2CameraProxy::drmToV4L2(unsigned int pixelformat) +uint32_t V4L2CameraProxy::drmToV4L2(PixelFormat format) { - switch (pixelformat) { + switch (format) { /* RGB formats. */ case DRM_FORMAT_BGR888: return V4L2_PIX_FMT_RGB24; @@ -636,6 +636,6 @@ unsigned int V4L2CameraProxy::drmToV4L2(unsigned int pixelformat) case DRM_FORMAT_NV42: return V4L2_PIX_FMT_NV42; default: - return pixelformat; + return format; } } |