From 53a068a42aefee50df5630c84425378b1cacd642 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Wed, 28 Mar 2018 11:33:09 +0100 Subject: [PATCH] Camera: Update camera docs about external device orientation The orientation and facing of external devices cannot be used for calculating the jpeg orientation. Bug: 72261912 Test: Android compiles without errors Change-Id: Ide8dcdb709dfb2c43a72241c9bf3f65af8d23d87 --- camera/ndk/include/camera/NdkCameraMetadataTags.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h index 346761c174..b3a3802e23 100644 --- a/camera/ndk/include/camera/NdkCameraMetadataTags.h +++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h @@ -1909,8 +1909,8 @@ typedef enum acamera_metadata_tag { * the thumbnail data will also be rotated.

*

Note that this orientation is relative to the orientation of the camera sensor, given * by ACAMERA_SENSOR_ORIENTATION.

- *

To translate from the device orientation given by the Android sensor APIs, the following - * sample code may be used:

+ *

To translate from the device orientation given by the Android sensor APIs for camera + * sensors which are not EXTERNAL, the following sample code may be used:

*
private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
      *     if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
      *     int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
@@ -1929,6 +1929,8 @@ typedef enum acamera_metadata_tag {
      *     return jpegOrientation;
      * }
      * 
+ *

For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will + * also be set to EXTERNAL. The above code is not relevant in such case.

* * @see ACAMERA_SENSOR_ORIENTATION */