ACameraCaptureSession_captureCallbacks

#include <NdkCameraCaptureSession.h>

ACaptureCaptureSession_captureCallbacks structure used in ACameraCaptureSession_capture and ACameraCaptureSession_setRepeatingRequest.

Summary

Public attributes

context
void *
optional application context.
onCaptureBufferLost
This callback is called if a single buffer for a capture could not be sent to its destination ANativeWindow.
onCaptureCompleted
This callback is called when an image capture has fully completed and all the result metadata is available.
onCaptureFailed
This callback is called instead of onCaptureCompleted when the camera device failed to produce a capture result for the request.
onCaptureProgressed
This callback is called when an image capture makes partial forward progress; some (but not all) results from an image capture are available.
onCaptureSequenceAborted
This callback is called independently of the others in ACameraCaptureSession_captureCallbacks, when a capture sequence aborts before any capture result or capture failure for it have been returned via this ACameraCaptureSession_captureCallbacks.
onCaptureSequenceCompleted
This callback is called independently of the others in ACameraCaptureSession_captureCallbacks, when a capture sequence finishes and all capture result or capture failure for it have been returned via this ACameraCaptureSession_captureCallbacks.
onCaptureStarted
This callback is called when the camera device has started capturing the output image for the request, at the beginning of image exposure.

Public attributes

context

void * ACameraCaptureSession_captureCallbacks::context

optional application context.

onCaptureBufferLost

ACameraCaptureSession_captureCallback_bufferLost ACameraCaptureSession_captureCallbacks::onCaptureBufferLost

This callback is called if a single buffer for a capture could not be sent to its destination ANativeWindow.

If the whole capture failed, then 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 ACameraCaptureFailure#wasImageCaptured returning true, along with one or more calls to onCaptureBufferLost for the failed outputs.

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 ACameraDevice_createCaptureSession

onCaptureCompleted

ACameraCaptureSession_captureCallback_result ACameraCaptureSession_captureCallbacks::onCaptureCompleted

This callback is called when an image capture has fully completed and all the result metadata is available.

This callback will always fire after the last onCaptureProgressed; in other words, no more partial results will be delivered once the completed result is available.

For performance-intensive use-cases where latency is a factor, consider using onCaptureProgressed instead.

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.

onCaptureFailed

ACameraCaptureSession_captureCallback_failed ACameraCaptureSession_captureCallbacks::onCaptureFailed

This callback is called instead of onCaptureCompleted when the camera device failed to produce a capture result for the request.

Other requests are unaffected, and some or all image buffers from the capture may have been pushed to their respective output streams.

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.

See also: ACameraCaptureFailure

onCaptureProgressed

ACameraCaptureSession_captureCallback_result ACameraCaptureSession_captureCallbacks::onCaptureProgressed

This callback is called when an image capture makes partial forward progress; some (but not all) results from an image capture are available.

The result provided here will contain some subset of the fields of a full result. Multiple onCaptureProgressed calls may happen per capture; a given result field will only be present in one partial capture at most. The final 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).

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.

For a particular request, onCaptureProgressed may happen before or after onCaptureStarted.

Each request will generate at least 1 partial results, and at most ACAMERA_REQUEST_PARTIAL_RESULT_COUNT partial results.

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.

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.

onCaptureSequenceAborted

ACameraCaptureSession_captureCallback_sequenceAbort ACameraCaptureSession_captureCallbacks::onCaptureSequenceAborted

This callback is called independently of the others in ACameraCaptureSession_captureCallbacks, when a capture sequence aborts before any capture result or capture failure for it have been returned via this ACameraCaptureSession_captureCallbacks.

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 ACameraCaptureSession_stopRepeating or ACameraCaptureSession_abortCaptures. When such an event happens, onCaptureSequenceCompleted will not be called.

onCaptureSequenceCompleted

ACameraCaptureSession_captureCallback_sequenceEnd ACameraCaptureSession_captureCallbacks::onCaptureSequenceCompleted

This callback is called independently of the others in ACameraCaptureSession_captureCallbacks, when a capture sequence finishes and all capture result or capture failure for it have been returned via this ACameraCaptureSession_captureCallbacks.

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, onCaptureSequenceAborted is invoked instead.

onCaptureStarted

ACameraCaptureSession_captureCallback_start ACameraCaptureSession_captureCallbacks::onCaptureStarted

This callback is called when the camera device has started capturing the output image for the request, at the beginning of image exposure.

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.

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 ACAMERA_SENSOR_TIMESTAMP of the ACameraMetadata in onCaptureCompleted callback, and in the buffers sent to each output ANativeWindow. These buffer timestamps are accessible through, for example, AImage_getTimestamp or android.graphics.SurfaceTexture::getTimestamp().

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.