[libcamera-devel,v3,3/4] android: post_processor_jpeg: Make |cameraDevice_| constant
diff mbox series

Message ID 20201021013955.301790-3-hiroh@chromium.org
State Accepted
Commit 79bca4300b6582fe018967e8483eb584583d2a96
Headers show
Series
  • [libcamera-devel,v3,1/4] android: Modify PostProcessor interface
Related show

Commit Message

Hirokazu Honda Oct. 21, 2020, 1:39 a.m. UTC
PostProcessorJpeg doesn't have the ownership of CameraDevice given
in the constructor. To clarify it, this makes the member variable
constant.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/android/jpeg/post_processor_jpeg.cpp | 2 +-
 src/android/jpeg/post_processor_jpeg.h   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Umang Jain Oct. 22, 2020, 7:39 a.m. UTC | #1
Hi Hiro,

Thanks for the patch.

On 10/21/20 7:09 AM, Hirokazu Honda wrote:
> PostProcessorJpeg doesn't have the ownership of CameraDevice given
> in the constructor. To clarify it, this makes the member variable
> constant.
>
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Umang Jain <email@uajain.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>   src/android/jpeg/post_processor_jpeg.cpp | 2 +-
>   src/android/jpeg/post_processor_jpeg.h   | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp
> index 8b01bd6..fd1c7be 100644
> --- a/src/android/jpeg/post_processor_jpeg.cpp
> +++ b/src/android/jpeg/post_processor_jpeg.cpp
> @@ -20,7 +20,7 @@ using namespace libcamera;
>   
>   LOG_DEFINE_CATEGORY(JPEG)
>   
> -PostProcessorJpeg::PostProcessorJpeg(CameraDevice *device)
> +PostProcessorJpeg::PostProcessorJpeg(CameraDevice *const device)
>   	: cameraDevice_(device)
>   {
>   }
> diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h
> index ae636ff..3706cec 100644
> --- a/src/android/jpeg/post_processor_jpeg.h
> +++ b/src/android/jpeg/post_processor_jpeg.h
> @@ -19,7 +19,7 @@ class CameraDevice;
>   class PostProcessorJpeg : public PostProcessor
>   {
>   public:
> -	PostProcessorJpeg(CameraDevice *device);
> +	PostProcessorJpeg(CameraDevice *const device);
>   
>   	int configure(const libcamera::StreamConfiguration &incfg,
>   		      const libcamera::StreamConfiguration &outcfg) override;
> @@ -28,7 +28,7 @@ public:
>   		    CameraMetadata *metadata) override;
>   
>   private:
> -	CameraDevice *cameraDevice_;
> +	CameraDevice *const cameraDevice_;
This (and by extension above changes too) will get realigned to match 
the format of the prefixed `const` for constant pointer(s). The prefixed 
style is used almost through-out the codebase so it is likely we will 
continue using that. :)
>   	std::unique_ptr<Encoder> encoder_;
>   	libcamera::Size streamSize_;
>   };

Patch
diff mbox series

diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp
index 8b01bd6..fd1c7be 100644
--- a/src/android/jpeg/post_processor_jpeg.cpp
+++ b/src/android/jpeg/post_processor_jpeg.cpp
@@ -20,7 +20,7 @@  using namespace libcamera;
 
 LOG_DEFINE_CATEGORY(JPEG)
 
-PostProcessorJpeg::PostProcessorJpeg(CameraDevice *device)
+PostProcessorJpeg::PostProcessorJpeg(CameraDevice *const device)
 	: cameraDevice_(device)
 {
 }
diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h
index ae636ff..3706cec 100644
--- a/src/android/jpeg/post_processor_jpeg.h
+++ b/src/android/jpeg/post_processor_jpeg.h
@@ -19,7 +19,7 @@  class CameraDevice;
 class PostProcessorJpeg : public PostProcessor
 {
 public:
-	PostProcessorJpeg(CameraDevice *device);
+	PostProcessorJpeg(CameraDevice *const device);
 
 	int configure(const libcamera::StreamConfiguration &incfg,
 		      const libcamera::StreamConfiguration &outcfg) override;
@@ -28,7 +28,7 @@  public:
 		    CameraMetadata *metadata) override;
 
 private:
-	CameraDevice *cameraDevice_;
+	CameraDevice *const cameraDevice_;
 	std::unique_ptr<Encoder> encoder_;
 	libcamera::Size streamSize_;
 };