[libcamera-devel,v2,1/3] libcamera: pipelines: rename MediaDevice member for UVC and VIMC

Message ID 20190125143951.27992-2-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: pipeline: uvcvideo: attach to a V4L2Device
Related show

Commit Message

Niklas Söderlund Jan. 25, 2019, 2:39 p.m. UTC
The name dev_ do a poor job of representing that it holds a media
device, rename it to media_. There is no functional change in this
change just s/dev_/media_/.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/pipeline/uvcvideo.cpp | 18 +++++++++---------
 src/libcamera/pipeline/vimc.cpp     | 14 +++++++-------
 2 files changed, 16 insertions(+), 16 deletions(-)

Comments

Laurent Pinchart Jan. 25, 2019, 2:46 p.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Fri, Jan 25, 2019 at 03:39:49PM +0100, Niklas Söderlund wrote:
> The name dev_ do a poor job of representing that it holds a media

s/do/does/

> device, rename it to media_. There is no functional change in this
> change just s/dev_/media_/.
> 
> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

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

> ---
>  src/libcamera/pipeline/uvcvideo.cpp | 18 +++++++++---------
>  src/libcamera/pipeline/vimc.cpp     | 14 +++++++-------
>  2 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
> index f84fa41515f1a439..5de8a0cb9c3406a8 100644
> --- a/src/libcamera/pipeline/uvcvideo.cpp
> +++ b/src/libcamera/pipeline/uvcvideo.cpp
> @@ -22,34 +22,34 @@ public:
>  	bool match(DeviceEnumerator *enumerator);
>  
>  private:
> -	std::shared_ptr<MediaDevice> dev_;
> +	std::shared_ptr<MediaDevice> media_;
>  };
>  
>  PipelineHandlerUVC::PipelineHandlerUVC(CameraManager *manager)
> -	: PipelineHandler(manager), dev_(nullptr)
> +	: PipelineHandler(manager), media_(nullptr)
>  {
>  }
>  
>  PipelineHandlerUVC::~PipelineHandlerUVC()
>  {
> -	if (dev_)
> -		dev_->release();
> +	if (media_)
> +		media_->release();
>  }
>  
>  bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
>  {
>  	DeviceMatch dm("uvcvideo");
>  
> -	dev_ = std::move(enumerator->search(dm));
> +	media_ = std::move(enumerator->search(dm));
>  
> -	if (!dev_)
> +	if (!media_)
>  		return false;
>  
> -	dev_->acquire();
> +	media_->acquire();
>  
> -	std::shared_ptr<Camera> camera = Camera::create(this, dev_->model());
> +	std::shared_ptr<Camera> camera = Camera::create(this, media_->model());
>  	registerCamera(std::move(camera));
> -	hotplugMediaDevice(dev_.get());
> +	hotplugMediaDevice(media_.get());
>  
>  	return true;
>  }
> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
> index b714a07688e91a02..f58a97d51619515d 100644
> --- a/src/libcamera/pipeline/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc.cpp
> @@ -22,18 +22,18 @@ public:
>  	bool match(DeviceEnumerator *enumerator);
>  
>  private:
> -	std::shared_ptr<MediaDevice> dev_;
> +	std::shared_ptr<MediaDevice> media_;
>  };
>  
>  PipeHandlerVimc::PipeHandlerVimc(CameraManager *manager)
> -	: PipelineHandler(manager), dev_(nullptr)
> +	: PipelineHandler(manager), media_(nullptr)
>  {
>  }
>  
>  PipeHandlerVimc::~PipeHandlerVimc()
>  {
> -	if (dev_)
> -		dev_->release();
> +	if (media_)
> +		media_->release();
>  }
>  
>  bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
> @@ -50,11 +50,11 @@ bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
>  	dm.add("RGB/YUV Input");
>  	dm.add("Scaler");
>  
> -	dev_ = std::move(enumerator->search(dm));
> -	if (!dev_)
> +	media_ = std::move(enumerator->search(dm));
> +	if (!media_)
>  		return false;
>  
> -	dev_->acquire();
> +	media_->acquire();
>  
>  	std::shared_ptr<Camera> camera = Camera::create(this, "Dummy VIMC Camera");
>  	registerCamera(std::move(camera));

Patch

diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index f84fa41515f1a439..5de8a0cb9c3406a8 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -22,34 +22,34 @@  public:
 	bool match(DeviceEnumerator *enumerator);
 
 private:
-	std::shared_ptr<MediaDevice> dev_;
+	std::shared_ptr<MediaDevice> media_;
 };
 
 PipelineHandlerUVC::PipelineHandlerUVC(CameraManager *manager)
-	: PipelineHandler(manager), dev_(nullptr)
+	: PipelineHandler(manager), media_(nullptr)
 {
 }
 
 PipelineHandlerUVC::~PipelineHandlerUVC()
 {
-	if (dev_)
-		dev_->release();
+	if (media_)
+		media_->release();
 }
 
 bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
 {
 	DeviceMatch dm("uvcvideo");
 
-	dev_ = std::move(enumerator->search(dm));
+	media_ = std::move(enumerator->search(dm));
 
-	if (!dev_)
+	if (!media_)
 		return false;
 
-	dev_->acquire();
+	media_->acquire();
 
-	std::shared_ptr<Camera> camera = Camera::create(this, dev_->model());
+	std::shared_ptr<Camera> camera = Camera::create(this, media_->model());
 	registerCamera(std::move(camera));
-	hotplugMediaDevice(dev_.get());
+	hotplugMediaDevice(media_.get());
 
 	return true;
 }
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index b714a07688e91a02..f58a97d51619515d 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -22,18 +22,18 @@  public:
 	bool match(DeviceEnumerator *enumerator);
 
 private:
-	std::shared_ptr<MediaDevice> dev_;
+	std::shared_ptr<MediaDevice> media_;
 };
 
 PipeHandlerVimc::PipeHandlerVimc(CameraManager *manager)
-	: PipelineHandler(manager), dev_(nullptr)
+	: PipelineHandler(manager), media_(nullptr)
 {
 }
 
 PipeHandlerVimc::~PipeHandlerVimc()
 {
-	if (dev_)
-		dev_->release();
+	if (media_)
+		media_->release();
 }
 
 bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
@@ -50,11 +50,11 @@  bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
 	dm.add("RGB/YUV Input");
 	dm.add("Scaler");
 
-	dev_ = std::move(enumerator->search(dm));
-	if (!dev_)
+	media_ = std::move(enumerator->search(dm));
+	if (!media_)
 		return false;
 
-	dev_->acquire();
+	media_->acquire();
 
 	std::shared_ptr<Camera> camera = Camera::create(this, "Dummy VIMC Camera");
 	registerCamera(std::move(camera));