[libcamera-devel] [PATCH v4 01/12] libcamera: ipu3: Sub-class Stream with IPU3Stream

Niklas Söderlund niklas.soderlund at ragnatech.se
Sun Apr 14 22:48:59 CEST 2019


Hi Jacopo,

Thanks for your work.

On 2019-04-09 21:25:37 +0200, Jacopo Mondi wrote:
> In preparation for multiple stream support provide a Stream sub-class to
> maintain IPU3 specific data. In order to be able to sub-class Stream
> remove the 'final' specifier from the class definition and make its
> private members protected.

I liked that Stream was final, towards applications. I assume we will 
make it so again once we introduce d-pointers :-)

This patch should be split in two, one touching stream.h whit a commit 
message explaining why Stream needs to be able to be sub-classed and one 
touching ipu3.cpp making use of the change.

The changes themself are good.

> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  include/libcamera/stream.h           |  4 ++--
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 16 ++++++++++++++--
>  2 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
> index d0f7b0e12485..8a47930f8614 100644
> --- a/include/libcamera/stream.h
> +++ b/include/libcamera/stream.h
> @@ -43,7 +43,7 @@ private:
>  	Size size_;
>  };
>  
> -class Stream final
> +class Stream
>  {
>  public:
>  	class StillCapture : public StreamUsage
> @@ -68,7 +68,7 @@ public:
>  	BufferPool &bufferPool() { return bufferPool_; }
>  	const StreamConfiguration &configuration() const { return configuration_; }
>  
> -private:
> +protected:
>  	friend class Camera;
>  
>  	BufferPool bufferPool_;
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index ca09da753b90..00907bb53891 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -133,6 +133,18 @@ public:
>  	BufferPool pool_;
>  };
>  
> +class IPU3Stream : public Stream
> +{
> +public:
> +	IPU3Stream()
> +		: active_(false)
> +	{
> +	}
> +
> +	bool active_;
> +	std::string name_;
> +};
> +
>  class PipelineHandlerIPU3 : public PipelineHandler
>  {
>  public:
> @@ -171,7 +183,7 @@ private:
>  		CIO2Device cio2_;
>  		ImgUDevice *imgu_;
>  
> -		Stream stream_;
> +		IPU3Stream stream_;
>  	};
>  
>  	static constexpr unsigned int IPU3_BUFFER_COUNT = 4;
> @@ -404,7 +416,7 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)
>  {
>  	IPU3CameraData *data = cameraData(camera);
>  	V4L2Device *output = data->imgu_->output_.dev;
> -	Stream *stream = &data->stream_;
> +	IPU3Stream *stream = &data->stream_;
>  
>  	/* Queue a buffer to the ImgU output for capture. */
>  	Buffer *buffer = request->findBuffer(stream);
> -- 
> 2.21.0
> 
> _______________________________________________
> 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