[libcamera-devel,1/3] android: camera_device: Refuse unsupported templates
diff mbox series

Message ID 20210308170728.2212649-2-jacopo@jmondi.org
State Accepted
Headers show
Series
  • android: Fix capture templates for video recording
Related show

Commit Message

Jacopo Mondi March 8, 2021, 5:07 p.m. UTC
The current implementation of constructDefaultRequestSettings()
returns the same capture template for all the capture intent.

As the correctness of the generated template is verified by CTS it
is better to return an error for unsupported capture use cases.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Laurent Pinchart March 8, 2021, 11:58 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Mon, Mar 08, 2021 at 06:07:26PM +0100, Jacopo Mondi wrote:
> The current implementation of constructDefaultRequestSettings()
> returns the same capture template for all the capture intent.
> 
> As the correctness of the generated template is verified by CTS it
> is better to return an error for unsupported capture use cases.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

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

> ---
>  src/android/camera_device.cpp | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 6a10b09938fa..c72e0c73eb5e 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -1495,14 +1495,11 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)
>  	case CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:
>  		captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;
>  		break;
> +	/* \todo Implement templates generation for the remaining use cases. */
>  	case CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:
> -		captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG;
> -		break;
>  	case CAMERA3_TEMPLATE_MANUAL:
> -		captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_MANUAL;
> -		break;
>  	default:
> -		LOG(HAL, Error) << "Invalid template request type: " << type;
> +		LOG(HAL, Error) << "Unsupported template request type: " << type;
>  		return nullptr;
>  	}
>

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 6a10b09938fa..c72e0c73eb5e 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1495,14 +1495,11 @@  const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)
 	case CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:
 		captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;
 		break;
+	/* \todo Implement templates generation for the remaining use cases. */
 	case CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:
-		captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG;
-		break;
 	case CAMERA3_TEMPLATE_MANUAL:
-		captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_MANUAL;
-		break;
 	default:
-		LOG(HAL, Error) << "Invalid template request type: " << type;
+		LOG(HAL, Error) << "Unsupported template request type: " << type;
 		return nullptr;
 	}