[libcamera-devel] [RFC PATCH v4 03/21] android: metadata: Fix addEntry template type

Jacopo Mondi jacopo at jmondi.org
Sat Jul 17 11:59:53 CEST 2021


Hi Paul,

On Fri, Jul 16, 2021 at 07:56:13PM +0900, Paul Elder wrote:
> Since we set entries with android tags directly, which are enums and not
> arithmetic types, the addEntry template fails to match. Fix this by also
> allowing enum values in addEntry.
>
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
>

Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j

> ---
> New in v4
> ---
>  src/android/camera_metadata.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/android/camera_metadata.h b/src/android/camera_metadata.h
> index 03b3e701..60be416c 100644
> --- a/src/android/camera_metadata.h
> +++ b/src/android/camera_metadata.h
> @@ -34,7 +34,8 @@ public:
>  	bool hasEntry(uint32_t tag) const;
>
>  	template<typename T,
> -		 std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
> +		 std::enable_if_t<std::is_arithmetic_v<T> ||
> +				  std::is_enum_v<T>> * = nullptr>
>  	bool addEntry(uint32_t tag, const T &data)
>  	{
>  		return addEntry(tag, &data, 1, sizeof(T));
> --
> 2.27.0
>


More information about the libcamera-devel mailing list