camera bindings done

This commit is contained in:
2024-08-08 15:11:28 +02:00
parent a9c12c3e16
commit 40c540b187
8 changed files with 13427 additions and 0 deletions
+888
View File
@@ -0,0 +1,888 @@
//+build android
package camerandk
foreign import camerandk "system:camera2ndk"
/// Enum for describing error reason in {@link ACameraCaptureFailure}
CaptureFailureReason :: enum i32 {
/**
* The capture session has dropped this frame due to an
* {@link ACameraCaptureSession_abortCaptures} call.
*/
FLUSHED = 0,
/**
* The capture session has dropped this frame due to an error in the framework.
*/
ERROR
}
CaptureSequenceId :: enum i32 {
NONE = -1
}
/**
* ACameraCaptureSession is an opaque type that manages frame captures of a camera device.
*
* A pointer can be obtained using {@link ACameraDevice_createCaptureSession} method.
*/
ACameraCaptureSession :: struct{}
/**
* Capture session state callbacks used in {@link ACameraDevice_createCaptureSession} and
* {@link ACameraDevice_createCaptureSessionWithSessionParameters}
*/
ACameraCaptureSession_stateCallbacks :: struct {
/// optional application context.
_context: rawptr,
/**
* This callback is called when the session is closed and deleted from memory.
*
* <p>A session is closed when {@link ACameraCaptureSession_close} is called, a new session
* is created by the parent camera device,
* or when the parent camera device is closed (either by the user closing the device,
* or due to a camera device disconnection or fatal error).</p>
*
* <p>Once this callback is called, all access to this ACameraCaptureSession object will cause
* a crash.</p>
*/
onClosed: ACameraCaptureSession_stateCallback,
/**
* This callback is called every time the session has no more capture requests to process.
*
* <p>This callback will be invoked any time the session finishes processing
* all of its active capture requests, and no repeating request or burst is set up.</p>
*/
onReady: ACameraCaptureSession_stateCallback,
/**
* This callback is called when the session starts actively processing capture requests.
*
* <p>If the session runs out of capture requests to process and calls {@link onReady},
* then this callback will be invoked again once new requests are submitted for capture.</p>
*/
onActive: ACameraCaptureSession_stateCallback,
}
/// Struct to describe a capture failure
ACameraCaptureFailure :: struct {
/**
* The frame number associated with this failed capture.
*
* <p>Whenever a request has been processed, regardless of failed capture or success,
* it gets a unique frame number assigned to its future result/failed capture.</p>
*
* <p>This value monotonically increments, starting with 0,
* for every new result or failure, and the scope is the lifetime of the
* {@link ACameraDevice}.</p>
*/
frameNumber: i64,
/**
* Determine why the request was dropped, whether due to an error or to a user
* action.
*
* @see CAPTURE_FAILURE_REASON_ERROR
* @see CAPTURE_FAILURE_REASON_FLUSHED
*/
reason: CaptureFailureReason,
/**
* The sequence ID for this failed capture that was returned by the
* {@link ACameraCaptureSession_capture} or {@link ACameraCaptureSession_setRepeatingRequest}.
*
* <p>The sequence ID is a unique monotonically increasing value starting from 0,
* incremented every time a new group of requests is submitted to the ACameraDevice.</p>
*/
sequenceId: i32,
/**
* Determine if the image was captured from the camera.
*
* <p>If the image was not captured, no image buffers will be available.
* If the image was captured, then image buffers may be available.</p>
*
*/
wasImageCaptured: bool,
}
/**
* ACaptureCaptureSession_captureCallbacks structure used in
* {@link ACameraCaptureSession_capture} and {@link ACameraCaptureSession_setRepeatingRequest}.
*/
ACameraCaptureSession_captureCallbacks :: struct {
/// optional application context.
_context: rawptr,
/**
* This callback is called when the camera device has started capturing
* the output image for the request, at the beginning of image exposure.
*
* <p>This callback is invoked right as
* the capture of a frame begins, so it is the most appropriate time
* for playing a shutter sound, or triggering UI indicators of capture.</p>
*
* <p>The request that is being used for this capture is provided, along
* with the actual timestamp for the start of exposure.
* This timestamp matches the timestamps that will be
* included in {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in
* {@link onCaptureCompleted} callback,
* and in the buffers sent to each output ANativeWindow. These buffer
* timestamps are accessible through, for example,
* {@link AImage_getTimestamp} or
* <a href="http://developer.android.com/reference/android/graphics/SurfaceTexture.html#getTimestamp()">
* android.graphics.SurfaceTexture#getTimestamp()</a>.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.</p>
*
*/
onCaptureStarted: ACameraCaptureSession_captureCallback_start,
/**
* This callback is called when an image capture makes partial forward progress, some
* (but not all) results from an image capture are available.
*
* <p>The result provided here will contain some subset of the fields of
* a full result. Multiple {@link onCaptureProgressed} calls may happen per
* capture, a given result field will only be present in one partial
* capture at most. The final {@link onCaptureCompleted} call will always
* contain all the fields (in particular, the union of all the fields of all
* the partial results composing the total result).</p>
*
* <p>For each request, some result data might be available earlier than others. The typical
* delay between each partial result (per request) is a single frame interval.
* For performance-oriented use-cases, applications should query the metadata they need
* to make forward progress from the partial results and avoid waiting for the completed
* result.</p>
*
* <p>For a particular request, {@link onCaptureProgressed} may happen before or after
* {@link onCaptureStarted}.</p>
*
* <p>Each request will generate at least `1` partial results, and at most
* {@link ACAMERA_REQUEST_PARTIAL_RESULT_COUNT} partial results.</p>
*
* <p>Depending on the request settings, the number of partial results per request
* will vary, although typically the partial count could be the same as long as the
* camera device subsystems enabled stay the same.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.</p>
*/
onCaptureProgressed: ACameraCaptureSession_captureCallback_result,
/**
* This callback is called when an image capture has fully completed and all the
* result metadata is available.
*
* <p>This callback will always fire after the last {@link onCaptureProgressed},
* in other words, no more partial results will be delivered once the completed result
* is available.</p>
*
* <p>For performance-intensive use-cases where latency is a factor, consider
* using {@link onCaptureProgressed} instead.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.</p>
*/
onCaptureCompleted: ACameraCaptureSession_captureCallback_result,
/**
* This callback is called instead of {@link onCaptureCompleted} when the
* camera device failed to produce a capture result for the
* request.
*
* <p>Other requests are unaffected, and some or all image buffers from
* the capture may have been pushed to their respective output
* streams.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.</p>
*
* @see ACameraCaptureFailure
*/
onCaptureFailed: ACameraCaptureSession_captureCallback_failed,
/**
* This callback is called independently of the others in {@link ACameraCaptureSession_captureCallbacks},
* when a capture sequence finishes and all capture result
* or capture failure for it have been returned via this {@link ACameraCaptureSession_captureCallbacks}.
*
* <p>In total, there will be at least one result/failure returned by this listener
* before this callback is invoked. If the capture sequence is aborted before any
* requests have been processed, {@link onCaptureSequenceAborted} is invoked instead.</p>
*/
onCaptureSequenceCompleted: ACameraCaptureSession_captureCallback_sequenceEnd,
/**
* This callback is called independently of the others in {@link ACameraCaptureSession_captureCallbacks},
* when a capture sequence aborts before any capture result
* or capture failure for it have been returned via this {@link ACameraCaptureSession_captureCallbacks}.
*
* <p>Due to the asynchronous nature of the camera device, not all submitted captures
* are immediately processed. It is possible to clear out the pending requests
* by a variety of operations such as {@link ACameraCaptureSession_stopRepeating} or
* {@link ACameraCaptureSession_abortCaptures}. When such an event happens,
* {@link onCaptureSequenceCompleted} will not be called.</p>
*/
onCaptureSequenceAborted: ACameraCaptureSession_captureCallback_sequenceAbort,
/**
* This callback is called if a single buffer for a capture could not be sent to its
* destination ANativeWindow.
*
* <p>If the whole capture failed, then {@link onCaptureFailed} will be called instead. If
* some but not all buffers were captured but the result metadata will not be available,
* then onCaptureFailed will be invoked with {@link ACameraCaptureFailure#wasImageCaptured}
* returning true, along with one or more calls to {@link onCaptureBufferLost} for the
* failed outputs.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.
* The ANativeWindow pointer will always match what application submitted in
* {@link ACameraDevice_createCaptureSession}</p>
*
*/
onCaptureBufferLost: ACameraCaptureSession_captureCallback_bufferLost,
}
/**
* Opaque object for capture session output, use {@link ACaptureSessionOutput_create} or
* {@link ACaptureSessionSharedOutput_create} to create an instance.
*/
ACaptureSessionOutput :: struct{}
/// Struct to describe a logical camera capture failure
ALogicalCameraCaptureFailure :: struct {
/**
* The {@link ACameraCaptureFailure} contains information about regular logical device capture
* failure.
*/
captureFailure: ACameraCaptureFailure,
/**
* The physical camera device ID in case the capture failure comes from a capture request
* with configured physical camera streams for a logical camera. physicalCameraId will be set
* to NULL in case the capture request has no associated physical camera device.
*
*/
physicalCameraId: cstring,
}
/**
* This has the same functionality as ACameraCaptureSession_captureCallbacks,
* with the exception that an onLogicalCameraCaptureCompleted callback is
* used, instead of onCaptureCompleted, to support logical multi-camera.
*/
ACameraCaptureSession_logicalCamera_captureCallbacks :: struct {
/**
* Same as ACameraCaptureSession_captureCallbacks
*/
_context: rawptr,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureStarted}.
*/
onCaptureStarted: ACameraCaptureSession_captureCallback_start,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureProgressed}.
*/
onCaptureProgressed: ACameraCaptureSession_captureCallback_result,
/**
* This callback is called when an image capture has fully completed and all the
* result metadata is available. For a logical multi-camera, this callback
* also returns the result metadata for all physical cameras being
* explicitly requested on.
*
* <p>This callback will always fire after the last {@link onCaptureProgressed},
* in other words, no more partial results will be delivered once the completed result
* is available.</p>
*
* <p>For performance-intensive use-cases where latency is a factor, consider
* using {@link onCaptureProgressed} instead.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.</p>
*/
onLogicalCameraCaptureCompleted: ACameraCaptureSession_logicalCamera_captureCallback_result,
/**
* This callback is called instead of {@link onLogicalCameraCaptureCompleted} when the
* camera device failed to produce a capture result for the
* request.
*
* <p>Other requests are unaffected, and some or all image buffers from
* the capture may have been pushed to their respective output
* streams.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.</p>
*
* @see ALogicalCameraCaptureFailure
*/
onLogicalCameraCaptureFailed: ACameraCaptureSession_logicalCamera_captureCallback_failed,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceCompleted}.
*/
onCaptureSequenceCompleted: ACameraCaptureSession_captureCallback_sequenceEnd,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceAborted}.
*/
onCaptureSequenceAborted: ACameraCaptureSession_captureCallback_sequenceAbort,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureBufferLost}.
*/
onCaptureBufferLost: ACameraCaptureSession_captureCallback_bufferLost,
}
/**
* This has the same functionality as ACameraCaptureSession_captureCallbacks,
* with the exception that captureCallback_startV2 callback is
* used, instead of captureCallback_start, to support retrieving the frame number.
*/
ACameraCaptureSession_captureCallbacksV2 :: struct {
/**
* Same as ACameraCaptureSession_captureCallbacks
*/
_context: rawptr,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureStarted},
* except that it has the frame number of the capture added in the parameter
* list.
*/
onCaptureStarted: ACameraCaptureSession_captureCallback_startV2,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureProgressed}.
*/
onCaptureProgressed: ACameraCaptureSession_captureCallback_result,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted}.
*/
onCaptureCompleted: ACameraCaptureSession_captureCallback_result,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureFailed}.
*/
onCaptureFailed: ACameraCaptureSession_captureCallback_failed,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceCompleted}.
*/
onCaptureSequenceCompleted: ACameraCaptureSession_captureCallback_sequenceEnd,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceAborted}.
*/
onCaptureSequenceAborted: ACameraCaptureSession_captureCallback_sequenceAbort,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureBufferLost}.
*/
onCaptureBufferLost: ACameraCaptureSession_captureCallback_bufferLost,
}
/**
* This has the same functionality as ACameraCaptureSession_logicalCamera_captureCallbacks,
* with the exception that an captureCallback_startV2 callback is
* used, instead of captureCallback_start, to support retrieving frame number.
*/
ACameraCaptureSession_logicalCamera_captureCallbacksV2 :: struct {
/**
* Same as ACameraCaptureSession_captureCallbacks
*/
_context: rawptr,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureStarted},
* except that it has the frame number of the capture added in the parameter
* list.
*/
onCaptureStarted: ACameraCaptureSession_captureCallback_startV2,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureProgressed}.
*/
onCaptureProgressed: ACameraCaptureSession_captureCallback_result,
/**
* Same as
* {@link ACameraCaptureSession_logicalCamera_captureCallbacks#onLogicalCaptureCompleted}.
*/
onLogicalCameraCaptureCompleted: ACameraCaptureSession_logicalCamera_captureCallback_result,
/**
* This callback is called instead of {@link onLogicalCameraCaptureCompleted} when the
* camera device failed to produce a capture result for the
* request.
*
* <p>Other requests are unaffected, and some or all image buffers from
* the capture may have been pushed to their respective output
* streams.</p>
*
* <p>Note that the ACaptureRequest pointer in the callback will not match what application has
* submitted, but the contents the ACaptureRequest will match what application submitted.</p>
*
* @see ALogicalCameraCaptureFailure
*/
onLogicalCameraCaptureFailed: ACameraCaptureSession_logicalCamera_captureCallback_failed,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceCompleted}.
*/
onCaptureSequenceCompleted: ACameraCaptureSession_captureCallback_sequenceEnd,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceAborted}.
*/
onCaptureSequenceAborted: ACameraCaptureSession_captureCallback_sequenceAbort,
/**
* Same as {@link ACameraCaptureSession_captureCallbacks#onCaptureBufferLost}.
*/
onCaptureBufferLost: ACameraCaptureSession_captureCallback_bufferLost,
}
/**
* The definition of camera capture session state callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_stateCallbacks}.
* @param session The camera capture session whose state is changing.
*/
ACameraCaptureSession_stateCallback :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession)
/**
* The definition of camera capture start callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param request The capture request that is starting. Note that this pointer points to a copy of
* capture request sent by application, so the address is different to what
* application sent but the content will match. This request will be freed by
* framework immediately after this callback returns.
* @param timestamp The timestamp when the capture is started. This timestmap will match
* {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in
* {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted} callback.
*/
ACameraCaptureSession_captureCallback_start :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, request: ^ACaptureRequest, timestamp: i64)
/**
* The definition of camera capture progress/result callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param request The capture request of interest. Note that this pointer points to a copy of
* capture request sent by application, so the address is different to what
* application sent but the content will match. This request will be freed by
* framework immediately after this callback returns.
* @param result The capture result metadata reported by camera device. The memory is managed by
* camera framework. Do not access this pointer after this callback returns.
*/
ACameraCaptureSession_captureCallback_result :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, request: ^ACaptureRequest, result: ^ACameraMetadata)
/**
* The definition of camera capture failure callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param request The capture request of interest. Note that this pointer points to a copy of
* capture request sent by application, so the address is different to what
* application sent but the content will match. This request will be freed by
* framework immediately after this callback returns.
* @param failure The {@link ACameraCaptureFailure} desribes the capture failure. The memory is
* managed by camera framework. Do not access this pointer after this callback
* returns.
*/
ACameraCaptureSession_captureCallback_failed :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, request: ^ACaptureRequest, failure: ^ACameraCaptureFailure)
/**
* The definition of camera sequence end callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param sequenceId The capture sequence ID of the finished sequence.
* @param frameNumber The frame number of the last frame of this sequence.
*/
ACameraCaptureSession_captureCallback_sequenceEnd :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, sequenceId: i32, frameNumber: i64)
/**
* The definition of camera sequence aborted callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param sequenceId The capture sequence ID of the aborted sequence.
*/
ACameraCaptureSession_captureCallback_sequenceAbort :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, sequenceId: i32)
/**
* The definition of camera buffer lost callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param request The capture request of interest. Note that this pointer points to a copy of
* capture request sent by application, so the address is different to what
* application sent but the content will match. This request will be freed by
* framework immediately after this callback returns.
* @param window The {@link ANativeWindow} that the lost buffer would have been sent to.
* @param frameNumber The frame number of the lost buffer.
*/
ACameraCaptureSession_captureCallback_bufferLost :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, request: ^ACaptureRequest, window: ^ACameraWindowType, frameNumber: i64)
/**
* The definition of final capture result callback with logical multi-camera support.
*
* This has the same functionality as final ACameraCaptureSession_captureCallback_result, with
* added ability to return physical camera result metadata within a logical multi-camera.
*
* For a logical multi-camera, this function will be called with the Id and result metadata
* of the underlying physical cameras, which the corresponding capture request contains targets for.
* If the capture request doesn't contain targets specific to any physical camera, or the current
* camera device isn't a logical multi-camera, physicalResultCount will be 0.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param request The capture request of interest. Note that this pointer points to a copy of
* capture request sent by application, so the address is different to what
* application sent but the content will match. This request will be freed by
* framework immediately after this callback returns.
* @param result The capture result metadata reported by camera device. The memory is managed by
* camera framework. Do not access this pointer after this callback returns.
* @param physicalResultCount The number of physical camera result metadata
* @param physicalCameraIds The array of physical camera IDs on which the
* physical result metadata are reported.
* @param physicalResults The array of capture result metadata reported by the
* physical camera devices.
*/
ACameraCaptureSession_logicalCamera_captureCallback_result :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, request: ^ACaptureRequest, result: ^ACameraMetadata, physicalResultCount: uint, physicalCameraIds: [^]cstring, physicalResults: [^]ACameraMetadata)
/**
* The definition of logical camera capture failure callback.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param request The capture request of interest. Note that this pointer points to a copy of
* capture request sent by application, so the address is different to what
* application sent but the content will match. This request will be freed by
* framework immediately after this callback returns.
* @param failure The {@link ALogicalCameraCaptureFailure} desribes the capture failure. The memory
* is managed by camera framework. Do not access this pointer after this callback
* returns.
*/
ACameraCaptureSession_logicalCamera_captureCallback_failed :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, request: ^ACaptureRequest, failure: ^ALogicalCameraCaptureFailure)
/**
* The definition of camera capture start callback. The same as
* {@link ACameraCaptureSession_captureCallbacks#onCaptureStarted}, except that
* it has the frame number of the capture as well.
*
* @param context The optional application context provided by user in
* {@link ACameraCaptureSession_captureCallbacks}.
* @param session The camera capture session of interest.
* @param request The capture request that is starting. Note that this pointer points to a copy of
* capture request sent by application, so the address is different to what
* application sent but the content will match. This request will be freed by
* framework immediately after this callback returns.
* @param timestamp The timestamp when the capture is started. This timestamp will match
* {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in
* {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted} callback.
* @param frameNumber the frame number of the capture started
*/
ACameraCaptureSession_captureCallback_startV2 :: #type proc "c" (_context: rawptr, session: ^ACameraCaptureSession, request: ^ACaptureRequest, timestamp: i64, frameNumber: i64)
foreign camerandk {
/**
* Close this capture session.
*
* <p>Closing a session frees up the target output Surfaces of the session for reuse with either
* a new session, or to other APIs that can draw to Surfaces.</p>
*
* <p>Note that creating a new capture session with {@link ACameraDevice_createCaptureSession}
* will close any existing capture session automatically, and call the older session listener's
* {@link ACameraCaptureSession_stateCallbacks#onClosed} callback. Using
* {@link ACameraDevice_createCaptureSession} directly without closing is the recommended approach
* for quickly switching to a new session, since unchanged target outputs can be reused more
* efficiently.</p>
*
* <p>After a session is closed and before {@link ACameraCaptureSession_stateCallbacks#onClosed}
* is called, all methods invoked on the session will return {@link ACAMERA_ERROR_SESSION_CLOSED},
* and any repeating requests are stopped (as if {@link ACameraCaptureSession_stopRepeating} was
* called). However, any in-progress capture requests submitted to the session will be completed as
* normal once all captures have completed and the session has been torn down,
* {@link ACameraCaptureSession_stateCallbacks#onClosed} callback will be called and the seesion
* will be removed from memory.</p>
*
* <p>Closing a session is idempotent closing more than once has no effect.</p>
*
* @param session the capture session of interest
*/
ACameraCaptureSession_close :: proc(session: ^ACameraCaptureSession) ---
/**
* Get the ACameraDevice pointer associated with this capture session in the device argument
* if the method succeeds.
*
* @param session the capture session of interest
* @param device the {@link ACameraDevice} associated with session. Will be set to NULL
* if the session is closed or this method fails.
* @return <ul><li>
* {@link ACAMERA_OK} if the method call succeeds. The {@link ACameraDevice}
* will be stored in device argument</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or device is NULL</li>
* <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
*
*/
ACameraCaptureSession_getDevice :: proc(session: ^ACameraCaptureSession, device: ^^ACameraDevice) -> CameraStatus ---
/**
* Submit an array of requests to be captured in sequence as a burst in the minimum of time possible.
*
* <p>The burst will be captured in the minimum amount of time possible, and will not be
* interleaved with requests submitted by other capture or repeat calls.</p>
*
* <p>Each capture produces one {@link ACameraMetadata} as a capture result and image buffers for
* one or more target {@link ANativeWindow}s. The target ANativeWindows (set with
* {@link ACaptureRequest_addTarget}) must be a subset of the ANativeWindow provided when
* this capture session was created.</p>
*
* @param session the capture session of interest
* @param callbacks the {@link ACameraCaptureSession_captureCallbacks} to be associated this capture
* sequence. No capture callback will be fired if this is set to NULL.
* @param numRequests number of requests in requests argument. Must be at least 1.
* @param requests an array of {@link ACaptureRequest} to be captured. Length must be at least
* numRequests.
* @param captureSequenceId the capture sequence ID associated with this capture method invocation
* will be stored here if this argument is not NULL and the method call succeeds.
* When this argument is set to NULL, the capture sequence ID will not be returned.
*
* @return <ul><li>
* {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
* if it is not NULL.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or requests is NULL, or
* if numRequests < 1</li>
* <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
*/
ACameraCaptureSession_capture :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_captureCallbacks, numRequests: i32, requests: [^]^ACaptureRequest, captureSequenceId: ^i32) -> CameraStatus ---
/**
* Request endlessly repeating capture of a sequence of images by this capture session.
*
* <p>With this method, the camera device will continually capture images,
* cycling through the settings in the provided list of
* {@link ACaptureRequest}, at the maximum rate possible.</p>
*
* <p>If a request is submitted through {@link ACameraCaptureSession_capture},
* the current repetition of the request list will be
* completed before the higher-priority request is handled. This guarantees
* that the application always receives a complete repeat burst captured in
* minimal time, instead of bursts interleaved with higher-priority
* captures, or incomplete captures.</p>
*
* <p>Repeating burst requests are a simple way for an application to
* maintain a preview or other continuous stream of frames where each
* request is different in a predicatable way, without having to continually
* submit requests through {@link ACameraCaptureSession_capture}.</p>
*
* <p>To stop the repeating capture, call {@link ACameraCaptureSession_stopRepeating}. Any
* ongoing burst will still be completed, however. Calling
* {@link ACameraCaptureSession_abortCaptures} will also clear the request.</p>
*
* <p>Calling this method will replace a previously-set repeating requests
* set up by this method, although any in-progress burst will be completed before the new repeat
* burst will be used.</p>
*
* @param session the capture session of interest
* @param callbacks the {@link ACameraCaptureSession_captureCallbacks} to be associated with this
* capture sequence. No capture callback will be fired if callbacks is set to NULL.
* @param numRequests number of requests in requests array. Must be at least 1.
* @param requests an array of {@link ACaptureRequest} to be captured. Length must be at least
* numRequests.
* @param captureSequenceId the capture sequence ID associated with this capture method invocation
* will be stored here if this argument is not NULL and the method call succeeds.
* When this argument is set to NULL, the capture sequence ID will not be returned.
*
* @return <ul><li>
* {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
* if it is not NULL.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or requests is NULL, or
* if numRequests < 1</li>
* <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
*/
ACameraCaptureSession_setRepeatingRequest :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_captureCallbacks, numRequests: i32, requests: [^]^ACaptureRequest, captureSequenceId: ^i32) -> CameraStatus ---
/**
* Cancel any ongoing repeating capture set by {@link ACameraCaptureSession_setRepeatingRequest}.
* Has no effect on requests submitted through {@link ACameraCaptureSession_capture}.
*
* <p>Any currently in-flight captures will still complete, as will any burst that is
* mid-capture. To ensure that the device has finished processing all of its capture requests
* and is in ready state, wait for the {@link ACameraCaptureSession_stateCallbacks#onReady} callback
* after calling this method.</p>
*
* @param session the capture session of interest
*
* @return <ul><li>
* {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
* if it is not NULL.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session is NULL.</li>
* <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
*/
ACameraCaptureSession_stopRepeating :: proc(session: ^ACameraCaptureSession) -> CameraStatus ---
/**
* Discard all captures currently pending and in-progress as fast as possible.
*
* <p>The camera device will discard all of its current work as fast as possible. Some in-flight
* captures may complete successfully and call
* {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted},
* while others will trigger their {@link ACameraCaptureSession_captureCallbacks#onCaptureFailed}
* callbacks. If a repeating request list is set, it will be cleared.</p>
*
* <p>This method is the fastest way to switch the camera device to a new session with
* {@link ACameraDevice_createCaptureSession}, at the cost of discarding in-progress
* work. It must be called before the new session is created. Once all pending requests are
* either completed or thrown away, the {@link ACameraCaptureSession_stateCallbacks#onReady}
* callback will be called, if the session has not been closed. Otherwise, the
* {@link ACameraCaptureSession_stateCallbacks#onClosed}
* callback will be fired when a new session is created by the camera device and the previous
* session is being removed from memory.</p>
*
* <p>Cancelling will introduce at least a brief pause in the stream of data from the camera
* device, since once the camera device is emptied, the first new request has to make it through
* the entire camera pipeline before new output buffers are produced.</p>
*
* <p>This means that using ACameraCaptureSession_abortCaptures to simply remove pending requests is
* not recommended it's best used for quickly switching output configurations, or for cancelling
* long in-progress requests (such as a multi-second capture).</p>
*
* @param session the capture session of interest
*
* @return <ul><li>
* {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
* if it is not NULL.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session is NULL.</li>
* <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
*/
ACameraCaptureSession_abortCaptures :: proc(session: ^ACameraCaptureSession) -> CameraStatus ---
/**
* Update shared ACaptureSessionOutput.
*
* <p>A shared ACaptureSessionOutput (see {@link ACaptureSessionSharedOutput_create}) that
* was modified via calls to {@link ACaptureSessionSharedOutput_add} or
* {@link ACaptureSessionSharedOutput_remove} must be updated by calling this method before its
* changes take effect. After the update call returns with {@link ACAMERA_OK}, any newly added
* native windows can be used as a target in subsequent capture requests.</p>
*
* <p>Native windows that get removed must not be part of any active repeating or single/burst
* request or have any pending results. Consider updating repeating requests via
* {@link ACameraCaptureSession_setRepeatingRequest} and then wait for the last frame number
* when the sequence completes
* {@link ACameraCaptureSession_captureCallbacks#onCaptureSequenceCompleted}.</p>
*
* <p>Native windows that get added must not be part of any other registered ACaptureSessionOutput
* and must be compatible. Compatible windows must have matching format, rotation and
* consumer usage.</p>
*
* <p>A shared ACameraCaptureSession can support up to 4 additional native windows.</p>
*
* @param session the capture session of interest
* @param output the modified output configuration
*
* @return <ul><li>
* {@link ACAMERA_OK} if the method succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or output is NULL or output
* contains invalid native windows or if an attempt was made to add
* a native window to a different output configuration or new native window is not
* compatible or any removed native window still has pending requests</li>
* <li>{@link ACAMERA_ERROR_INVALID_OPERATION} if output configuration is not shared (see
* {@link ACaptureSessionSharedOutput_create} or the number of additional
* native windows goes beyond the supported limit.</li>
* <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal
* error</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
*/
ACameraCaptureSession_updateSharedOutput :: proc(session: ^ACameraCaptureSession, output: ^ACaptureSessionOutput) -> CameraStatus ---
/**
* This has the same functionality as ACameraCaptureSession_capture, with added
* support for logical multi-camera where the capture callbacks supports result metadata for
* physical cameras.
*/
ACameraCaptureSession_logicalCamera_capture :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_logicalCamera_captureCallbacks, numRequests: i32, requests: [^]^ACaptureRequest, captureSequenceId: ^i32) -> CameraStatus ---
/**
* This has the same functionality as ACameraCaptureSession_setRepeatingRequest, with added
* support for logical multi-camera where the capture callbacks supports result metadata for
* physical cameras.
*/
ACameraCaptureSession_logicalCamera_setRepeatingRequest :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_logicalCamera_captureCallbacks, numRequests: i32, requests: [^]^ACaptureRequest, captureSequenceId: ^i32) -> CameraStatus ---
/**
* This has the same functionality as ACameraCaptureSession_capture, with added
* support for v2 of camera callbacks, where the onCaptureStarted callback
* adds frame number in its parameter list.
*/
ACameraCaptureSession_captureV2 :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_captureCallbacksV2, numRequests: i32, requests: [^]^ACaptureRequest, captureSequenceId: ^i32) -> CameraStatus ---
/**
* This has the same functionality as ACameraCaptureSession_logical_setRepeatingRequest, with added
* support for v2 of logical multi-camera callbacks where the onCaptureStarted
* callback adds frame number in its parameter list.
*/
ACameraCaptureSession_setRepeatingRequestV2 :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_captureCallbacksV2, numRequests: i32, requests: [^]^ACaptureRequest, captureSequenceId: ^i32) -> CameraStatus ---
/**
* This has the same functionality as ACameraCaptureSession_logical_capture, with added
* support for v2 of logical multi-camera callbacks where the onCaptureStarted callback
* adds frame number in its parameter list.
*/
ACameraCaptureSession_logicalCamera_captureV2 :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_logicalCamera_captureCallbacksV2, numRequests: i32, requests: [^]^i32, captureSequenceId: ^i32) -> CameraStatus ---
/**
* This has the same functionality as ACameraCaptureSession_logical_setRepeatingRequest, with added
* support for v2 of logical multi-camera callbacks where the onCaptureStarted
* callback adds frame number in its parameter list.
*/
ACameraCaptureSession_logicalCamera_setRepeatingRequestV2 :: proc(session: ^ACameraCaptureSession, callbacks: [^]ACameraCaptureSession_logicalCamera_captureCallbacksV2, numRequests: i32, requests: [^]^ACaptureRequest, captureSequenceId: ^i32) -> CameraStatus ---
}
+815
View File
@@ -0,0 +1,815 @@
//+build android
package camerandk
foreign import camerandk "system:camera2ndk"
/// Enum for ACameraDevice_ErrorStateCallback error code
ErrorStateCallbackError :: enum i32 {
/**
* The camera device is in use already.
*/
CAMERA_IN_USE = 1,
/**
* 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.
*/
MAX_CAMERAS_IN_USE = 2,
/**
* The camera is disabled due to a device policy, and cannot be opened.
*/
CAMERA_DISABLED = 3,
/**
* The camera device has encountered a fatal error.
* <p>The camera device needs to be re-opened to be used again.</p>
*/
CAMERA_DEVICE = 4,
/**
* 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.
* An attempt at recovery may be possible by closing the
* CameraDevice and the CameraManager, and trying to acquire all resources
* again from scratch.</p>
*/
CAMERA_SERVICE = 5
}
/**
* Capture request pre-defined template types, used in {@link ACameraDevice_createCaptureRequest}
* and {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
*/
ACameraDevice_request_template :: enum {
/**
* Create a request suitable for a camera preview window. Specifically, this
* means that high frame rate is given priority over the highest-quality
* post-processing. These requests would normally be used with the
* {@link ACameraCaptureSession_setRepeatingRequest} method.
* This template is guaranteed to be supported on all camera devices.
*
* @see ACameraDevice_createCaptureRequest
*/
PREVIEW = 1,
/**
* Create a request suitable for still image capture. Specifically, this
* means prioritizing image quality over frame rate. These requests would
* commonly be used with the {@link ACameraCaptureSession_capture} method.
* This template is guaranteed to be supported on all camera devices.
*
* @see ACameraDevice_createCaptureRequest
*/
STILL_CAPTURE = 2,
/**
* Create a request suitable for video recording. Specifically, this means
* that a stable frame rate is used, and post-processing is set for
* recording quality. These requests would commonly be used with the
* {@link ACameraCaptureSession_setRepeatingRequest} method.
* This template is guaranteed to be supported on all camera devices.
*
* @see ACameraDevice_createCaptureRequest
*/
RECORD = 3,
/**
* Create a request suitable for still image capture while recording
* video. Specifically, this means maximizing image quality without
* disrupting the ongoing recording. These requests would commonly be used
* with the {@link ACameraCaptureSession_capture} method while a request based on
* {@link TEMPLATE_RECORD} is is in use with {@link ACameraCaptureSession_setRepeatingRequest}.
* This template is guaranteed to be supported on all camera devices.
*
* @see ACameraDevice_createCaptureRequest
*/
VIDEO_SNAPSHOT = 4,
/**
* Create a request suitable for zero shutter lag still capture. This means
* means maximizing image quality without compromising preview frame rate.
* AE/AWB/AF should be on auto mode.
*
* @see ACameraDevice_createCaptureRequest
*/
ZERO_SHUTTER_LAG = 5,
/**
* A basic template for direct application control of capture
* parameters. All automatic control is disabled (auto-exposure, auto-white
* balance, auto-focus), and post-processing parameters are set to preview
* quality. The manual capture parameters (exposure, sensitivity, and so on)
* are set to reasonable defaults, but should be overriden by the
* application depending on the intended use case.
* This template is guaranteed to be supported on camera devices that support the
* {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR} capability.
*
* @see ACameraDevice_createCaptureRequest
*/
MANUAL = 6,
}
/**
* ACameraDevice is opaque type that provides access to a camera device.
*
* A pointer can be obtained using {@link ACameraManager_openCamera} method.
*/
ACameraDevice :: struct{}
/**
* Struct to hold list of camera device Ids. This can refer to either the Ids
* of connected camera devices returned from {@link ACameraManager_getCameraIdList},
* or the physical camera Ids passed into
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
*/
ACameraIdList :: struct {
numCameras: i32, ///< Number of camera device Ids
cameraIds: [^]cstring, ///< list of camera device Ids
}
/**
* Applications' callbacks for camera device state changes, register with
* {@link ACameraManager_openCamera}.
*/
ACameraDevice_StateCallbacks :: struct {
/// optional application context.
_context: rawptr,
/**
* The function is called when a camera device is no longer available for use.
*
* <p>Any attempt to call API methods on this ACameraDevice will return
* {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}. The disconnection could be due to a
* change in security policy or permissions, the physical disconnection
* of a removable camera device, or the camera being needed for a
* higher-priority camera API client.</p>
*
* <p>Application should clean up the camera with {@link ACameraDevice_close} after
* this happens, as it is not recoverable until the camera can be opened
* again.</p>
*
*/
onDisconnected: ACameraDevice_StateCallback,
/**
* The function called when a camera device has encountered a serious error.
*
* <p>This indicates a failure of the camera device or camera service in some way.
* Any attempt to call API methods on this ACameraDevice in the future will return
* {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}.</p>
*
* <p>There may still be capture completion or camera stream callbacks that will be called
* after this error is received.</p>
*
* <p>Application should clean up the camera with {@link ACameraDevice_close} after this
* happens. Further attempts at recovery are error-code specific.</p>
*
*/
onError: ACameraDevice_ErrorStateCallback,
}
/**
* Opaque object for CaptureSessionOutput container, use
* {@link ACaptureSessionOutputContainer_create} to create an instance.
*/
ACaptureSessionOutputContainer :: struct{}
/**
* Camera device state callbacks to be used in {@link ACameraDevice_StateCallbacks}.
*
* @param context The optional context in {@link ACameraDevice_StateCallbacks} will be
* passed to this callback.
* @param device The {@link ACameraDevice} that is being disconnected.
*/
ACameraDevice_StateCallback :: #type proc "c" (_context: rawptr, device: ^ACameraDevice)
/**
* Camera device error state callbacks to be used in {@link ACameraDevice_StateCallbacks}.
*
* @param context The optional context in {@link ACameraDevice_StateCallbacks} will be
* passed to this callback.
* @param device The {@link ACameraDevice} that is being disconnected.
* @param error The error code describes the cause of this error callback. See the folowing
* links for more detail.
*
* @see ERROR_CAMERA_IN_USE
* @see ERROR_MAX_CAMERAS_IN_USE
* @see ERROR_CAMERA_DISABLED
* @see ERROR_CAMERA_DEVICE
* @see ERROR_CAMERA_SERVICE
*/
ACameraDevice_ErrorStateCallback :: #type proc "c" (_context: rawptr, device: ^ACameraDevice, error: ErrorStateCallbackError)
/**
* For backward compatiblity.
*/
ACameraDevice_stateCallbacks :: ACameraDevice_StateCallbacks
foreign camerandk {
/**
* Close the connection and free this ACameraDevice synchronously. Access to the ACameraDevice
* after calling this method will cause a crash.
*
* <p>After this call, all calls to the active ACameraCaptureSession associated to this
* ACameraDevice will return {@link ACAMERA_ERROR_SESSION_CLOSED} except for calls to
* {@link ACameraCaptureSession_close}.</p>
*
* <p>This method will stop all repeating captures sent via
* {@link ACameraCaptureSession_setRepeatingRequest} and block until all capture requests sent via
* {@link ACameraCaptureSession_capture} is complete. Once the method returns, the camera device
* will be removed from memory and access to the closed camera device pointer will cause a crash.</p>
*
* @param device the camera device to be closed
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device is NULL.</li></ul>
*/
ACameraDevice_close :: proc(device: ^ACameraDevice) -> CameraStatus ---
/**
* Return the camera id associated with this camera device.
*
* @param device the camera device to be closed
*
* @return camera ID string. The returned string is managed by framework and should not be
* delete/free by the application. Also the returned string must not be used after the device
* has been closed.
*/
ACameraDevice_getId :: proc(device: ^ACameraDevice) -> cstring ---
/**
* Create a ACaptureRequest for capturing images, initialized with template
* for a target use case.
*
* <p>The settings are chosen to be the best options for this camera device,
* so it is not recommended to reuse the same request for a different camera device.</p>
*
* @param device the camera device of interest
* @param templateId the type of capture request to be created.
* See {@link ACameraDevice_request_template}.
* @param request the output request will be stored here if the method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created capture request will be
* filled in request argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device or request is NULL, templateId
* is undefined or camera device does not support requested template.
* </li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*
* @see TEMPLATE_PREVIEW
* @see TEMPLATE_RECORD
* @see TEMPLATE_STILL_CAPTURE
* @see TEMPLATE_VIDEO_SNAPSHOT
* @see TEMPLATE_MANUAL
*/
ACameraDevice_createCaptureRequest :: proc(device: ^ACameraDevice, templateId: ACameraDevice_request_template, request: ^^ACaptureRequest) -> CameraStatus ---
/**
* Create a capture session output container.
*
* <p>The container is used in {@link ACameraDevice_createCaptureSession} method to create a capture
* session. Use {@link ACaptureSessionOutputContainer_free} to free the container and its memory
* after application no longer needs the ACaptureSessionOutputContainer.</p>
*
* @param container the output {@link ACaptureSessionOutputContainer} will be stored here if the
* method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
* filled in container argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container is NULL.</li></ul>
*/
ACaptureSessionOutputContainer_create :: proc(container: ^^ACaptureSessionOutputContainer) -> CameraStatus ---
/**
* Free a capture session output container.
*
* @param container the {@link ACaptureSessionOutputContainer} to be freed.
*
* @see ACaptureSessionOutputContainer_create
*/
ACaptureSessionOutputContainer_free :: proc(container: ^ACaptureSessionOutputContainer) ---
/**
* Create a ACaptureSessionOutput object.
*
* <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
* an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
* {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
* needs the {@link ACaptureSessionOutput}.</p>
*
* @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
* @param output the output {@link ACaptureSessionOutput} will be stored here if the
* method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
* filled in the output argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL.</li></ul>
*
* @see ACaptureSessionOutputContainer_add
*/
ACaptureSessionOutput_create :: proc(anw: ^ACameraWindowType, output: ^^ACaptureSessionOutput) -> CameraStatus ---
/**
* Free a ACaptureSessionOutput object.
*
* @param output the {@link ACaptureSessionOutput} to be freed.
*
* @see ACaptureSessionOutput_create
*/
ACaptureSessionOutput_free :: proc(output: ^ACaptureSessionOutput) ---
/**
* Add an {@link ACaptureSessionOutput} object to {@link ACaptureSessionOutputContainer}.
*
* @param container the {@link ACaptureSessionOutputContainer} of interest.
* @param output the output {@link ACaptureSessionOutput} to be added to container.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul>
*/
ACaptureSessionOutputContainer_add :: proc(container: ^ACaptureSessionOutputContainer, output: ^ACaptureSessionOutput) -> CameraStatus ---
/**
* Remove an {@link ACaptureSessionOutput} object from {@link ACaptureSessionOutputContainer}.
*
* <p>This method has no effect if the ACaptureSessionOutput does not exist in
* ACaptureSessionOutputContainer.</p>
*
* @param container the {@link ACaptureSessionOutputContainer} of interest.
* @param output the output {@link ACaptureSessionOutput} to be removed from container.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul>
*/
ACaptureSessionOutputContainer_remove :: proc(container: ^ACaptureSessionOutputContainer, output: ^ACaptureSessionOutput) -> CameraStatus ---
/**
* Create a new camera capture session by providing the target output set of {@link ANativeWindow}
* to the camera device.
*
* <p>If there is a preexisting session, the previous session will be closed
* automatically. However, app still needs to call {@link ACameraCaptureSession_close} on previous
* session. Otherwise the resources held by previous session will NOT be freed.</p>
*
* <p>The active capture session determines the set of potential output {@link ANativeWindow}s for
* the camera device for each capture request. A given request may use all
* or only some of the outputs. Once the ACameraCaptureSession is created, requests can be
* submitted with {@link ACameraCaptureSession_capture} or
* {@link ACameraCaptureSession_setRepeatingRequest}.</p>
*
* <p>Often the {@link ANativeWindow} used with this method can be obtained from a <a href=
* "http://developer.android.com/reference/android/view/Surface.html">Surface</a> java object by
* {@link ANativeWindow_fromSurface} NDK method. Surfaces or ANativeWindow suitable for inclusion as a camera
* output can be created for various use cases and targets:</p>
*
* <ul>
*
* <li>For drawing to a
* <a href="http://developer.android.com/reference/android/view/SurfaceView.html">SurfaceView</a>:
* Once the SurfaceView's Surface is created, set the size
* of the Surface with
* <a href="http://developer.android.com/reference/android/view/SurfaceHolder.html#setFixedSize(int, int)">
* android.view.SurfaceHolder\#setFixedSize</a> to be one of the PRIVATE output sizes
* returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}
* and then obtain the Surface by calling <a href=
* "http://developer.android.com/reference/android/view/SurfaceHolder.html#getSurface()">
* android.view.SurfaceHolder\#getSurface</a>. If the size is not set by the application, it will
* be rounded to the nearest supported size less than 1080p, by the camera device.</li>
*
* <li>For accessing through an OpenGL texture via a <a href=
* "http://developer.android.com/reference/android/graphics/SurfaceTexture.html">SurfaceTexture</a>:
* Set the size of the SurfaceTexture with <a href=
* "http://developer.android.com/reference/android/graphics/SurfaceTexture.html#setDefaultBufferSize(int, int)">
* setDefaultBufferSize</a> to be one of the PRIVATE output sizes
* returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}
* before creating a Surface from the SurfaceTexture with <a href=
* "http://developer.android.com/reference/android/view/Surface.html#Surface(android.graphics.SurfaceTexture)">
* Surface\#Surface(SurfaceTextrue)</a>. If the size is not set by the application, it will be set to be the
* smallest supported size less than 1080p, by the camera device.</li>
*
* <li>For recording with <a href=
* "http://developer.android.com/reference/android/media/MediaCodec.html">
* MediaCodec</a>: Call
* <a href=
* "http://developer.android.com/reference/android/media/MediaCodec.html#createInputSurface()">
* android.media.MediaCodec\#createInputSurface</a> after configuring
* the media codec to use one of the PRIVATE output sizes
* returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}.
* </li>
*
* <li>For recording with <a href=
* "http://developer.android.com/reference/android/media/MediaRecorder.html">
* MediaRecorder</a>: Call
* <a href="http://developer.android.com/reference/android/media/MediaRecorder.html#getSurface()">
* android.media.MediaRecorder\#getSurface</a> after configuring the media recorder to use
* one of the PRIVATE output sizes returned by
* {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}, or configuring it to use one of the supported
* <a href="http://developer.android.com/reference/android/media/CamcorderProfile.html">
* CamcorderProfiles</a>.</li>
*
* <li>For access to RAW, uncompressed YUV, or compressed JPEG data in the application: Create an
* {@link AImageReader} object using the {@link AImageReader_new} method with one of the supported
* output formats given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}. Then obtain a
* ANativeWindow from it with {@link AImageReader_getWindow}.
* If the AImageReader size is not set to a supported size, it will be rounded to a supported
* size less than 1080p by the camera device.
* </li>
*
* </ul>
*
* <p>The camera device will query each ANativeWindow's size and formats upon this
* call, so they must be set to a valid setting at this time.</p>
*
* <p>It can take several hundred milliseconds for the session's configuration to complete,
* since camera hardware may need to be powered on or reconfigured.</p>
*
* <p>If a prior ACameraCaptureSession already exists when this method is called, the previous
* session will no longer be able to accept new capture requests and will be closed. Any
* in-progress capture requests made on the prior session will be completed before it's closed.
* To minimize the transition time,
* the ACameraCaptureSession_abortCaptures method can be used to discard the remaining
* requests for the prior capture session before a new one is created. Note that once the new
* session is created, the old one can no longer have its captures aborted.</p>
*
* <p>Using larger resolution outputs, or more outputs, can result in slower
* output rate from the device.</p>
*
* <p>Configuring a session with an empty list will close the current session, if
* any. This can be used to release the current session's target surfaces for another use.</p>
*
* <p>While any of the sizes from {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be used when
* a single output stream is configured, a given camera device may not be able to support all
* combination of sizes, formats, and targets when multiple outputs are configured at once. The
* tables below list the maximum guaranteed resolutions for combinations of streams and targets,
* given the capabilities of the camera device.</p>
*
* <p>If an application tries to create a session using a set of targets that exceed the limits
* described in the below tables, one of three possibilities may occur. First, the session may
* be successfully created and work normally. Second, the session may be successfully created,
* but the camera device won't meet the frame rate guarantees as described in
* {@link ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS}. Or third, if the output set
* cannot be used at all, session creation will fail entirely, with
* {@link ACAMERA_ERROR_STREAM_CONFIGURE_FAIL} being returned.</p>
*
* <p>For the type column `PRIV` refers to output format {@link AIMAGE_FORMAT_PRIVATE},
* `YUV` refers to output format {@link AIMAGE_FORMAT_YUV_420_888},
* `JPEG` refers to output format {@link AIMAGE_FORMAT_JPEG},
* and `RAW` refers to output format {@link AIMAGE_FORMAT_RAW16}
*
*
* <p>For the maximum size column, `PREVIEW` refers to the best size match to the
* device's screen resolution, or to 1080p `(1920x1080)`, whichever is
* smaller. `RECORD` refers to the camera device's maximum supported recording resolution,
* as determined by <a href="http://developer.android.com/reference/android/media/CamcorderProfile.html">
* android.media.CamcorderProfiles</a>. And `MAXIMUM` refers to the
* camera device's maximum output resolution for that format or target from
* {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}.</p>
*
* <p>To use these tables, determine the number and the formats/targets of outputs needed, and
* find the row(s) of the table with those targets. The sizes indicate the maximum set of sizes
* that can be used it is guaranteed that for those targets, the listed sizes and anything
* smaller from the list given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be
* successfully used to create a session. For example, if a row indicates that a 8 megapixel
* (MP) YUV_420_888 output can be used together with a 2 MP `PRIV` output, then a session
* can be created with targets `[8 MP YUV, 2 MP PRIV]` or targets `[2 MP YUV, 2 MP PRIV]`
* but a session with targets `[8 MP YUV, 4 MP PRIV]`, targets `[4 MP YUV, 4 MP PRIV]`,
* or targets `[8 MP PRIV, 2 MP YUV]` would not be guaranteed to work, unless
* some other row of the table lists such a combination.</p>
*
* <p>Legacy devices ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
* `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY}) support at
* least the following stream combinations:
*
* <table>
* <tr><th colspan="7">LEGACY-level guaranteed configurations</th></tr>
* <tr> <th colspan="2" id="rb">Target 1</th> <th colspan="2" id="rb">Target 2</th> <th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
* <tr> <th>Type</th><th id="rb">Max size</th> <th>Type</th><th id="rb">Max size</th> <th>Type</th><th id="rb">Max size</th></tr>
* <tr> <td>`PRIV`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>Simple preview, GPU video processing, or no-preview video recording.</td> </tr>
* <tr> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>No-viewfinder still image capture.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>In-application video/image processing.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Standard still imaging.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>In-app processing plus still capture.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td colspan="2" id="rb"></td> <td>Standard recording.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td colspan="2" id="rb"></td> <td>Preview plus in-app processing.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>Still capture plus in-app processing.</td> </tr>
* </table><br>
* </p>
*
* <p>Limited-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
* `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED}) devices
* support at least the following stream combinations in addition to those for
* {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY} devices:
*
* <table>
* <tr><th colspan="7">LIMITED-level additional guaranteed configurations</th></tr>
* <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
* <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th></tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`RECORD `</td> <td colspan="2" id="rb"></td> <td>High-resolution video recording with preview.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`RECORD `</td> <td colspan="2" id="rb"></td> <td>High-resolution in-app video processing with preview.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`RECORD `</td> <td colspan="2" id="rb"></td> <td>Two-input in-app video processing.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`RECORD `</td> <td>`JPEG`</td><td id="rb">`RECORD `</td> <td>High-resolution recording with video snapshot.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`RECORD `</td> <td>`JPEG`</td><td id="rb">`RECORD `</td> <td>High-resolution in-app processing with video snapshot.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>Two-input in-app processing with still capture.</td> </tr>
* </table><br>
* </p>
*
* <p>FULL-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
* `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL}) devices
* support at least the following stream combinations in addition to those for
* {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices:
*
* <table>
* <tr><th colspan="7">FULL-level additional guaranteed configurations</th></tr>
* <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
* <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Maximum-resolution GPU processing with preview.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Maximum-resolution in-app processing with preview.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Maximum-resolution two-input in-app processsing.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>Video recording with maximum-size video snapshot</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`640x480`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Standard video recording plus maximum-resolution in-app processing.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`640x480`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Preview plus two-input maximum-resolution in-app processing.</td> </tr>
* </table><br>
* </p>
*
* <p>RAW-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
* {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}) devices additionally support
* at least the following stream combinations on both
* {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and
* {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices:
*
* <table>
* <tr><th colspan="7">RAW-capability additional guaranteed configurations</th></tr>
* <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
* <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
* <tr> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>No-preview DNG capture.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Standard DNG capture.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>In-app processing plus DNG capture.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Video recording with DNG capture.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Preview with in-app processing and DNG capture.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Two-input in-app processing plus DNG capture.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Still capture with simultaneous JPEG and DNG.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>In-app processing with simultaneous JPEG and DNG.</td> </tr>
* </table><br>
* </p>
*
* <p>BURST-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
* {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE BURST_CAPTURE}) devices
* support at least the below stream combinations in addition to those for
* {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices. Note that all
* FULL-level devices support the BURST capability, and the below list is a strict subset of the
* list for FULL-level devices, so this table is only relevant for LIMITED-level devices that
* support the BURST_CAPTURE capability.
*
* <table>
* <tr><th colspan="5">BURST-capability additional guaranteed configurations</th></tr>
* <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th rowspan="2">Sample use case(s)</th> </tr>
* <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`MAXIMUM`</td> <td>Maximum-resolution GPU processing with preview.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Maximum-resolution in-app processing with preview.</td> </tr>
* <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Maximum-resolution two-input in-app processsing.</td> </tr>
* </table><br>
* </p>
*
* <p>LEVEL-3 ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
* `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 LEVEL_3})
* support at least the following stream combinations in addition to the combinations for
* {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and for
* RAW capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
* {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}):
*
* <table>
* <tr><th colspan="11">LEVEL-3 additional guaranteed configurations</th></tr>
* <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th><th colspan="2" id="rb">Target 4</th><th rowspan="2">Sample use case(s)</th> </tr>
* <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`640x480`</td> <td>`YUV`</td><td id="rb">`MAXIMUM`</td> <td>`RAW`</td><td id="rb">`MAXIMUM`</td> <td>In-app viewfinder analysis with dynamic selection of output format.</td> </tr>
* <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`640x480`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>`RAW`</td><td id="rb">`MAXIMUM`</td> <td>In-app viewfinder analysis with dynamic selection of output format.</td> </tr>
* </table><br>
* </p>
*
* <p>Since the capabilities of camera devices vary greatly, a given camera device may support
* target combinations with sizes outside of these guarantees, but this can only be tested for
* by attempting to create a session with such targets.</p>
*
* <p>Exception on 176x144 (QCIF) resolution:
* Camera devices usually have a fixed capability for downscaling from larger resolution to
* smaller, and the QCIF resolution sometimes cannot be fully supported due to this
* limitation on devices with high-resolution image sensors. Therefore, trying to configure a
* QCIF resolution stream together with any other stream larger than 1920x1080 resolution
* (either width or height) might not be supported, and capture session creation will fail if it
* is not.</p>
*
* @param device the camera device of interest.
* @param outputs the {@link ACaptureSessionOutputContainer} describes all output streams.
* @param callbacks the {@link ACameraCaptureSession_stateCallbacks capture session state callbacks}.
* @param session the created {@link ACameraCaptureSession} will be filled here if the method call
* succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created capture session will be
* filled in session argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if any of device, outputs, callbacks or
* session is NULL.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*/
ACameraDevice_createCaptureSession :: proc(device: ^ACameraDevice, outputs: [^]ACaptureSessionOutputContainer, callbacks: [^]ACameraCaptureSession_stateCallbacks, session: ^^ACameraCaptureSession) -> CameraStatus ---
/**
* Create a shared ACaptureSessionOutput object.
*
* <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
* an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
* {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
* needs the {@link ACaptureSessionOutput}. A shared ACaptureSessionOutput can be further modified
* via {@link ACaptureSessionSharedOutput_add} or {@link ACaptureSessionSharedOutput_remove} and
* must be updated via {@link ACameraCaptureSession_updateSharedOutput}.</p>
*
* @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
* @param output the output {@link ACaptureSessionOutput} will be stored here if the
* method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
* filled in the output argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL.</li></ul>
*
* @see ACaptureSessionOutputContainer_add
*/
ACaptureSessionSharedOutput_create :: proc(anw: ^ACameraWindowType, output: ^^ACaptureSessionOutput) -> CameraStatus ---
/**
* Add a native window to shared ACaptureSessionOutput.
*
* The ACaptureSessionOutput must be created via {@link ACaptureSessionSharedOutput_create}.
*
* @param output the shared ACaptureSessionOutput to be extended.
* @param anw The new native window.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL or output is not
* shared see {@link ACaptureSessionSharedOutput_create} or anw matches with the native
* window associated with ACaptureSessionOutput or anw is already present inside
* ACaptureSessionOutput.</li></ul>
*/
ACaptureSessionSharedOutput_add :: proc(output: ^ACaptureSessionOutput, anw: ^ACameraWindowType) -> CameraStatus ---
/**
* Remove a native window from shared ACaptureSessionOutput.
*
* @param output the {@link ACaptureSessionOutput} to be modified.
* @param anw The native window to be removed.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL or output is not
* shared see {@link ACaptureSessionSharedOutput_create} or anw matches with the native
* window associated with ACaptureSessionOutput or anw is not present inside
* ACaptureSessionOutput.</li></ul>
*/
ACaptureSessionSharedOutput_remove :: proc(output: ^ACaptureSessionOutput, anw: ^ACameraWindowType) -> CameraStatus ---
/**
* Create a new camera capture session similar to {@link ACameraDevice_createCaptureSession}. This
* function allows clients to pass additional session parameters during session initialization. For
* further information about session parameters see {@link ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS}.
*
* @param device the camera device of interest.
* @param outputs the {@link ACaptureSessionOutputContainer} describes all output streams.
* @param sessionParameters An optional capture request that contains the initial values of session
* parameters advertised in
* {@link ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS}.
* @param callbacks the {@link ACameraCaptureSession_stateCallbacks}
* capture session state callbacks.
* @param session the created {@link ACameraCaptureSession} will be filled here if the method call
* succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created capture session will be
* filled in session argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if any of device, outputs, callbacks or
* session is NULL.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.
* </li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*/
ACameraDevice_createCaptureSessionWithSessionParameters :: proc(device: ^ACameraDevice, outputs: [^]ACaptureSessionOutputContainer, sessionParameters: [^]ACaptureRequest, callbacks: [^]ACameraCaptureSession_stateCallbacks, session: ^^ACameraCaptureSession) -> CameraStatus ---
/**
* Create a ACaptureSessionOutput object used for streaming from a physical
* camera as part of a logical camera device.
*
* <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
* an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
* {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
* needs the {@link ACaptureSessionOutput}.</p>
*
* @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
* @param physicalId the Id of the physical camera this output is associated
* with.
* @param output the output {@link ACaptureSessionOutput} will be stored here if the
* method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
* filled in the output argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw, physicalId or output is NULL.</li></ul>
*
* @see ACaptureSessionOutputContainer_add
*/
ACaptureSessionPhysicalOutput_create :: proc(anw: ^ACameraWindowType, physicalId: cstring, output: ^^ACaptureSessionOutput) -> CameraStatus ---
/**
* Create a logical multi-camera ACaptureRequest for capturing images, initialized with template
* for a target use case, with the ability to specify physical camera settings.
*
* <p>The settings are chosen to be the best options for this camera device,
* so it is not recommended to reuse the same request for a different camera device.</p>
*
* <p>Note that for all keys in physical camera settings, only the keys
* advertised in ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS are
* applicable. All other keys are ignored by the camera device.</p>
*
* @param device the camera device of interest
* @param templateId the type of capture request to be created.
* See {@link ACameraDevice_request_template}.
* @param physicalIdList The list of physical camera Ids that can be used to
* customize the request for a specific physical camera.
* @param request the output request will be stored here if the method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created capture request will be
* filled in request argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device, physicalIdList, or request is
* NULL, templateId is undefined or camera device does not support
* requested template, or if some Ids in physicalIdList isn't a
* valid physical camera backing the current camera device.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
* <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*
* @see TEMPLATE_PREVIEW
* @see TEMPLATE_RECORD
* @see TEMPLATE_STILL_CAPTURE
* @see TEMPLATE_VIDEO_SNAPSHOT
* @see TEMPLATE_MANUAL
*/
ACameraDevice_createCaptureRequest_withPhysicalIds :: proc(device: ^ACameraDevice, templateId: ACameraDevice_request_template, physicalIdList: [^]ACameraIdList, request: ^^ACaptureRequest) -> CameraStatus ---
/**
* Check whether a particular {@link ACaptureSessionOutputContainer} is supported by
* the camera device.
*
* <p>This method performs a runtime check of a given {@link
* ACaptureSessionOutputContainer}. The result confirms whether or not the
* passed CaptureSession outputs can be successfully used to create a camera
* capture session using {@link ACameraDevice_createCaptureSession}.</p>
*
* <p>This method can be called at any point before, during and after active
* capture session. It must not impact normal camera behavior in any way and
* must complete significantly faster than creating a capture session.</p>
*
* <p>Although this method is faster than creating a new capture session, it is not intended
* to be used for exploring the entire space of supported stream combinations.</p>
*
* @param device the camera device of interest
* @param sessionOutputContainer the {@link ACaptureSessionOutputContainer} of
* interest.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the given {@link ACaptureSessionOutputContainer}
* is supported by the camera device.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device, or sessionOutputContainer
* is NULL.</li>
* <li>{@link ACAMERA_ERROR_STREAM_CONFIGURE_FAIL} if the given
* {@link ACaptureSessionOutputContainer}
* is not supported by
* the camera
* device.</li>
* <li>{@link ACAMERA_ERROR_UNSUPPORTED_OPERATION} if the query operation is not
* supported by the camera device.</li>
* </ul>
*/
ACameraDevice_isSessionConfigurationSupported :: proc(device: ^ACameraDevice, sessionOutputContainer: ^ACaptureSessionOutputContainer) -> CameraStatus ---
}
+105
View File
@@ -0,0 +1,105 @@
//+build android
package camerandk
/**
* Camera status enum types.
*/
CameraStatus :: enum {
/**
* Camera operation has succeeded.
*/
OK = 0,
ERROR_BASE = -10000,
/**
* Camera operation has failed due to an unspecified cause.
*/
ERROR_UNKNOWN = ERROR_BASE,
/**
* Camera operation has failed due to an invalid parameter being passed to the method.
*/
ERROR_INVALID_PARAMETER = 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.
*/
ERROR_CAMERA_DISCONNECTED = ERROR_BASE - 2,
/**
* Camera operation has failed due to insufficient memory.
*/
ERROR_NOT_ENOUGH_MEMORY = ERROR_BASE - 3,
/**
* Camera operation has failed due to the requested metadata tag cannot be found in input
* {@link ACameraMetadata} or {@link ACaptureRequest}.
*/
ERROR_METADATA_NOT_FOUND = 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.
*/
ERROR_CAMERA_DEVICE = 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>
*/
ERROR_CAMERA_SERVICE = ERROR_BASE - 6,
/**
* The {@link ACameraCaptureSession} has been closed and cannnot perform any operation other
* than {@link ACameraCaptureSession_close}.
*/
ERROR_SESSION_CLOSED = 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
*/
ERROR_INVALID_OPERATION = ERROR_BASE - 8,
/**
* Camera device does not support the stream configuration provided by application in
* {@link ACameraDevice_createCaptureSession} or {@link
* ACameraDevice_isSessionConfigurationSupported}.
*/
ERROR_STREAM_CONFIGURE_FAIL = ERROR_BASE - 9,
/**
* Camera device is being used by another higher priority camera API client.
*/
ERROR_CAMERA_IN_USE = 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.
*/
ERROR_MAX_CAMERA_IN_USE = ERROR_BASE - 11,
/**
* The camera is disabled due to a device policy, and cannot be opened.
*/
ERROR_CAMERA_DISABLED = ERROR_BASE - 12,
/**
* The application does not have permission to open camera.
*/
ERROR_PERMISSION_DENIED = ERROR_BASE - 13,
/**
* The operation is not supported by the camera device.
*/
ERROR_UNSUPPORTED_OPERATION = ERROR_BASE - 14,
}
+344
View File
@@ -0,0 +1,344 @@
//+build android
package camerandk
foreign import camerandk "system:camera2ndk"
/**
* ACameraManager is opaque type that provides access to camera service.
*
* A pointer can be obtained using {@link ACameraManager_create} method.
*/
ACameraManager :: struct{}
/**
* 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
*/
ACameraManager_AvailabilityCallbacks :: struct {
/// Optional application context.
_context: rawptr,
/// Called when a camera becomes available
onCameraAvailable: ACameraManager_AvailabilityCallback,
/// Called when a camera becomes unavailable
onCameraUnavailable: ACameraManager_AvailabilityCallback,
}
/**
* A listener for camera devices becoming available/unavailable to open or when
* the camera access permissions change.
*
* <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_registerExtendedAvailabilityCallback
*/
ACameraManager_ExtendedAvailabilityCallbacks :: struct {
/// Called when a camera becomes available or unavailable
availabilityCallbacks: ACameraManager_AvailabilityCallbacks,
/// Called when there is camera access permission change
onCameraAccessPrioritiesChanged: ACameraManager_AccessPrioritiesChangedCallback,
/// Called when a physical camera becomes available
onPhysicalCameraAvailable: ACameraManager_PhysicalCameraAvailabilityCallback,
/// Called when a physical camera becomes unavailable
onPhysicalCameraUnavailable: ACameraManager_PhysicalCameraAvailabilityCallback,
/// Reserved for future use, please ensure that all entries are set to NULL
reserved: [4]rawptr,
}
/**
* 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.
*/
ACameraManager_AvailabilityCallback :: #type proc "c" (_context: rawptr, cameraId: cstring)
/**
* Definition of physical camera availability callbacks.
*
* @param context The optional application context provided by user in
* {@link ACameraManager_AvailabilityCallbacks}.
* @param cameraId The ID of the logical multi-camera device whose physical camera status is
* changing. The memory of this argument is owned by camera framework and will
* become invalid immediately after this callback returns.
* @param physicalCameraId The ID of the physical camera device whose status is changing. The
* memory of this argument is owned by camera framework and will become invalid
* immediately after this callback returns.
*/
ACameraManager_PhysicalCameraAvailabilityCallback :: #type proc "c" (_context: rawptr, cameraId: cstring, physicalCameraId: cstring)
/**
* Definition of camera access permission change callback.
*
* <p>Notification that camera access priorities have changed and the camera may
* now be openable. An application that was previously denied camera access due to
* a higher-priority user already using the camera, or that was disconnected from an
* active camera session due to a higher-priority user trying to open the camera,
* should try to open the camera again if it still wants to use it. Note that
* multiple applications may receive this callback at the same time, and only one of
* them will succeed in opening the camera in practice, depending on exact access
* priority levels and timing. This method is useful in cases where multiple
* applications may be in the resumed state at the same time, and the user switches
* focus between them, or if the current camera-using application moves between
* full-screen and Picture-in-Picture (PiP) states. In such cases, the camera
* available/unavailable callbacks will not be invoked, but another application may
* now have higher priority for camera access than the current camera-using
* application.</p>
* @param context The optional application context provided by user in
* {@link ACameraManager_AvailabilityListener}.
*/
ACameraManager_AccessPrioritiesChangedCallback :: #type proc "c" (_context: rawptr)
foreign camerandk {
/**
* 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_create :: proc() -> ^ACameraManager ---
/**
* <p>Delete the {@link ACameraManager} instance and free its resources. </p>
*
* @param manager the {@link ACameraManager} instance to be deleted.
*/
ACameraManager_delete :: proc(manager: ^ACameraManager) ---
/**
* 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>
*
* <p>Note: the returned camera list might be a subset to the output of <a href=
* "https://developer.android.com/reference/android/hardware/camera2/CameraManager.html#getCameraIdList()">
* SDK CameraManager#getCameraIdList API</a> as the NDK API does not support some legacy camera
* hardware.</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>
*/
ACameraManager_getCameraIdList :: proc(manager: ^ACameraManager, cameraIdList: ^^ACameraIdList) -> CameraStatus ---
/**
* Delete a list of camera devices allocated via {@link ACameraManager_getCameraIdList}.
*
* @param cameraIdList the {@link ACameraIdList} to be deleted.
*/
ACameraManager_deleteCameraIdList :: proc(cameraIdList: ^ACameraIdList) ---
/**
* 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>
*/
ACameraManager_registerAvailabilityCallback :: proc(manager: ^ACameraManager, callback: ^ACameraManager_AvailabilityCallbacks) -> CameraStatus ---
/**
* Unregister camera availability callbacks.
*
* <p>Removing a callback that isn't registered has no effect.</p>
*
* <p>This function must not be called with a mutex lock also held by
* the availability callbacks.</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>
*/
ACameraManager_unregisterAvailabilityCallback :: proc(manager: ^ACameraManager, callback: ^ACameraManager_AvailabilityCallbacks) -> CameraStatus ---
/**
* 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>
*/
ACameraManager_getCameraCharacteristics :: proc(manager: ^ACameraManager, cameraId: cstring, characteristics: ^^ACameraMetadata) -> CameraStatus ---
/**
* 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>
*/
ACameraManager_openCamera :: proc(manager: ^ACameraManager, cameraId: cstring, callback: ^ACameraDevice_StateCallbacks, device: ^^ACameraDevice) -> CameraStatus ---
/**
* Register camera extended 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_ExtendedAvailabilityCallbacks} 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_ExtendedAvailabilityCallbacks#onCameraAccessPrioritiesChanged}
* or {ACameraManager_AvailabilityCallbacks#onCameraAvailable} or
* {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.</li></ul>
*/
ACameraManager_registerExtendedAvailabilityCallback :: proc(manager: ^ACameraManager, callback: ^ACameraManager_ExtendedAvailabilityCallbacks) -> CameraStatus ---
/**
* Unregister camera extended availability callbacks.
*
* <p>Removing a callback that isn't registered has no effect.</p>
*
* <p>This function must not be called with a mutex lock also held by
* the extended availability callbacks.</p>
*
* @param manager the {@link ACameraManager} of interest.
* @param callback the {@link ACameraManager_ExtendedAvailabilityCallbacks} to be unregistered.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if callback,
* {ACameraManager_ExtendedAvailabilityCallbacks#onCameraAccessPrioritiesChanged}
* or {ACameraManager_AvailabilityCallbacks#onCameraAvailable} or
* {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.</li></ul>
*/
ACameraManager_unregisterExtendedAvailabilityCallback :: proc(manager: ^ACameraManager, callback: ^ACameraManager_ExtendedAvailabilityCallbacks) -> CameraStatus ---
}
+247
View File
@@ -0,0 +1,247 @@
//+build android
package camerandk
import "../"
foreign import camerandk "system:camera2ndk"
/**
* Possible data types of a metadata entry.
*
* Keep in sync with system/media/include/system/camera_metadata.h
*/
CameraDataType :: enum u8 {
/// Unsigned 8-bit integer (uint8_t)
BYTE = 0,
/// Signed 32-bit integer (int32_t)
INT32 = 1,
/// 32-bit float (float)
FLOAT = 2,
/// Signed 64-bit integer (int64_t)
INT64 = 3,
/// 64-bit float (double)
DOUBLE = 4,
/// A 64-bit fraction (ACameraMetadata_rational)
RATIONAL = 5,
/// Number of type fields
TYPES
}
/**
* 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}).
*/
ACameraMetadata :: struct{}
/**
* Definition of rational data type in {@link ACameraMetadata}.
*/
ACameraMetadata_rational :: struct {
numerator: i32,
denominator: i32,
}
/**
* 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>
*/
ACameraMetadata_entry :: struct {
/**
* 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>
*/
tag: acamera_metadata_tag_t,
/**
* 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>
*/
type: CameraDataType,
/**
* Count of elements (NOT count of bytes) in this metadata entry.
*/
count: u32,
/**
* 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>
*/
data: struct #raw_union {
u8: ^u8,
i32: ^i32,
f: ^f32,
i64: ^i64,
d: ^f64,
r: ^ACameraMetadata_rational,
},
}
/**
* 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>
*/
ACameraMetadata_const_entry :: struct {
/**
* 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>
*/
tag: acamera_metadata_tag_t,
/**
* 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>
*/
type: CameraDataType,
/**
* Count of elements (NOT count of bytes) in this metadata entry.
*/
count: u32,
/**
* 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>
*/
data: struct #raw_union {
u8: ^u8,
i32: ^i32,
f: ^f32,
i64: ^i64,
d: ^f64,
r: ^ACameraMetadata_rational,
},
}
foreign camerandk {
/**
* 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>
*
* Available since API level 24.
*/
ACameraMetadata_getConstEntry :: proc(metadata: ^ACameraMetadata, tag: acamera_metadata_tag_t, entry: ^ACameraMetadata_const_entry) -> CameraStatus ---
/**
* 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>
*
* Available since API level 24.
*/
ACameraMetadata_getAllTags :: proc(metadata: ^ACameraMetadata, numEntries: ^i32, tags: ^[^]acamera_metadata_tag_t) -> CameraStatus ---
/**
* 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.
*
* Available since API level 24.
*/
ACameraMetadata_copy :: proc(src: ^ACameraMetadata) -> ^ACameraMetadata ---
/**
* Free a {@link ACameraMetadata} structure.
*
* @param metadata the {@link ACameraMetadata} to be freed.
*
* Available since API level 24.
*/
ACameraMetadata_free :: proc(metadata: ^ACameraMetadata) ---
/**
* Helper function to check if a camera is logical multi-camera.
*
* <p> Check whether a camera device is a logical multi-camera based on its
* static metadata. If it is, also returns its physical sub camera Ids.</p>
*
* @param staticMetadata the static metadata of the camera being checked.
* @param numPhysicalCameras returns the number of physical cameras.
* @param physicalCameraIds returns the array of physical camera Ids backing this logical
* camera device. Note that this pointer is only valid
* during the lifetime of the staticMetadata object.
*
* @return true if this is a logical multi-camera, false otherwise.
*
* Available since API level 29.
*/
ACameraMetadata_isLogicalMultiCamera :: proc(staticMetadata: ^ACameraMetadata, numPhysicalCameras: ^uint, physicalCameraIds: ^[^]cstring) -> bool ---
/**
* Return a {@link ACameraMetadata} that references the same data as
* <a href="/reference/android/hardware/camera2/CameraMetadata">
* android.hardware.camera2.CameraMetadata</a> from Java API. (e.g., a
* <a href="/reference/android/hardware/camera2/CameraCharacteristics">
* android.hardware.camera2.CameraCharacteristics</a>
* or <a href="/reference/android/hardware/camera2/CaptureResult">
* android.hardware.camera2.CaptureResult</a>).
*
* <p>The returned ACameraMetadata must be freed by the application by {@link ACameraMetadata_free}
* after application is done using it.</p>
*
* <p>The ACameraMetadata maintains a reference count to the underlying data, so
* it can be used independently of the Java object, and it remains valid even if
* the Java metadata is garbage collected.
*
* @param env the JNI environment.
* @param cameraMetadata the source <a href="/reference/android/hardware/camera2/CameraMetadata">
android.hardware.camera2.CameraMetadata </a>from which the
* returned {@link ACameraMetadata} is a view.
*
* @return a valid ACameraMetadata pointer or NULL if cameraMetadata is null or not a valid
* instance of <a href="android/hardware/camera2/CameraMetadata">
* android.hardware.camera2.CameraMetadata</a>.
*
* Available since API level 30.
*/
ACameraMetadata_fromCameraMetadata :: proc(env: ^android.JNIEnv, cameraMetadata: android.jobject) -> ^ACameraMetadata ---
}
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
//+build android
package camerandk
import "../"
ACameraWindowType :: android.ANativeWindow
+539
View File
@@ -0,0 +1,539 @@
//+build android
package camerandk
foreign import camerandk "system:camera2ndk"
/** Container for output targets */
ACameraOutputTargets :: struct{}
/** Container for a single output target */
ACameraOutputTarget :: struct{}
/**
* ACaptureRequest is an opaque type that contains settings and output targets needed to capture
* a single image from camera device.
*
* <p>ACaptureRequest contains the configuration for the capture hardware (sensor, lens, flash),
* the processing pipeline, the control algorithms, and the output buffers. Also
* contains the list of target {@link ANativeWindow}s to send image data to for this
* capture.</p>
*
* <p>ACaptureRequest is created by {@link ACameraDevice_createCaptureRequest}.
*
* <p>ACaptureRequest is given to {@link ACameraCaptureSession_capture} or
* {@link ACameraCaptureSession_setRepeatingRequest} to capture images from a camera.</p>
*
* <p>Each request can specify a different subset of target {@link ANativeWindow}s for the
* camera to send the captured data to. All the {@link ANativeWindow}s used in a request must
* be part of the {@link ANativeWindow} list given to the last call to
* {@link ACameraDevice_createCaptureSession}, when the request is submitted to the
* session.</p>
*
* <p>For example, a request meant for repeating preview might only include the
* {@link ANativeWindow} for the preview SurfaceView or SurfaceTexture, while a
* high-resolution still capture would also include a {@link ANativeWindow} from a
* {@link AImageReader} configured for high-resolution JPEG images.</p>
*
* @see ACameraDevice_createCaptureRequest
* @see ACameraCaptureSession_capture
* @see ACameraCaptureSession_setRepeatingRequest
*/
ACaptureRequest :: struct{}
foreign camerandk {
/**
* Create a ACameraOutputTarget object.
*
* <p>The ACameraOutputTarget is used in {@link ACaptureRequest_addTarget} method to add an output
* {@link ANativeWindow} to ACaptureRequest. Use {@link ACameraOutputTarget_free} to free the object
* and its memory after application no longer needs the {@link ACameraOutputTarget}.</p>
*
* @param window the {@link ANativeWindow} to be associated with the {@link ACameraOutputTarget}
* @param output the output {@link ACameraOutputTarget} will be stored here if the
* method call succeeds.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds. The created ACameraOutputTarget will
* be filled in the output argument.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if window or output is NULL.</li></ul>
*
* @see ACaptureRequest_addTarget
*
* Available since API level 24.
*/
ACameraOutputTarget_create :: proc(window: ^ACameraWindowType, output: ^^ACameraOutputTarget) -> CameraStatus ---
/**
* Free a ACameraOutputTarget object.
*
* @param output the {@link ACameraOutputTarget} to be freed.
*
* @see ACameraOutputTarget_create
*
* Available since API level 24.
*/
ACameraOutputTarget_free :: proc(output: ^ACameraOutputTarget) ---
/**
* Add an {@link ACameraOutputTarget} object to {@link ACaptureRequest}.
*
* @param request the {@link ACaptureRequest} of interest.
* @param output the output {@link ACameraOutputTarget} to be added to capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_addTarget :: proc(request: ^ACaptureRequest, output: ^ACameraOutputTarget) -> CameraStatus ---
/**
* Remove an {@link ACameraOutputTarget} object from {@link ACaptureRequest}.
*
* <p>This method has no effect if the ACameraOutputTarget does not exist in ACaptureRequest.</p>
*
* @param request the {@link ACaptureRequest} of interest.
* @param output the output {@link ACameraOutputTarget} to be removed from capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_removeTarget :: proc(request: ^ACaptureRequest, output: ^ACameraOutputTarget) -> CameraStatus ---
/**
* Get a metadata entry from input {@link ACaptureRequest}.
*
* <p>The memory of the data field in returned entry is managed by camera framework. Do not
* attempt to free it.</p>
*
* @param request the {@link ACaptureRequest} 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 the capture request does not contain an
* entry of input tag value.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_getConstEntry :: proc(request: ^ACaptureRequest, tag: acamera_metadata_tag_t, entry: ^ACameraMetadata_const_entry) -> CameraStatus ---
/*
* List all the entry tags in input {@link ACaptureRequest}.
*
* @param request the {@link ACaptureRequest} of interest.
* @param numEntries number of metadata entries in input {@link ACaptureRequest}
* @param tags the tag values of the metadata entries. Length of tags is returned in numEntries
* argument. The memory is managed by ACaptureRequest itself and must NOT be free/delete
* by application. Calling ACaptureRequest_setEntry_* methods 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.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request, numEntries or tags is NULL.</li>
* <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_getAllTags :: proc(request: ^ACaptureRequest, numTags: ^i32, tags: ^[^]acamera_metadata_tag_t) -> CameraStatus ---
/**
* Set/change a camera capture control entry with unsigned 8 bits data type.
*
* <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
*
* @param request the {@link ACaptureRequest} of interest.
* @param tag the tag value of the camera metadata entry to be set.
* @param count number of elements to be set in data argument
* @param data the entries to be set/change in the capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
* zero while data is NULL, the data type of the tag is not unsigned 8 bits, or
* the tag is not controllable by application.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_setEntry_u8 :: proc(request: ^ACaptureRequest, tag: acamera_metadata_tag_t, count: u32, data: [^]byte) -> CameraStatus ---
/**
* Set/change a camera capture control entry with signed 32 bits data type.
*
* <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
*
* @param request the {@link ACaptureRequest} of interest.
* @param tag the tag value of the camera metadata entry to be set.
* @param count number of elements to be set in data argument
* @param data the entries to be set/change in the capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
* zero while data is NULL, the data type of the tag is not signed 32 bits, or
* the tag is not controllable by application.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_setEntry_i32 :: proc(request: ^ACaptureRequest, tag: acamera_metadata_tag_t, count: u32, data: [^]i32) -> CameraStatus ---
/**
* Set/change a camera capture control entry with float data type.
*
* <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
*
* @param request the {@link ACaptureRequest} of interest.
* @param tag the tag value of the camera metadata entry to be set.
* @param count number of elements to be set in data argument
* @param data the entries to be set/change in the capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
* zero while data is NULL, the data type of the tag is not float, or
* the tag is not controllable by application.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_setEntry_float :: proc(request: ^ACaptureRequest, tag: acamera_metadata_tag_t, count: u32, data: [^]f32) -> CameraStatus ---
/**
* Set/change a camera capture control entry with signed 64 bits data type.
*
* <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
*
* @param request the {@link ACaptureRequest} of interest.
* @param tag the tag value of the camera metadata entry to be set.
* @param count number of elements to be set in data argument
* @param data the entries to be set/change in the capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
* zero while data is NULL, the data type of the tag is not signed 64 bits, or
* the tag is not controllable by application.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_setEntry_i64 :: proc(request: ^ACaptureRequest, tag: acamera_metadata_tag_t, count: u32, data: [^]i64) -> CameraStatus ---
/**
* Set/change a camera capture control entry with double data type.
*
* <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
*
* @param request the {@link ACaptureRequest} of interest.
* @param tag the tag value of the camera metadata entry to be set.
* @param count number of elements to be set in data argument
* @param data the entries to be set/change in the capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
* zero while data is NULL, the data type of the tag is not double, or
* the tag is not controllable by application.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_setEntry_double :: proc(request: ^ACaptureRequest, tag: acamera_metadata_tag_t, count: u32, data: [^]f64) -> CameraStatus ---
/**
* Set/change a camera capture control entry with rational data type.
*
* <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
*
* @param request the {@link ACaptureRequest} of interest.
* @param tag the tag value of the camera metadata entry to be set.
* @param count number of elements to be set in data argument
* @param data the entries to be set/change in the capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
* zero while data is NULL, the data type of the tag is not rational, or
* the tag is not controllable by application.</li></ul>
*
* Available since API level 24.
*/
ACaptureRequest_setEntry_rational :: proc(request: ^ACaptureRequest, tag: acamera_metadata_tag_t, count: u32, data: [^]ACameraMetadata_rational) -> CameraStatus ---
/**
* Free a {@link ACaptureRequest} structure.
*
* @param request the {@link ACaptureRequest} to be freed.
*
* Available since API level 24.
*/
ACaptureRequest_free :: proc(request: ^ACaptureRequest) ---
/**
* Associate an arbitrary user context pointer to the {@link ACaptureRequest}
*
* This method is useful for user to identify the capture request in capture session callbacks.
* The context is NULL for newly created request.
* {@link ACameraOutputTarget_free} will not free the context. Also calling this method twice
* will not cause the previous context be freed.
* Also note that calling this method after the request has been sent to capture session will not
* change the context pointer in the capture callbacks.
*
* @param request the {@link ACaptureRequest} of interest.
* @param context the user context pointer to be associated with this capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL.</li></ul>
*
* Available since API level 28.
*/
ACaptureRequest_setUserContext :: proc(request: ^ACaptureRequest, _context: rawptr) -> CameraStatus ---
/**
* Get the user context pointer of the {@link ACaptureRequest}
*
* This method is useful for user to identify the capture request in capture session callbacks.
* The context is NULL for newly created request.
*
* @param request the {@link ACaptureRequest} of interest.
* @param context the user context pointer of this capture request.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL.</li></ul>
*
* Available since API level 28.
*/
ACaptureRequest_getUserContext :: proc(request: ^ACaptureRequest, _context: ^rawptr) -> CameraStatus ---
/**
* Create a copy of input {@link ACaptureRequest}.
*
* <p>The returned ACaptureRequest must be freed by the application by {@link ACaptureRequest_free}
* after application is done using it.</p>
*
* @param src the input {@link ACaptureRequest} to be copied.
*
* @return a valid ACaptureRequest pointer or NULL if the input request cannot be copied.
*
* Available since API level 28.
*/
ACaptureRequest_copy :: proc(src: ^ACaptureRequest) -> ^ACaptureRequest ---
/**
* Get a metadata entry from input {@link ACaptureRequest} for
* a physical camera backing a logical multi-camera device.
*
* <p>Same as ACaptureRequest_getConstEntry, except that if the key is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* returns the entry set by ACaptureRequest_setEntry_physicalCamera_* class of
* functions on the particular physical camera.</p>
*
* @param request the {@link ACaptureRequest} of interest created by
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param physicalId one of the physical Ids used when request is created with
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param tag the capture request metadata tag in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}
* that is set by ACaptureRequest_setEntry_physicalCamera_* class of functions.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if metadata, physicalId, or entry is NULL,
* physicalId is not one of the Ids used in creating the request, or if the capture
* request is a regular request with no physical Ids at all.</li>
* <li>{@link ACAMERA_ERROR_METADATA_NOT_FOUND} if the capture request does not contain an
* entry of input tag value.</li></ul>
*
* Available since API level 29.
*/
ACaptureRequest_getConstEntry_physicalCamera :: proc(request: ^ACaptureRequest, physicalId: cstring, tag: acamera_metadata_tag_t, entry: ^ACameraMetadata_const_entry) -> CameraStatus ---
/**
* Set/change a camera capture control entry with unsigned 8 bits data type for
* a physical camera backing a logical multi-camera device.
*
* <p>Same as ACaptureRequest_setEntry_u8, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
* If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.</p>
*
* @param request the {@link ACaptureRequest} of interest created by
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param physicalId one of the physical Ids used when request is created with
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param tag one of the capture request metadata tags in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or physicalId is NULL, count is
* larger than zero while data is NULL, the data type of the tag is not unsigned 8 bits,
* the tag is not controllable by application, physicalId is not one of the Ids used
* in creating the request, or if the capture request is a regular request with no
* physical Ids at all.</li></ul>
*
* Available since API level 29.
*/
ACaptureRequest_setEntry_physicalCamera_u8 :: proc(request: ^ACaptureRequest, physicalId: cstring, tag: acamera_metadata_tag_t, count: u32, data: [^]byte) -> CameraStatus ---
/**
* Set/change a camera capture control entry with signed 32 bits data type for
* a physical camera of a logical multi-camera device.
*
* <p>Same as ACaptureRequest_setEntry_i32, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
* If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.</p>
*
* @param request the {@link ACaptureRequest} of interest created by
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param physicalId one of the physical Ids used when request is created with
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param tag one of the capture request metadata tags in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or physicalId is NULL, count is
* larger than zero while data is NULL, the data type of the tag is not signed 32 bits,
* the tag is not controllable by application, physicalId is not one of the Ids used
* in creating the request, or if the capture request is a regular request with no
* physical Ids at all.</li></ul>
*
* Available since API level 29.
*/
ACaptureRequest_setEntry_physicalCamera_i32 :: proc(request: ^ACaptureRequest, physicalId: cstring, tag: acamera_metadata_tag_t, count: u32, data: [^]i32) -> CameraStatus ---
/**
* Set/change a camera capture control entry with float data type for
* a physical camera of a logical multi-camera device.
*
* <p>Same as ACaptureRequest_setEntry_float, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
* If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.</p>
*
* @param request the {@link ACaptureRequest} of interest created by
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param physicalId one of the physical Ids used when request is created with
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param tag one of the capture request metadata tags in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or physicalId is NULL, count is
* larger than zero while data is NULL, the data type of the tag is not float,
* the tag is not controllable by application, physicalId is not one of the Ids used
* in creating the request, or if the capture request is a regular request with no
* physical Ids at all.</li></ul>
*
* Available since API level 29.
*/
ACaptureRequest_setEntry_physicalCamera_float :: proc(request: ^ACaptureRequest, physicalId: cstring, tag: acamera_metadata_tag_t, count: u32, data: [^]f32) -> CameraStatus ---
/**
* Set/change a camera capture control entry with signed 64 bits data type for
* a physical camera of a logical multi-camera device.
*
* <p>Same as ACaptureRequest_setEntry_i64, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
* If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.</p>
*
* @param request the {@link ACaptureRequest} of interest created by
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param physicalId one of the physical Ids used when request is created with
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param tag one of the capture request metadata tags in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or physicalId is NULL, count is
* larger than zero while data is NULL, the data type of the tag is not signed 64 bits,
* the tag is not controllable by application, physicalId is not one of the Ids used
* in creating the request, or if the capture request is a regular request with no
* physical Ids at all.</li></ul>
*
* Available since API level 29.
*/
ACaptureRequest_setEntry_physicalCamera_i64 :: proc(request: ^ACaptureRequest, physicalId: cstring, tag: acamera_metadata_tag_t, count: u32, data: [^]i64) -> CameraStatus ---
/**
* Set/change a camera capture control entry with double data type for
* a physical camera of a logical multi-camera device.
*
* <p>Same as ACaptureRequest_setEntry_double, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
* If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.</p>
*
* @param request the {@link ACaptureRequest} of interest created by
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param physicalId one of the physical Ids used when request is created with
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param tag one of the capture request metadata tags in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or physicalId is NULL, count is
* larger than zero while data is NULL, the data type of the tag is not double,
* the tag is not controllable by application, physicalId is not one of the Ids used
* in creating the request, or if the capture request is a regular request with no
* physical Ids at all.</li></ul>
*
* Available since API level 29.
*/
ACaptureRequest_setEntry_physicalCamera_double :: proc(request: ^ACaptureRequest, physicalId: cstring, tag: acamera_metadata_tag_t, count: u32, data: [^]f64) -> CameraStatus ---
/**
* Set/change a camera capture control entry with rational data type for
* a physical camera of a logical multi-camera device.
*
* <p>Same as ACaptureRequest_setEntry_rational, except that if tag is contained
* in {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, this function
* sets the entry for a particular physical sub-camera backing the logical multi-camera.
* If tag is not contained in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}, the key will be ignored
* by the camera device.</p>
*
* @param request the {@link ACaptureRequest} of interest created by
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param physicalId one of the physical Ids used when request is created with
* {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
* @param tag one of the capture request metadata tags in
* {@link ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS}.
*
* @return <ul>
* <li>{@link ACAMERA_OK} if the method call succeeds.</li>
* <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or physicalId is NULL, count is
* larger than zero while data is NULL, the data type of the tag is not rational,
* the tag is not controllable by application, physicalId is not one of the Ids used
* in creating the request, or if the capture request is a regular request with no
* physical Ids at all.</li></ul>
*
* Available since API level 29.
*/
ACaptureRequest_setEntry_physicalCamera_rational :: proc(request: ^ACaptureRequest, physicalId: cstring, tag: acamera_metadata_tag_t, count: u32, data: [^]ACameraMetadata_rational) -> CameraStatus ---
}