CameraNDK: fill in more NDK API documents
This change adds document for ACaptureRequest, ACameraMetadata,
AImage and AImageReader.
Bug: 27102995
Change-Id: I79d88f73258c01ebeabcd5b4e3b90996759cb021
diff --git a/include/camera/ndk/NdkCameraMetadata.h b/include/camera/ndk/NdkCameraMetadata.h
index 8a8865d..d929854 100644
--- a/include/camera/ndk/NdkCameraMetadata.h
+++ b/include/camera/ndk/NdkCameraMetadata.h
@@ -43,35 +43,78 @@
extern "C" {
#endif
+/**
+ * ACameraMetadata is opaque type that provides access to read-only camera metadata like camera
+ * characteristics (via {@link ACameraManager_getCameraCharacteristics}) or capture results (via
+ * {@link ACameraCaptureSession_captureCallback_result}).
+ */
typedef struct ACameraMetadata ACameraMetadata;
-// Keep in sync with system/media/include/system/camera_metadata.h
+/**
+ * Possible data types of a metadata entry.
+ *
+ * Keep in sync with system/media/include/system/camera_metadata.h
+ */
enum {
- // Unsigned 8-bit integer (uint8_t)
+ /// Unsigned 8-bit integer (uint8_t)
ACAMERA_TYPE_BYTE = 0,
- // Signed 32-bit integer (int32_t)
+ /// Signed 32-bit integer (int32_t)
ACAMERA_TYPE_INT32 = 1,
- // 32-bit float (float)
+ /// 32-bit float (float)
ACAMERA_TYPE_FLOAT = 2,
- // Signed 64-bit integer (int64_t)
+ /// Signed 64-bit integer (int64_t)
ACAMERA_TYPE_INT64 = 3,
- // 64-bit float (double)
+ /// 64-bit float (double)
ACAMERA_TYPE_DOUBLE = 4,
- // A 64-bit fraction (ACameraMetadata_rational)
+ /// A 64-bit fraction (ACameraMetadata_rational)
ACAMERA_TYPE_RATIONAL = 5,
- // Number of type fields
+ /// Number of type fields
ACAMERA_NUM_TYPES
};
+/**
+ * Definition of rational data type in {@link ACameraMetadata}.
+ */
typedef struct ACameraMetadata_rational {
int32_t numerator;
int32_t denominator;
} ACameraMetadata_rational;
+/**
+ * A single camera metadata entry.
+ *
+ * <p>Each entry is an array of values, though many metadata fields may only have 1 entry in the
+ * array.</p>
+ */
typedef struct ACameraMetadata_entry {
+ /**
+ * The tag identifying the entry.
+ *
+ * <p> It is one of the values defined in {@link NdkCameraMetadataTags.h}, and defines how the
+ * entry should be interpreted and which parts of the API provide it.
+ * See {@link NdkCameraMetadataTags.h} for more details. </p>
+ */
uint32_t tag;
+
+ /**
+ * The data type of this metadata entry.
+ *
+ * <p>Must be one of ACAMERA_TYPE_* enum values defined above. A particular tag always has the
+ * same type.</p>
+ */
uint8_t type;
+
+ /**
+ * Count of elements (NOT count of bytes) in this metadata entry.
+ */
uint32_t count;
+
+ /**
+ * Pointer to the data held in this metadata entry.
+ *
+ * <p>The type field above defines which union member pointer is valid. The count field above
+ * defines the length of the data in number of elements.</p>
+ */
union {
uint8_t *u8;
int32_t *i32;
@@ -82,10 +125,41 @@
} data;
} ACameraMetadata_entry;
+/**
+ * A single read-only camera metadata entry.
+ *
+ * <p>Each entry is an array of values, though many metadata fields may only have 1 entry in the
+ * array.</p>
+ */
typedef struct ACameraMetadata_const_entry {
+ /**
+ * The tag identifying the entry.
+ *
+ * <p> It is one of the values defined in {@link NdkCameraMetadataTags.h}, and defines how the
+ * entry should be interpreted and which parts of the API provide it.
+ * See {@link NdkCameraMetadataTags.h} for more details. </p>
+ */
uint32_t tag;
+
+ /**
+ * The data type of this metadata entry.
+ *
+ * <p>Must be one of ACAMERA_TYPE_* enum values defined above. A particular tag always has the
+ * same type.</p>
+ */
uint8_t type;
+
+ /**
+ * Count of elements (NOT count of bytes) in this metadata entry.
+ */
uint32_t count;
+
+ /**
+ * Pointer to the data held in this metadata entry.
+ *
+ * <p>The type field above defines which union member pointer is valid. The count field above
+ * defines the length of the data in number of elements.</p>
+ */
union {
const uint8_t *u8;
const int32_t *i32;
@@ -96,32 +170,61 @@
} data;
} ACameraMetadata_const_entry;
-/*
- * Get a metadata entry
+/**
+ * Get a metadata entry from an input {@link ACameraMetadata}.
+ *
+ * <p>The memory of the data field in the returned entry is managed by camera framework. Do not
+ * attempt to free it.</p>
+ *
+ * @param metadata the {@link ACameraMetadata} of interest.
+ * @param tag the tag value of the camera metadata entry to be get.
+ * @param entry the output {@link ACameraMetadata_const_entry} 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 metadata or entry is NULL.</li>
+ * <li>{@link ACAMERA_ERROR_METADATA_NOT_FOUND} if input metadata does not contain an entry
+ * of input tag value.</li></ul>
*/
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);
+ const ACameraMetadata* metadata, uint32_t tag, /*out*/ACameraMetadata_const_entry* entry);
/**
- * 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
+ * List all the entry tags in input {@link ACameraMetadata}.
+ *
+ * @param metadata the {@link ACameraMetadata} of interest.
+ * @param numEntries number of metadata entries in input {@link ACameraMetadata}
+ * @param tags the tag values of the metadata entries. Length of tags is returned in numEntries
+ * argument. The memory is managed by ACameraMetadata itself and must NOT be free/delete
+ * by application. Do NOT access tags after calling ACameraMetadata_free.
+ *
+ * @return <ul>
+ * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
+ * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if metadata, numEntries or tags is NULL.</li>
+ * <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
+ */
+camera_status_t ACameraMetadata_getAllTags(
+ const ACameraMetadata* metadata, /*out*/int32_t* numEntries, /*out*/const uint32_t** tags);
+
+/**
+ * Create a copy of input {@link ACameraMetadata}.
+ *
+ * <p>The returned ACameraMetadata must be freed by the application by {@link ACameraMetadata_free}
+ * after application is done using it.</p>
+ *
+ * @param src the input {@link ACameraMetadata} to be copied.
+ *
+ * @return a valid ACameraMetadata pointer or NULL if the input metadata cannot be copied.
*/
ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src);
/**
- * Frees a metadata structure.
+ * Free a {@link ACameraMetadata} structure.
+ *
+ * @param metadata the {@link ACameraMetadata} to be freed.
*/
-void ACameraMetadata_free(ACameraMetadata*);
+void ACameraMetadata_free(ACameraMetadata* metadata);
#ifdef __cplusplus
} // extern "C"