[libcamera-devel] android: camera_device: Mark ToPixelFormat() a const function
diff mbox series

Message ID 20201028095023.3004701-1-hiroh@chromium.org
State Accepted
Headers show
Series
  • [libcamera-devel] android: camera_device: Mark ToPixelFormat() a const function
Related show

Commit Message

Hirokazu Honda Oct. 28, 2020, 9:50 a.m. UTC
CameraDevice::ToPixelFormat() doesn't change the state of the
CameraDevice. Marks it a const function so that it can be called
in const functions.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 src/android/camera_device.cpp | 2 +-
 src/android/camera_device.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.29.0.rc2.309.g374f81d7ae-goog

Comments

Kieran Bingham Oct. 28, 2020, 10:18 a.m. UTC | #1
Hi Hiro-san,

On 28/10/2020 09:50, Hirokazu Honda wrote:
> CameraDevice::ToPixelFormat() doesn't change the state of the

s/ToPixelFormat/toPixelFormat/

> CameraDevice. Marks it a const function so that it can be called
> in const functions.
> 
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/android/camera_device.cpp | 2 +-
>  src/android/camera_device.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index ca60f51..6369d49 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -1188,7 +1188,7 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)
>  	return requestTemplate->get();
>  }
> 
> -PixelFormat CameraDevice::toPixelFormat(int format)
> +PixelFormat CameraDevice::toPixelFormat(int format) const
>  {
>  	/* Translate Android format code to libcamera pixel format. */
>  	auto it = formatsMap_.find(format);
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index fd08738..45efcf4 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -104,7 +104,7 @@ private:
>  	void notifyShutter(uint32_t frameNumber, uint64_t timestamp);
>  	void notifyError(uint32_t frameNumber, camera3_stream_t *stream);
>  	CameraMetadata *requestTemplatePreview();
> -	libcamera::PixelFormat toPixelFormat(int format);
> +	libcamera::PixelFormat toPixelFormat(int format) const;
>  	std::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,
>  							  int64_t timestamp);
> 
> --
> 2.29.0.rc2.309.g374f81d7ae-goog
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>
Niklas Söderlund Oct. 28, 2020, 1:08 p.m. UTC | #2
Hi Hirokazu-san,

Thanks for your work.

On 2020-10-28 18:50:23 +0900, Hirokazu Honda wrote:
> CameraDevice::ToPixelFormat() doesn't change the state of the
> CameraDevice. Marks it a const function so that it can be called
> in const functions.
> 
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>

With the typo pointed out by Kieran fixed,

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/android/camera_device.cpp | 2 +-
>  src/android/camera_device.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index ca60f51..6369d49 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -1188,7 +1188,7 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)
>  	return requestTemplate->get();
>  }
> 
> -PixelFormat CameraDevice::toPixelFormat(int format)
> +PixelFormat CameraDevice::toPixelFormat(int format) const
>  {
>  	/* Translate Android format code to libcamera pixel format. */
>  	auto it = formatsMap_.find(format);
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index fd08738..45efcf4 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -104,7 +104,7 @@ private:
>  	void notifyShutter(uint32_t frameNumber, uint64_t timestamp);
>  	void notifyError(uint32_t frameNumber, camera3_stream_t *stream);
>  	CameraMetadata *requestTemplatePreview();
> -	libcamera::PixelFormat toPixelFormat(int format);
> +	libcamera::PixelFormat toPixelFormat(int format) const;
>  	std::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,
>  							  int64_t timestamp);
> 
> --
> 2.29.0.rc2.309.g374f81d7ae-goog
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index ca60f51..6369d49 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1188,7 +1188,7 @@  const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)
 	return requestTemplate->get();
 }

-PixelFormat CameraDevice::toPixelFormat(int format)
+PixelFormat CameraDevice::toPixelFormat(int format) const
 {
 	/* Translate Android format code to libcamera pixel format. */
 	auto it = formatsMap_.find(format);
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index fd08738..45efcf4 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -104,7 +104,7 @@  private:
 	void notifyShutter(uint32_t frameNumber, uint64_t timestamp);
 	void notifyError(uint32_t frameNumber, camera3_stream_t *stream);
 	CameraMetadata *requestTemplatePreview();
-	libcamera::PixelFormat toPixelFormat(int format);
+	libcamera::PixelFormat toPixelFormat(int format) const;
 	std::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,
 							  int64_t timestamp);