[libcamera-devel] [PATCH v3 04/33] v4l2: Rename FrameMetadata to V4L2FrameMetadata

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Jan 11 00:08:17 CET 2020


Hi Niklas,

Thank you for the patch.

On Fri, Jan 10, 2020 at 08:37:39PM +0100, Niklas Söderlund wrote:
> With the upcoming FrameBuffer API a new library wide FrameMetadata
> object will be added which will replace the specific implementation in
> the V4L2 compatibility layer.
> 
> Avoid name collisions while the new FrameBuffer API is added by renaming
> the V4L2 compatibility layer specific implementation until it can be
> replaced with the library wide implementation.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> ---
>  src/v4l2/v4l2_camera.cpp       | 12 ++++++------
>  src/v4l2/v4l2_camera.h         |  8 ++++----
>  src/v4l2/v4l2_camera_proxy.cpp |  4 ++--
>  3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp
> index 4545483cf1c7373c..2a507b9bb8318025 100644
> --- a/src/v4l2/v4l2_camera.cpp
> +++ b/src/v4l2/v4l2_camera.cpp
> @@ -16,7 +16,7 @@ using namespace libcamera;
>  
>  LOG_DECLARE_CATEGORY(V4L2Compat);
>  
> -FrameMetadata::FrameMetadata(Buffer *buffer)
> +V4L2FrameMetadata::V4L2FrameMetadata(Buffer *buffer)
>  	: index_(buffer->index()), bytesused_(buffer->bytesused()),
>  	  timestamp_(buffer->timestamp()), sequence_(buffer->sequence()),
>  	  status_(buffer->status())
> @@ -61,12 +61,12 @@ void V4L2Camera::getStreamConfig(StreamConfiguration *streamConfig)
>  	*streamConfig = config_->at(0);
>  }
>  
> -std::vector<FrameMetadata> V4L2Camera::completedBuffers()
> +std::vector<V4L2FrameMetadata> V4L2Camera::completedBuffers()
>  {
> -	std::vector<FrameMetadata> v;
> +	std::vector<V4L2FrameMetadata> v;
>  
>  	bufferLock_.lock();
> -	for (std::unique_ptr<FrameMetadata> &metadata : completedBuffers_)
> +	for (std::unique_ptr<V4L2FrameMetadata> &metadata : completedBuffers_)
>  		v.push_back(*metadata.get());
>  	completedBuffers_.clear();
>  	bufferLock_.unlock();
> @@ -82,8 +82,8 @@ void V4L2Camera::requestComplete(Request *request)
>  	/* We only have one stream at the moment. */
>  	bufferLock_.lock();
>  	Buffer *buffer = request->buffers().begin()->second;
> -	std::unique_ptr<FrameMetadata> metadata =
> -		utils::make_unique<FrameMetadata>(buffer);
> +	std::unique_ptr<V4L2FrameMetadata> metadata =
> +		utils::make_unique<V4L2FrameMetadata>(buffer);
>  	completedBuffers_.push_back(std::move(metadata));
>  	bufferLock_.unlock();
>  
> diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
> index 5a889efdb4a23bd2..81f7908e5e8a6beb 100644
> --- a/src/v4l2/v4l2_camera.h
> +++ b/src/v4l2/v4l2_camera.h
> @@ -19,10 +19,10 @@
>  
>  using namespace libcamera;
>  
> -class FrameMetadata
> +class V4L2FrameMetadata
>  {
>  public:
> -	FrameMetadata(Buffer *buffer);
> +	V4L2FrameMetadata(Buffer *buffer);
>  
>  	int index() const { return index_; }
>  
> @@ -51,7 +51,7 @@ public:
>  	int open();
>  	void close();
>  	void getStreamConfig(StreamConfiguration *streamConfig);
> -	std::vector<FrameMetadata> completedBuffers();
> +	std::vector<V4L2FrameMetadata> completedBuffers();
>  
>  	void *mmap(unsigned int index);
>  
> @@ -79,7 +79,7 @@ private:
>  	std::mutex bufferLock_;
>  
>  	std::deque<std::unique_ptr<Request>> pendingRequests_;
> -	std::deque<std::unique_ptr<FrameMetadata>> completedBuffers_;
> +	std::deque<std::unique_ptr<V4L2FrameMetadata>> completedBuffers_;
>  };
>  
>  #endif /* __V4L2_CAMERA_H__ */
> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> index 00d0d57172022138..52f8468cdaa06a7a 100644
> --- a/src/v4l2/v4l2_camera_proxy.cpp
> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> @@ -174,8 +174,8 @@ void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)
>  
>  void V4L2CameraProxy::updateBuffers()
>  {
> -	std::vector<FrameMetadata> completedBuffers = vcam_->completedBuffers();
> -	for (FrameMetadata &fmd : completedBuffers) {
> +	std::vector<V4L2FrameMetadata> completedBuffers = vcam_->completedBuffers();
> +	for (V4L2FrameMetadata &fmd : completedBuffers) {
>  		struct v4l2_buffer &buf = buffers_[fmd.index()];
>  
>  		switch (fmd.status()) {

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list