[libcamera-devel] [PATCH v3 2/6] libcamera: stream: add initial StreamConfiguration class
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sun Jan 27 23:31:28 CET 2019
Hi Niklas,
Thank you for the patch.
On Sun, Jan 27, 2019 at 01:22:04AM +0100, Niklas Söderlund wrote:
> Add an initial StreamConfiguration implementation to hold configuration
> data for a single stream of a Camera. In its current form not many
> configuration parameters are supported but it's expected the number of
> options will grow over time.
>
> At this stage the pixel format is represented as an unsigned int to
> allow for easy mapping to the V4L2 API. This might be subject to change
> in the future as we finalize how libcamera shall represent pixel
> formats.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> include/libcamera/stream.h | 10 ++++++++++
> src/libcamera/stream.cpp | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 41 insertions(+)
>
> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
> index 580f2cc8d3a3ad59..e7597dd5a9492c2a 100644
> --- a/include/libcamera/stream.h
> +++ b/include/libcamera/stream.h
> @@ -20,6 +20,16 @@ private:
> unsigned int id_;
> };
>
> +class StreamConfiguration final
I might have made this a struct as everything is public, and I'm not
sure if we need to make the class final. What do you think ? We can also
update this later as needed.
> +{
> +public:
> + StreamConfiguration();
> +
> + unsigned int width;
> + unsigned int height;
> + unsigned int pixelFormat;
> +};
> +
> } /* namespace libcamera */
>
> #endif /* __LIBCAMERA_STREAM_H__ */
> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> index 307de3710d0ac6b1..530668a478a79c94 100644
> --- a/src/libcamera/stream.cpp
> +++ b/src/libcamera/stream.cpp
> @@ -64,4 +64,35 @@ Stream::Stream(unsigned int id)
> * \return The stream ID
> */
>
> +/**
> + * \class StreamConfiguration
> + * \brief Configuration parameters for a stream
> + *
> + * The StreamConfiguration class is a model of all information which can be
s/is a model of/models/
> + * configured for a single video stream.
> + */
> +
> +StreamConfiguration::StreamConfiguration()
> + : width(0), height(0), pixelFormat(0)
> +{
> +}
> +
> +/**
> + * \var StreamConfiguration::width
> + * \brief Stream width in pixels
> + */
> +
> +/**
> + * \var StreamConfiguration::height
> + * \brief Stream height in pixels
> + */
> +
> +/**
> + * \var StreamConfiguration::pixelFormat
> + * \brief Stream pixel format or type of compression
Is "type of compression" not a pixel format ?
> + *
> + * This is a little endian four character code representation of the pixel
> + * format described in V4L2 using the V4L2_PIX_FMT_* definitions.
> + */
I think we'll need more documentation, but that's not a blocker for now.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> } /* namespace libcamera */
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list