Commit 16594f56 authored by Yin-Chia Yeh's avatar Yin-Chia Yeh
Browse files

Camera: add camera NDK API header/symbols (libcamera2ndk.so)

Also update libmediandk.so for adding AImageReader APIs.

Bug: 27102995
Change-Id: I586e80cbb531a2ad70b9223be9c3d27bc3911b85
parent 659eff33
ACameraCaptureSession_abortCaptures
ACameraCaptureSession_capture
ACameraCaptureSession_close
ACameraCaptureSession_getDevice
ACameraCaptureSession_setRepeatingRequest
ACameraCaptureSession_stopRepeating
ACameraDevice_close
ACameraDevice_createCaptureRequest
ACameraDevice_createCaptureSession
ACameraDevice_getId
ACameraManager_create
ACameraManager_delete
ACameraManager_deleteCameraIdList
ACameraManager_getCameraCharacteristics
ACameraManager_getCameraIdList
ACameraManager_openCamera
ACameraManager_registerAvailabilityCallback
ACameraManager_unregisterAvailabilityCallback
ACameraMetadata_copy
ACameraMetadata_free
ACameraMetadata_getAllTags
ACameraMetadata_getConstEntry
ACameraOutputTarget_create
ACameraOutputTarget_free
ACaptureRequest_addTarget
ACaptureRequest_free
ACaptureRequest_getAllTags
ACaptureRequest_getConstEntry
ACaptureRequest_removeTarget
ACaptureRequest_setEntry_double
ACaptureRequest_setEntry_float
ACaptureRequest_setEntry_i32
ACaptureRequest_setEntry_i64
ACaptureRequest_setEntry_rational
ACaptureRequest_setEntry_u8
ACaptureSessionOutputContainer_add
ACaptureSessionOutputContainer_create
ACaptureSessionOutputContainer_free
ACaptureSessionOutputContainer_remove
ACaptureSessionOutput_create
ACaptureSessionOutput_free
AImage_delete
AImage_getCropRect
AImage_getFormat
AImage_getHeight
AImage_getNumberOfPlanes
AImage_getPlaneData
AImage_getPlanePixelStride
AImage_getPlaneRowStride
AImage_getTimestamp
AImage_getWidth
AImageReader_acquireLatestImage
AImageReader_acquireNextImage
AImageReader_delete
AImageReader_getFormat
AImageReader_getHeight
AImageReader_getMaxImages
AImageReader_getWidth
AImageReader_getWindow
AImageReader_new
AImageReader_setImageListener
AMediaCodecCryptoInfo_delete
AMediaCodecCryptoInfo_getClearBytes
AMediaCodecCryptoInfo_getEncryptedBytes
......@@ -6,6 +26,7 @@ AMediaCodecCryptoInfo_getKey
AMediaCodecCryptoInfo_getMode
AMediaCodecCryptoInfo_getNumSubSamples
AMediaCodecCryptoInfo_new
AMediaCodecCryptoInfo_setPattern
AMediaCodec_configure
AMediaCodec_createCodecByName
AMediaCodec_createDecoderByType
......@@ -21,6 +42,7 @@ AMediaCodec_queueInputBuffer
AMediaCodec_queueSecureInputBuffer
AMediaCodec_releaseOutputBuffer
AMediaCodec_releaseOutputBufferAtTime
AMediaCodec_setOutputSurface
AMediaCodec_start
AMediaCodec_stop
AMediaCrypto_delete
......
ACameraCaptureSession_abortCaptures
ACameraCaptureSession_capture
ACameraCaptureSession_close
ACameraCaptureSession_getDevice
ACameraCaptureSession_setRepeatingRequest
ACameraCaptureSession_stopRepeating
ACameraDevice_close
ACameraDevice_createCaptureRequest
ACameraDevice_createCaptureSession
ACameraDevice_getId
ACameraManager_create
ACameraManager_delete
ACameraManager_deleteCameraIdList
ACameraManager_getCameraCharacteristics
ACameraManager_getCameraIdList
ACameraManager_openCamera
ACameraManager_registerAvailabilityCallback
ACameraManager_unregisterAvailabilityCallback
ACameraMetadata_copy
ACameraMetadata_free
ACameraMetadata_getAllTags
ACameraMetadata_getConstEntry
ACameraOutputTarget_create
ACameraOutputTarget_free
ACaptureRequest_addTarget
ACaptureRequest_free
ACaptureRequest_getAllTags
ACaptureRequest_getConstEntry
ACaptureRequest_removeTarget
ACaptureRequest_setEntry_double
ACaptureRequest_setEntry_float
ACaptureRequest_setEntry_i32
ACaptureRequest_setEntry_i64
ACaptureRequest_setEntry_rational
ACaptureRequest_setEntry_u8
ACaptureSessionOutputContainer_add
ACaptureSessionOutputContainer_create
ACaptureSessionOutputContainer_free
ACaptureSessionOutputContainer_remove
ACaptureSessionOutput_create
ACaptureSessionOutput_free
AImage_delete
AImage_getCropRect
AImage_getFormat
AImage_getHeight
AImage_getNumberOfPlanes
AImage_getPlaneData
AImage_getPlanePixelStride
AImage_getPlaneRowStride
AImage_getTimestamp
AImage_getWidth
AImageReader_acquireLatestImage
AImageReader_acquireNextImage
AImageReader_delete
AImageReader_getFormat
AImageReader_getHeight
AImageReader_getMaxImages
AImageReader_getWidth
AImageReader_getWindow
AImageReader_new
AImageReader_setImageListener
AMediaCodecCryptoInfo_delete
AMediaCodecCryptoInfo_getClearBytes
AMediaCodecCryptoInfo_getEncryptedBytes
......@@ -6,6 +26,7 @@ AMediaCodecCryptoInfo_getKey
AMediaCodecCryptoInfo_getMode
AMediaCodecCryptoInfo_getNumSubSamples
AMediaCodecCryptoInfo_new
AMediaCodecCryptoInfo_setPattern
AMediaCodec_configure
AMediaCodec_createCodecByName
AMediaCodec_createDecoderByType
......@@ -21,6 +42,7 @@ AMediaCodec_queueInputBuffer
AMediaCodec_queueSecureInputBuffer
AMediaCodec_releaseOutputBuffer
AMediaCodec_releaseOutputBufferAtTime
AMediaCodec_setOutputSurface
AMediaCodec_start
AMediaCodec_stop
AMediaCrypto_delete
......
ACameraCaptureSession_abortCaptures
ACameraCaptureSession_capture
ACameraCaptureSession_close
ACameraCaptureSession_getDevice
ACameraCaptureSession_setRepeatingRequest
ACameraCaptureSession_stopRepeating
ACameraDevice_close
ACameraDevice_createCaptureRequest
ACameraDevice_createCaptureSession
ACameraDevice_getId
ACameraManager_create
ACameraManager_delete
ACameraManager_deleteCameraIdList
ACameraManager_getCameraCharacteristics
ACameraManager_getCameraIdList
ACameraManager_openCamera
ACameraManager_registerAvailabilityCallback
ACameraManager_unregisterAvailabilityCallback
ACameraMetadata_copy
ACameraMetadata_free
ACameraMetadata_getAllTags
ACameraMetadata_getConstEntry
ACameraOutputTarget_create
ACameraOutputTarget_free
ACaptureRequest_addTarget
ACaptureRequest_free
ACaptureRequest_getAllTags
ACaptureRequest_getConstEntry
ACaptureRequest_removeTarget
ACaptureRequest_setEntry_double
ACaptureRequest_setEntry_float
ACaptureRequest_setEntry_i32
ACaptureRequest_setEntry_i64
ACaptureRequest_setEntry_rational
ACaptureRequest_setEntry_u8
ACaptureSessionOutputContainer_add
ACaptureSessionOutputContainer_create
ACaptureSessionOutputContainer_free
ACaptureSessionOutputContainer_remove
ACaptureSessionOutput_create
ACaptureSessionOutput_free
AImage_delete
AImage_getCropRect
AImage_getFormat
AImage_getHeight
AImage_getNumberOfPlanes
AImage_getPlaneData
AImage_getPlanePixelStride
AImage_getPlaneRowStride
AImage_getTimestamp
AImage_getWidth
AImageReader_acquireLatestImage
AImageReader_acquireNextImage
AImageReader_delete
AImageReader_getFormat
AImageReader_getHeight
AImageReader_getMaxImages
AImageReader_getWidth
AImageReader_getWindow
AImageReader_new
AImageReader_setImageListener
AMediaCodecCryptoInfo_delete
AMediaCodecCryptoInfo_getClearBytes
AMediaCodecCryptoInfo_getEncryptedBytes
......@@ -6,6 +26,7 @@ AMediaCodecCryptoInfo_getKey
AMediaCodecCryptoInfo_getMode
AMediaCodecCryptoInfo_getNumSubSamples
AMediaCodecCryptoInfo_new
AMediaCodecCryptoInfo_setPattern
AMediaCodec_configure
AMediaCodec_createCodecByName
AMediaCodec_createDecoderByType
......@@ -21,6 +42,7 @@ AMediaCodec_queueInputBuffer
AMediaCodec_queueSecureInputBuffer
AMediaCodec_releaseOutputBuffer
AMediaCodec_releaseOutputBufferAtTime
AMediaCodec_setOutputSurface
AMediaCodec_start
AMediaCodec_stop
AMediaCrypto_delete
......
ACameraCaptureSession_abortCaptures
ACameraCaptureSession_capture
ACameraCaptureSession_close
ACameraCaptureSession_getDevice
ACameraCaptureSession_setRepeatingRequest
ACameraCaptureSession_stopRepeating
ACameraDevice_close
ACameraDevice_createCaptureRequest
ACameraDevice_createCaptureSession
ACameraDevice_getId
ACameraManager_create
ACameraManager_delete
ACameraManager_deleteCameraIdList
ACameraManager_getCameraCharacteristics
ACameraManager_getCameraIdList
ACameraManager_openCamera
ACameraManager_registerAvailabilityCallback
ACameraManager_unregisterAvailabilityCallback
ACameraMetadata_copy
ACameraMetadata_free
ACameraMetadata_getAllTags
ACameraMetadata_getConstEntry
ACameraOutputTarget_create
ACameraOutputTarget_free
ACaptureRequest_addTarget
ACaptureRequest_free
ACaptureRequest_getAllTags
ACaptureRequest_getConstEntry
ACaptureRequest_removeTarget
ACaptureRequest_setEntry_double
ACaptureRequest_setEntry_float
ACaptureRequest_setEntry_i32
ACaptureRequest_setEntry_i64
ACaptureRequest_setEntry_rational
ACaptureRequest_setEntry_u8
ACaptureSessionOutputContainer_add
ACaptureSessionOutputContainer_create
ACaptureSessionOutputContainer_free
ACaptureSessionOutputContainer_remove
ACaptureSessionOutput_create
ACaptureSessionOutput_free
AImage_delete
AImage_getCropRect
AImage_getFormat
AImage_getHeight
AImage_getNumberOfPlanes
AImage_getPlaneData
AImage_getPlanePixelStride
AImage_getPlaneRowStride
AImage_getTimestamp
AImage_getWidth
AImageReader_acquireLatestImage
AImageReader_acquireNextImage
AImageReader_delete
AImageReader_getFormat
AImageReader_getHeight
AImageReader_getMaxImages
AImageReader_getWidth
AImageReader_getWindow
AImageReader_new
AImageReader_setImageListener
AMediaCodecCryptoInfo_delete
AMediaCodecCryptoInfo_getClearBytes
AMediaCodecCryptoInfo_getEncryptedBytes
......@@ -6,6 +26,7 @@ AMediaCodecCryptoInfo_getKey
AMediaCodecCryptoInfo_getMode
AMediaCodecCryptoInfo_getNumSubSamples
AMediaCodecCryptoInfo_new
AMediaCodecCryptoInfo_setPattern
AMediaCodec_configure
AMediaCodec_createCodecByName
AMediaCodec_createDecoderByType
......@@ -21,6 +42,7 @@ AMediaCodec_queueInputBuffer
AMediaCodec_queueSecureInputBuffer
AMediaCodec_releaseOutputBuffer
AMediaCodec_releaseOutputBufferAtTime
AMediaCodec_setOutputSurface
AMediaCodec_start
AMediaCodec_stop
AMediaCrypto_delete
......
ACameraCaptureSession_abortCaptures
ACameraCaptureSession_capture
ACameraCaptureSession_close
ACameraCaptureSession_getDevice
ACameraCaptureSession_setRepeatingRequest
ACameraCaptureSession_stopRepeating
ACameraDevice_close
ACameraDevice_createCaptureRequest
ACameraDevice_createCaptureSession
ACameraDevice_getId
ACameraManager_create
ACameraManager_delete
ACameraManager_deleteCameraIdList
ACameraManager_getCameraCharacteristics
ACameraManager_getCameraIdList
ACameraManager_openCamera
ACameraManager_registerAvailabilityCallback
ACameraManager_unregisterAvailabilityCallback
ACameraMetadata_copy
ACameraMetadata_free
ACameraMetadata_getAllTags
ACameraMetadata_getConstEntry
ACameraOutputTarget_create
ACameraOutputTarget_free
ACaptureRequest_addTarget
ACaptureRequest_free
ACaptureRequest_getAllTags
ACaptureRequest_getConstEntry
ACaptureRequest_removeTarget
ACaptureRequest_setEntry_double
ACaptureRequest_setEntry_float
ACaptureRequest_setEntry_i32
ACaptureRequest_setEntry_i64
ACaptureRequest_setEntry_rational
ACaptureRequest_setEntry_u8
ACaptureSessionOutputContainer_add
ACaptureSessionOutputContainer_create
ACaptureSessionOutputContainer_free
ACaptureSessionOutputContainer_remove
ACaptureSessionOutput_create
ACaptureSessionOutput_free
AImage_delete
AImage_getCropRect
AImage_getFormat
AImage_getHeight
AImage_getNumberOfPlanes
AImage_getPlaneData
AImage_getPlanePixelStride
AImage_getPlaneRowStride
AImage_getTimestamp
AImage_getWidth
AImageReader_acquireLatestImage
AImageReader_acquireNextImage
AImageReader_delete
AImageReader_getFormat
AImageReader_getHeight
AImageReader_getMaxImages
AImageReader_getWidth
AImageReader_getWindow
AImageReader_new
AImageReader_setImageListener
AMediaCodecCryptoInfo_delete
AMediaCodecCryptoInfo_getClearBytes
AMediaCodecCryptoInfo_getEncryptedBytes
......@@ -6,6 +26,7 @@ AMediaCodecCryptoInfo_getKey
AMediaCodecCryptoInfo_getMode
AMediaCodecCryptoInfo_getNumSubSamples
AMediaCodecCryptoInfo_new
AMediaCodecCryptoInfo_setPattern
AMediaCodec_configure
AMediaCodec_createCodecByName
AMediaCodec_createDecoderByType
......@@ -21,6 +42,7 @@ AMediaCodec_queueInputBuffer
AMediaCodec_queueSecureInputBuffer
AMediaCodec_releaseOutputBuffer
AMediaCodec_releaseOutputBufferAtTime
AMediaCodec_setOutputSurface
AMediaCodec_start
AMediaCodec_stop
AMediaCrypto_delete
......
ACameraCaptureSession_abortCaptures
ACameraCaptureSession_capture
ACameraCaptureSession_close
ACameraCaptureSession_getDevice
ACameraCaptureSession_setRepeatingRequest
ACameraCaptureSession_stopRepeating
ACameraDevice_close
ACameraDevice_createCaptureRequest
ACameraDevice_createCaptureSession
ACameraDevice_getId
ACameraManager_create
ACameraManager_delete
ACameraManager_deleteCameraIdList
ACameraManager_getCameraCharacteristics
ACameraManager_getCameraIdList
ACameraManager_openCamera
ACameraManager_registerAvailabilityCallback
ACameraManager_unregisterAvailabilityCallback
ACameraMetadata_copy
ACameraMetadata_free
ACameraMetadata_getAllTags
ACameraMetadata_getConstEntry
ACameraOutputTarget_create
ACameraOutputTarget_free
ACaptureRequest_addTarget
ACaptureRequest_free
ACaptureRequest_getAllTags
ACaptureRequest_getConstEntry
ACaptureRequest_removeTarget
ACaptureRequest_setEntry_double
ACaptureRequest_setEntry_float
ACaptureRequest_setEntry_i32
ACaptureRequest_setEntry_i64
ACaptureRequest_setEntry_rational
ACaptureRequest_setEntry_u8
ACaptureSessionOutputContainer_add
ACaptureSessionOutputContainer_create
ACaptureSessionOutputContainer_free
ACaptureSessionOutputContainer_remove
ACaptureSessionOutput_create
ACaptureSessionOutput_free
AImage_delete
AImage_getCropRect
AImage_getFormat
AImage_getHeight
AImage_getNumberOfPlanes
AImage_getPlaneData
AImage_getPlanePixelStride
AImage_getPlaneRowStride
AImage_getTimestamp
AImage_getWidth
AImageReader_acquireLatestImage
AImageReader_acquireNextImage
AImageReader_delete
AImageReader_getFormat
AImageReader_getHeight
AImageReader_getMaxImages
AImageReader_getWidth
AImageReader_getWindow
AImageReader_new
AImageReader_setImageListener
AMediaCodecCryptoInfo_delete
AMediaCodecCryptoInfo_getClearBytes
AMediaCodecCryptoInfo_getEncryptedBytes
......@@ -6,6 +26,7 @@ AMediaCodecCryptoInfo_getKey
AMediaCodecCryptoInfo_getMode
AMediaCodecCryptoInfo_getNumSubSamples
AMediaCodecCryptoInfo_new
AMediaCodecCryptoInfo_setPattern
AMediaCodec_configure
AMediaCodec_createCodecByName
AMediaCodec_createDecoderByType
......@@ -21,6 +42,7 @@ AMediaCodec_queueInputBuffer
AMediaCodec_queueSecureInputBuffer
AMediaCodec_releaseOutputBuffer
AMediaCodec_releaseOutputBufferAtTime
AMediaCodec_setOutputSurface
AMediaCodec_start
AMediaCodec_stop
AMediaCrypto_delete
......
This diff is collapsed.
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup Camera
* @{
*/
/**
* @file NdkCameraError.h
*/
/*
* This file defines an NDK API.
* Do not remove methods.
* Do not change method signatures.
* Do not change the value of constants.
* Do not change the size of any of the classes defined in here.
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
#ifndef _NDK_CAMERA_ERROR_H
#define _NDK_CAMERA_ERROR_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
ACAMERA_OK = 0,
ACAMERA_ERROR_BASE = -10000,
/**
* Camera operation has failed due to an unspecified cause.
*/
ACAMERA_ERROR_UNKNOWN = ACAMERA_ERROR_BASE,
/**
* Camera operation has failed due to an invalid parameter being passed to the method.
*/
ACAMERA_ERROR_INVALID_PARAMETER = ACAMERA_ERROR_BASE - 1,
/**
* Camera operation has failed because the camera device has been closed, possibly because a
* higher-priority client has taken ownership of the camera device.
*/
ACAMERA_ERROR_CAMERA_DISCONNECTED = ACAMERA_ERROR_BASE - 2,
/**
* Camera operation has failed due to insufficient memory.
*/
ACAMERA_ERROR_NOT_ENOUGH_MEMORY = ACAMERA_ERROR_BASE - 3,
/**
* Camera operation has failed due to the requested metadata tag cannot be found in input
* {@link ACameraMetadata} or {@link ACaptureRequest}.
*/
ACAMERA_ERROR_METADATA_NOT_FOUND = ACAMERA_ERROR_BASE - 4,
/**
* Camera operation has failed and the camera device has encountered a fatal error and needs to
* be re-opened before it can be used again.
*/
ACAMERA_ERROR_CAMERA_DEVICE = ACAMERA_ERROR_BASE - 5,
/**
* Camera operation has failed and the camera service has encountered a fatal error.
*
* <p>The Android device may need to be shut down and restarted to restore
* camera function, or there may be a persistent hardware problem.</p>
*
* <p>An attempt at recovery may be possible by closing the
* ACameraDevice and the ACameraManager, and trying to acquire all resources
* again from scratch.</p>
*/
ACAMERA_ERROR_CAMERA_SERVICE = ACAMERA_ERROR_BASE - 6,
/**
* The {@link ACameraCaptureSession} has been closed and cannnot perform any operation other
* than {@link ACameraCaptureSession_close}.
*/
ACAMERA_ERROR_SESSION_CLOSED = ACAMERA_ERROR_BASE - 7,
/**
* Camera operation has failed due to an invalid internal operation. Usually this is due to a
* low-level problem that may resolve itself on retry
*/
ACAMERA_ERROR_INVALID_OPERATION = ACAMERA_ERROR_BASE - 8,
/**
* Camera device does not support the stream configuration provided by application in
* {@link ACameraDevice_createCaptureSession}.
*/
ACAMERA_ERROR_STREAM_CONFIGURE_FAIL = ACAMERA_ERROR_BASE - 9,
/**
* Camera device is being used by another higher priority camera API client.
*/
ACAMERA_ERROR_CAMERA_IN_USE = ACAMERA_ERROR_BASE - 10,
/**
* The system-wide limit for number of open cameras or camera resources has been reached, and
* more camera devices cannot be opened until previous instances are closed.
*/
ACAMERA_ERROR_MAX_CAMERA_IN_USE = ACAMERA_ERROR_BASE - 11,
/**
* The camera is disabled due to a device policy, and cannot be opened.
*/
ACAMERA_ERROR_CAMERA_DISABLED = ACAMERA_ERROR_BASE - 12,
/**
* The application does not have permission to open camera.
*/
ACAMERA_ERROR_PERMISSION_DENIED = ACAMERA_ERROR_BASE - 13,
} camera_status_t;
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _NDK_CAMERA_ERROR_H
/** @} */
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup Camera
* @{
*/
/**
* @file NdkCameraManager.h
*/
/*
* This file defines an NDK API.
* Do not remove methods.
* Do not change method signatures.
* Do not change the value of constants.
* Do not change the size of any of the classes defined in here.
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
#ifndef _NDK_CAMERA_MANAGER_H
#define _NDK_CAMERA_MANAGER_H
#include "NdkCameraError.h"
#include "NdkCameraMetadata.h"
#include "NdkCameraDevice.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* ACameraManager is opaque type that provides access to camera service.
*
* A pointer can be obtained using {@link ACameraManager_create} method.
*/
typedef struct ACameraManager ACameraManager;
/**
* Create ACameraManager instance.
*
* <p>The ACameraManager is responsible for
* detecting, characterizing, and connecting to {@link ACameraDevice}s.</p>
*
* <p>The caller must call {@link ACameraManager_delete} to free the resources once it is done
* using the ACameraManager instance.</p>
*
* @return a {@link ACameraManager} instance.
*
*/
ACameraManager* ACameraManager_create();
/**
* <p>Delete the {@link ACameraManager} instance and free its resources. </p>
*
* @param manager the {@link ACameraManager} instance to be deleted.
*/
void ACameraManager_delete(ACameraManager* manager);
/// Struct to hold list of camera devices
typedef struct ACameraIdList {
int numCameras; ///< Number of connected camera devices
const char** cameraIds; ///< list of identifier of connected camera devices
} ACameraIdList;
/**
* Create a list of currently connected camera devices, including
* cameras that may be in use by other camera API clients.
*
* <p>Non-removable cameras use integers starting at 0 for their
* identifiers, while removable cameras have a unique identifier for each
* individual device, even if they are the same model.</p>
*
* <p>ACameraManager_getCameraIdList will allocate and return an {@link ACameraIdList}.
* The caller must call {@link ACameraManager_deleteCameraIdList} to free the memory</p>
*
* @param manager the {@link ACameraManager} of interest
* @param cameraIdList the output {@link ACameraIdList} will be filled in here if the method call
* succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if manager or cameraIdList is NULL.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if connection to camera service fails.</li>
* <li>{@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.</li></ul>
*/
camera_status_t ACameraManager_getCameraIdList(ACameraManager* manager,
/*out*/ACameraIdList** cameraIdList);
/**
* Delete a list of camera devices allocated via {@link ACameraManager_getCameraIdList}.
*
* @param cameraIdList the {@link ACameraIdList} to be deleted.
*/
void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList);
/**
* Definition of camera availability callbacks.
*
* @param context The optional application context provided by user in
* {@link ACameraManager_AvailabilityCallbacks}.
* @param cameraId The ID of the camera device whose availability is changing. The memory of this
* argument is owned by camera framework and will become invalid immediately after
* this callback returns.
*/
typedef void (*ACameraManager_AvailabilityCallback)(void* context, const char* cameraId);
/**
* A listener for camera devices becoming available or unavailable to open.
*
* <p>Cameras become available when they are no longer in use, or when a new
* removable camera is connected. They become unavailable when some
* application or service starts using a camera, or when a removable camera
* is disconnected.</p>
*
* @see ACameraManager_registerAvailabilityCallback
*/
typedef struct ACameraManager_AvailabilityListener {
/// Optional application context.
void* context;
/// Called when a camera becomes available
ACameraManager_AvailabilityCallback onCameraAvailable;
/// Called when a camera becomes unavailable
ACameraManager_AvailabilityCallback onCameraUnavailable;
} ACameraManager_AvailabilityCallbacks;
/**
* Register camera availability callbacks.
*
* <p>onCameraUnavailable will be called whenever a camera device is opened by any camera API client.
* Other camera API clients may still be able to open such a camera device, evicting the existing
* client if they have higher priority than the existing client of a camera device.
* See {@link ACameraManager_openCamera} for more details.</p>
*
* <p>The callbacks will be called on a dedicated thread shared among all ACameraManager
* instances.</p>
*
* <p>Since this callback will be registered with the camera service, remember to unregister it
* once it is no longer needed; otherwise the callback will continue to receive events
* indefinitely and it may prevent other resources from being released. Specifically, the
* callbacks will be invoked independently of the general activity lifecycle and independently
* of the state of individual ACameraManager instances.</p>
*
* @param manager the {@link ACameraManager} of interest.
* @param callback the {@link ACameraManager_AvailabilityCallbacks} to be registered.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if manager or callback is NULL, or
* {ACameraManager_AvailabilityCallbacks#onCameraAvailable} or
* {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.</li></ul>
*/
camera_status_t ACameraManager_registerAvailabilityCallback(
ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback);
/**
* Unregister camera availability callbacks.
*
* <p>Removing a callback that isn't registered has no effect.</p>
*
* @param manager the {@link ACameraManager} of interest.
* @param callback the {@link ACameraManager_AvailabilityCallbacks} to be unregistered.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if callback,
* {ACameraManager_AvailabilityCallbacks#onCameraAvailable} or
* {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.</li></ul>
*/
camera_status_t ACameraManager_unregisterAvailabilityCallback(
ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback);
/**
* Query the capabilities of a camera device. These capabilities are
* immutable for a given camera.
*
* <p>See {@link ACameraMetadata} document and {@link NdkCameraMetadataTags.h} for more details.</p>
*
* <p>The caller must call {@link ACameraMetadata_free} to free the memory of the output
* characteristics.</p>
*
* @param manager the {@link ACameraManager} of interest.
* @param cameraId the ID string of the camera device of interest.
* @param characteristics the output {@link ACameraMetadata} will be filled here if the method call
* succeeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if manager, cameraId, or characteristics
* is NULL, or cameraId does not match any camera devices connected.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if connection to camera service fails.</li>
* <li>{@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*/
camera_status_t ACameraManager_getCameraCharacteristics(
ACameraManager* manager, const char* cameraId,
/*out*/ACameraMetadata** characteristics);
/**
* Open a connection to a camera with the given ID. The opened camera device will be
* returned in the `device` parameter.
*
* <p>Use {@link ACameraManager_getCameraIdList} to get the list of available camera
* devices. Note that even if an id is listed, open may fail if the device
* is disconnected between the calls to {@link ACameraManager_getCameraIdList} and
* {@link ACameraManager_openCamera}, or if a higher-priority camera API client begins using the
* camera device.</p>
*
* <p>Devices for which the
* {@link ACameraManager_AvailabilityCallbacks#onCameraUnavailable} callback has been called due to
* the device being in use by a lower-priority, background camera API client can still potentially
* be opened by calling this method when the calling camera API client has a higher priority
* than the current camera API client using this device. In general, if the top, foreground
* activity is running within your application process, your process will be given the highest
* priority when accessing the camera, and this method will succeed even if the camera device is
* in use by another camera API client. Any lower-priority application that loses control of the
* camera in this way will receive an
* {@link ACameraDevice_stateCallbacks#onDisconnected} callback.</p>
*
* <p>Once the camera is successfully opened,the ACameraDevice can then be set up
* for operation by calling {@link ACameraDevice_createCaptureSession} and
* {@link ACameraDevice_createCaptureRequest}.</p>
*
* <p>If the camera becomes disconnected after this function call returns,
* {@link ACameraDevice_stateCallbacks#onDisconnected} with a
* ACameraDevice in the disconnected state will be called.</p>
*
* <p>If the camera runs into error after this function call returns,
* {@link ACameraDevice_stateCallbacks#onError} with a
* ACameraDevice in the error state will be called.</p>
*
* @param manager the {@link ACameraManager} of interest.
* @param cameraId the ID string of the camera device to be opened.
* @param callback the {@link ACameraDevice_StateCallbacks} associated with the opened camera device.
* @param device the opened {@link ACameraDevice} will be filled here if the method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if manager, cameraId, callback, or device
* is NULL, or cameraId does not match any camera devices connected.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if connection to camera service fails.</li>
* <li>{@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_IN_USE} if camera device is being used by a higher
* priority camera API client.</li>
* <li>{@link ACAMERA_ERROR_MAX_CAMERA_IN_USE} if the system-wide limit for number of open
* cameras or camera resources has been reached, and more camera devices cannot be
* opened until previous instances are closed.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISABLED} if the camera is disabled due to a device
* policy, and cannot be opened.</li>
* <li>{@link ACAMERA_ERROR_PERMISSION_DENIED} if the application does not have permission
* to open camera.</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*/
camera_status_t ACameraManager_openCamera(
ACameraManager* manager, const char* cameraId,
ACameraDevice_StateCallbacks* callback,
/*out*/ACameraDevice** device);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //_NDK_CAMERA_MANAGER_H
/** @} */
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup Camera
* @{
*/
/**
* @file NdkCameraMetadata.h
*/
/*
* This file defines an NDK API.
* Do not remove methods.
* Do not change method signatures.
* Do not change the value of constants.
* Do not change the size of any of the classes defined in here.
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
#ifndef _NDK_CAMERA_METADATA_H
#define _NDK_CAMERA_METADATA_H
#include "NdkCameraError.h"
#include "NdkCameraMetadataTags.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ACameraMetadata ACameraMetadata;
// Keep in sync with system/media/include/system/camera_metadata.h
enum {
// Unsigned 8-bit integer (uint8_t)
ACAMERA_TYPE_BYTE = 0,
// Signed 32-bit integer (int32_t)
ACAMERA_TYPE_INT32 = 1,
// 32-bit float (float)
ACAMERA_TYPE_FLOAT = 2,
// Signed 64-bit integer (int64_t)
ACAMERA_TYPE_INT64 = 3,
// 64-bit float (double)
ACAMERA_TYPE_DOUBLE = 4,
// A 64-bit fraction (ACameraMetadata_rational)
ACAMERA_TYPE_RATIONAL = 5,
// Number of type fields
ACAMERA_NUM_TYPES
};
typedef struct ACameraMetadata_rational {
int32_t numerator;
int32_t denominator;
} ACameraMetadata_rational;
typedef struct ACameraMetadata_entry {
uint32_t tag;
uint8_t type;
uint32_t count;
union {
uint8_t *u8;
int32_t *i32;
float *f;
int64_t *i64;
double *d;
ACameraMetadata_rational* r;
} data;
} ACameraMetadata_entry;
typedef struct ACameraMetadata_const_entry {
uint32_t tag;
uint8_t type;
uint32_t count;
union {
const uint8_t *u8;
const int32_t *i32;
const float *f;
const int64_t *i64;
const double *d;
const ACameraMetadata_rational* r;
} data;
} ACameraMetadata_const_entry;
/*
* Get a metadata entry
*/
camera_status_t ACameraMetadata_getConstEntry(
const ACameraMetadata*, uint32_t tag, ACameraMetadata_const_entry* entry);
/*
* List all the entry tags in this metadata.
* The memory of tags is managed by ACameraMetadata itself and must NOT be free/delete
* by application. Do NOT access tags after calling ACameraMetadata_free
*/
camera_status_t ACameraMetadata_getAllTags(
const ACameraMetadata*, /*out*/int32_t* numTags, /*out*/const uint32_t** tags);
/**
* Copy a metadata. Duplicates a metadata structure.
* The destination ACameraMetadata must be freed by the application with ACameraMetadata_free
* after application is done using it.
* Returns NULL when src cannot be copied
*/
ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src);
/**
* Frees a metadata structure.
*/
void ACameraMetadata_free(ACameraMetadata*);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //_NDK_CAMERA_METADATA_H
/** @} */
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup Camera
* @{
*/
/**
* @file NdkCaptureRequest.h
*/
/*
* This file defines an NDK API.
* Do not remove methods.
* Do not change method signatures.
* Do not change the value of constants.
* Do not change the size of any of the classes defined in here.
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
#include <android/native_window.h>
#include "NdkCameraError.h"
#include "NdkCameraMetadata.h"
#ifndef _NDK_CAPTURE_REQUEST_H
#define _NDK_CAPTURE_REQUEST_H
#ifdef __cplusplus
extern "C" {
#endif
// Container for output targets
typedef struct ACameraOutputTargets ACameraOutputTargets;
// Container for a single output target
typedef struct ACameraOutputTarget ACameraOutputTarget;
typedef struct ACaptureRequest ACaptureRequest;
camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputTarget** out);
void ACameraOutputTarget_free(ACameraOutputTarget*);
camera_status_t ACaptureRequest_addTarget(ACaptureRequest*, const ACameraOutputTarget*);
camera_status_t ACaptureRequest_removeTarget(ACaptureRequest*, const ACameraOutputTarget*);
//TODO: do we need API to query added targets?
/*
* Get a metadata entry
*/
camera_status_t ACaptureRequest_getConstEntry(
const ACaptureRequest*, uint32_t tag, ACameraMetadata_const_entry* entry);
/*
* List all the entry tags in this capture request.
* The memory of tags is managed by ACaptureRequest itself and must NOT be free/delete
* by application. Calling ACaptureRequest_setEntry_* API will invalidate previous
* output of ACaptureRequest_getAllTags. Do not access tags after calling
* ACaptureRequest_setEntry_*. To get new list of tags after updating capture request,
* application must call ACaptureRequest_getAllTags again.
* Do NOT access tags after calling ACaptureRequest_free.
*/
camera_status_t ACaptureRequest_getAllTags(
const ACaptureRequest*, /*out*/int32_t* numTags, /*out*/const uint32_t** tags);
/*
* Set an entry of corresponding type.
* The entry tag's type must match corresponding set API or an
* ACAMERA_ERROR_INVALID_PARAMETER error will occur.
* Also, the input ACameraMetadata* must belong to a capture request or an
* ACAMERA_ERROR_INVALID_PARAMETER error will occur.
*/
camera_status_t ACaptureRequest_setEntry_u8(
ACaptureRequest*, uint32_t tag, uint32_t count, const uint8_t* data);
camera_status_t ACaptureRequest_setEntry_i32(
ACaptureRequest*, uint32_t tag, uint32_t count, const int32_t* data);
camera_status_t ACaptureRequest_setEntry_float(
ACaptureRequest*, uint32_t tag, uint32_t count, const float* data);
camera_status_t ACaptureRequest_setEntry_i64(
ACaptureRequest*, uint32_t tag, uint32_t count, const int64_t* data);
camera_status_t ACaptureRequest_setEntry_double(
ACaptureRequest*, uint32_t tag, uint32_t count, const double* data);
camera_status_t ACaptureRequest_setEntry_rational(
ACaptureRequest*, uint32_t tag, uint32_t count, const ACameraMetadata_rational* data);
// free the capture request created by ACameraDevice_createCaptureRequest
void ACaptureRequest_free(ACaptureRequest* request);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _NDK_CAPTURE_REQUEST_H
/** @} */
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup Media Camera
* @{
*/
/**
* @file NdkImage.h
*/
/*
* This file defines an NDK API.
* Do not remove methods.
* Do not change method signatures.
* Do not change the value of constants.
* Do not change the size of any of the classes defined in here.
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
#ifndef _NDK_IMAGE_H
#define _NDK_IMAGE_H
#include "NdkMediaError.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct AImage AImage;
// Formats not listed here will not be supported by AImageReader
enum {
AIMAGE_FORMAT_YUV_420_888 = 0x23,
AIMAGE_FORMAT_JPEG = 0x100,
AIMAGE_FORMAT_RAW16 = 0x20,
AIMAGE_FORMAT_RAW_PRIVATE = 0x24,
AIMAGE_FORMAT_RAW10 = 0x25,
AIMAGE_FORMAT_RAW12 = 0x26,
AIMAGE_FORMAT_DEPTH16 = 0x44363159,
AIMAGE_FORMAT_DEPTH_POINT_CLOUD = 0x101,
AIMAGE_FORMAT_PRIVATE = 0x22 ///> Not supported by AImageReader yet
};
typedef struct AImageCropRect {
int32_t left;
int32_t top;
int32_t right;
int32_t bottom;
} AImageCropRect;
// Return the image back to system and delete the AImage from memory
// Do NOT use `image` after this call
void AImage_delete(AImage* image);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* rect);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestampNs);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* numPlanes);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getPlanePixelStride(
const AImage* image, int planeIdx, /*out*/int32_t* pixelStride);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
media_status_t AImage_getPlaneRowStride(
const AImage* image, int planeIdx, /*out*/int32_t* rowStride);
// AMEDIA_ERROR_INVALID_OBJECT will be returned if the parent AImageReader is deleted
// Note that once the AImage or the parent AImageReader is deleted, the `*data` returned from
// previous AImage_getPlaneData call becomes dangling pointer. Do NOT use it after
// AImage or AImageReader is deleted
media_status_t AImage_getPlaneData(
const AImage* image, int planeIdx,
/*out*/uint8_t** data, /*out*/int* dataLength);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //_NDK_IMAGE_H
/** @} */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment