CameraExtensionSession.ExtensionCaptureCallback


public static abstract class CameraExtensionSession.ExtensionCaptureCallback
extends Object

java.lang.Object
   ↳ android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback


A callback object for tracking the progress of a CaptureRequest submitted to the camera device.

This callback is invoked when a request triggers a capture to start, and when the device-specific Extension post processing begins. In case of an error capturing an image, the error method is triggered instead of the completion method.

Summary

Public constructors

ExtensionCaptureCallback()

Public methods

void onCaptureFailed(CameraExtensionSession session, CaptureRequest request, int failure)

This method is called instead of onCaptureProcessStarted(CameraExtensionSession, CaptureRequest) when the camera device failed to produce the required input for the device-specific extension.

void onCaptureFailed(CameraExtensionSession session, CaptureRequest request)

This method is called instead of onCaptureProcessStarted(CameraExtensionSession, CaptureRequest) when the camera device failed to produce the required input for the device-specific extension.

void onCaptureProcessProgressed(CameraExtensionSession session, CaptureRequest request, int progress)

This method is called when image capture processing is ongoing between onCaptureProcessStarted(CameraExtensionSession, CaptureRequest) and the processed still capture frame returning to the client surface.

void onCaptureProcessStarted(CameraExtensionSession session, CaptureRequest request)

This method is called when an image (or images in case of multi-frame capture) is captured and device-specific extension processing is triggered.

void onCaptureResultAvailable(CameraExtensionSession session, CaptureRequest request, TotalCaptureResult result)

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

void onCaptureSequenceAborted(CameraExtensionSession session, int sequenceId)

This method is called when a capture sequence aborts.

void onCaptureSequenceCompleted(CameraExtensionSession session, int sequenceId)

This method is called independently of the others in ExtensionCaptureCallback, when a capture sequence finishes.

void onCaptureStarted(CameraExtensionSession session, CaptureRequest request, long timestamp)

This method is called when the camera device has started capturing the initial input image of the device-specific extension post-process request.

Inherited methods

Public constructors

ExtensionCaptureCallback

public ExtensionCaptureCallback ()

Public methods

onCaptureFailed

Added in API level 35
public void onCaptureFailed (CameraExtensionSession session, 
                CaptureRequest request, 
                int failure)

This method is called instead of onCaptureProcessStarted(CameraExtensionSession, CaptureRequest) when the camera device failed to produce the required input for the device-specific extension. The cause could be a failed camera capture request, a failed capture result or dropped camera frame. More information about the reason is included in the 'failure' argument.

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

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.

failure int: The capture failure reason Value is CaptureFailure.REASON_ERROR, or CaptureFailure.REASON_FLUSHED

onCaptureFailed

Added in API level 31
public void onCaptureFailed (CameraExtensionSession session, 
                CaptureRequest request)

This method is called instead of onCaptureProcessStarted(CameraExtensionSession, CaptureRequest) when the camera device failed to produce the required input for the device-specific extension. The cause could be a failed camera capture request, a failed capture result or dropped camera frame.

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

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.

onCaptureProcessProgressed

Added in API level 34
public void onCaptureProcessProgressed (CameraExtensionSession session, 
                CaptureRequest request, 
                int progress)

This method is called when image capture processing is ongoing between onCaptureProcessStarted(CameraExtensionSession, CaptureRequest) and the processed still capture frame returning to the client surface.

The value included in the arguments provides clients with an estimate of the post-processing progress which could take significantly more time relative to the rest of the CameraExtensionSession.capture(CaptureRequest, Executor, ExtensionCaptureCallback) sequence.

The callback will be triggered only by extensions that return true from calls CameraExtensionCharacteristics.isCaptureProcessProgressAvailable.

If support for this callback is present, then clients will be notified at least once with progress value 100.

The callback will be triggered only for still capture requests CameraExtensionSession.capture(CaptureRequest, Executor, ExtensionCaptureCallback) and is not supported for repeating requests CameraExtensionSession.setRepeatingRequest(CaptureRequest, Executor, ExtensionCaptureCallback).

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: The session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.

progress int: Value between 0 and 100 (inclusive) indicating the current post-processing progress Value is between 0 and 100 inclusive

onCaptureProcessStarted

Added in API level 31
public void onCaptureProcessStarted (CameraExtensionSession session, 
                CaptureRequest request)

This method is called when an image (or images in case of multi-frame capture) is captured and device-specific extension processing is triggered.

Each request will generate at most 1 onCaptureProcessStarted(CameraExtensionSession, CaptureRequest).

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

request CaptureRequest: The request that was given to the CameraExtensionSession This value cannot be null.

onCaptureResultAvailable

Added in API level 33
public void onCaptureResultAvailable (CameraExtensionSession session, 
                CaptureRequest request, 
                TotalCaptureResult result)

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

This callback will only be called in case CameraExtensionCharacteristics.getAvailableCaptureResultKeys returns a valid non-empty list.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: The session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.

result TotalCaptureResult: The total output metadata from the capture, which only includes the capture result keys advertised as supported in CameraExtensionCharacteristics.getAvailableCaptureResultKeys. This value cannot be null.

onCaptureSequenceAborted

Added in API level 31
public void onCaptureSequenceAborted (CameraExtensionSession session, 
                int sequenceId)

This method is called when a capture sequence aborts.

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 CameraExtensionSession.stopRepeating. When such an event happens, onCaptureProcessStarted(CameraExtensionSession, CaptureRequest) will not be called.

The default implementation does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

sequenceId int: A sequence ID returned by the CameraExtensionSession.capture(CaptureRequest, Executor, ExtensionCaptureCallback) family of functions.

onCaptureSequenceCompleted

Added in API level 31
public void onCaptureSequenceCompleted (CameraExtensionSession session, 
                int sequenceId)

This method is called independently of the others in ExtensionCaptureCallback, when a capture sequence finishes.

In total, there will be at least one onCaptureProcessStarted(CameraExtensionSession, CaptureRequest)/onCaptureFailed(CameraExtensionSession, CaptureRequest) invocation before this callback is triggered. If the capture sequence is aborted before any requests have begun processing, onCaptureSequenceAborted(CameraExtensionSession, int) is invoked instead.

The default implementation does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

sequenceId int: A sequence ID returned by the CameraExtensionSession.capture(CaptureRequest, Executor, ExtensionCaptureCallback) family of functions.

onCaptureStarted

Added in API level 31
public void onCaptureStarted (CameraExtensionSession session, 
                CaptureRequest request, 
                long timestamp)

This method is called when the camera device has started capturing the initial input image of the device-specific extension post-process request.

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.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback.onConfigured(CameraExtensionSession) This value cannot be null.

request CaptureRequest: the request for the capture that just begun This value cannot be null.

timestamp long: the timestamp at start of capture for repeating request or the timestamp at start of capture of the first frame in a multi-frame capture.