public interface

SessionProcessor.CaptureCallback

 androidx.camera.core.impl.SessionProcessor.CaptureCallback

Overview

Callback for SessionProcessor.startRepeating(SessionProcessor.CaptureCallback) and SessionProcessor.startCapture(SessionProcessor.CaptureCallback).

Summary

Methods
public voidonCaptureCompleted(long timestamp, int captureSequenceId, java.util.Map<CaptureResult.Key, java.lang.Object> result)

Capture result callback that needs to be called when the process capture results are ready as part of frame post-processing.

public voidonCaptureFailed(int captureSequenceId)

This method is called instead of SessionProcessor.CaptureCallback.onCaptureProcessStarted(int) when the camera device failed to produce the required input image.

public voidonCaptureProcessStarted(int captureSequenceId)

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

public voidonCaptureSequenceAborted(int captureSequenceId)

This method is called when a capture sequence aborts.

public voidonCaptureSequenceCompleted(int captureSequenceId)

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

public voidonCaptureStarted(int captureSequenceId, long timestamp)

This method is called when the camera has started capturing the initial input image.

Methods

public void onCaptureStarted(int captureSequenceId, long timestamp)

This method is called when the camera has started capturing the initial input image. For a multi-frame capture, the method is called when the onCaptureStarted of first frame is called and its timestamp is directly forwarded to timestamp parameter of this method.

Parameters:

captureSequenceId: id of the current capture sequence
timestamp: 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, in nanoseconds.

public void onCaptureProcessStarted(int captureSequenceId)

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

Parameters:

captureSequenceId: id of the current capture sequence

public void onCaptureFailed(int captureSequenceId)

This method is called instead of SessionProcessor.CaptureCallback.onCaptureProcessStarted(int) when the camera device failed to produce the required input image. The cause could be a failed camera capture request, a failed capture result or dropped camera frame.

Parameters:

captureSequenceId: id of the current capture sequence

public void onCaptureSequenceCompleted(int captureSequenceId)

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

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

Parameters:

captureSequenceId: id of the current capture sequence

public void onCaptureSequenceAborted(int captureSequenceId)

This method is called when a capture sequence aborts.

Parameters:

captureSequenceId: id of the current capture sequence

public void onCaptureCompleted(long timestamp, int captureSequenceId, java.util.Map<CaptureResult.Key, java.lang.Object> result)

Capture result callback that needs to be called when the process capture results are ready as part of frame post-processing. This callback will fire after SessionProcessor.CaptureCallback.onCaptureStarted(int, long), SessionProcessor.CaptureCallback.onCaptureProcessStarted(int) and before SessionProcessor.CaptureCallback.onCaptureSequenceCompleted(int). The callback is not expected to fire in case of capture failure SessionProcessor.CaptureCallback.onCaptureFailed(int) or capture abort SessionProcessor.CaptureCallback.onCaptureSequenceAborted(int).

Parameters:

timestamp: The timestamp at start of capture. The same timestamp value passed to SessionProcessor.CaptureCallback.onCaptureStarted(int, long).
captureSequenceId: the capture id of the request that generated the capture results. This is the return value of either SessionProcessor.startRepeating(SessionProcessor.CaptureCallback) or SessionProcessor.startCapture(SessionProcessor.CaptureCallback).
result: Map containing the supported capture results. Do note that if results 'android.jpeg.quality' and 'android.jpeg.orientation' are present in the process capture input results, then the values must also be passed as part of this callback. Both Camera2 and CameraX guarantee that those two settings and results are always supported and applied by the corresponding framework.