[libcamera-devel] [PATCH 5/8] libcamera: v4l2_videodevice: Expose the device capabilities

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Mar 16 17:02:17 CET 2020


Hi Laurent,

Thanks for your work.

On 2020-03-14 01:38:53 +0200, Laurent Pinchart wrote:
> Add a caps() function that exposes the V4L2 capabilities for the device.
> This is useful for generic code that can't hardcode any a priori
> knowledge of the device, such as in a simple pipeline handler.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  src/libcamera/include/v4l2_videodevice.h | 2 ++
>  src/libcamera/v4l2_videodevice.cpp       | 6 ++++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h
> index 72e7a50e6c3d..b2e12608084a 100644
> --- a/src/libcamera/include/v4l2_videodevice.h
> +++ b/src/libcamera/include/v4l2_videodevice.h
> @@ -182,6 +182,8 @@ public:
>  	const char *deviceName() const { return caps_.card(); }
>  	const char *busName() const { return caps_.bus_info(); }
>  
> +	const V4L2Capability &caps() const { return caps_; }
> +
>  	int getFormat(V4L2DeviceFormat *format);
>  	int setFormat(V4L2DeviceFormat *format);
>  	ImageFormats formats(uint32_t code = 0);
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index ccc5faba3c27..86b262ba2436 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -625,6 +625,12 @@ void V4L2VideoDevice::close()
>   * \return The string containing the device location
>   */
>  
> +/**
> + * \fn V4L2VideoDevice::caps()
> + * \brief Retrieve the device V4L2 capabilities
> + * \return The device V4L2 capabilities
> + */
> +
>  std::string V4L2VideoDevice::logPrefix() const
>  {
>  	return deviceNode() + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? "[out]" : "[cap]");
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list