Skip to content
com.iristick.smartglass.core.camera

Interface CaptureSession.Listener

Enclosing class:
CaptureSession

public static interface CaptureSession.Listener

Listener interface for receiving updates about the state of a capture session.

An instance must be provided to the CameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.iristick.smartglass.core.camera.CaptureSession.Listener, android.os.Handler) method to create a capture session.

Events about the progress of specific CaptureRequests are provided through CaptureListeners given to the capture or captureBurst methods.

See Also:
CameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.iristick.smartglass.core.camera.CaptureSession.Listener, android.os.Handler)

Field Summary

Modifier and Type Field and Description
static int ERROR_INVALID_OUTPUTS
An error code that can be reported by onConfigureFailed(CaptureSession, int) indicating that the output surfaces passed through CameraDevice.createCaptureSession() could not be used.
static int ERROR_UNKNOWN
An error code that can be reported by onConfigureFailed(CaptureSession, int) indicating an unknown error has happened.

Method Summary

Modifier and Type Method and Description
void onActive(CaptureSession session)
This method is called when the session actively starts processing capture requests.
void onCaptureQueueEmpty(CaptureSession session)
This method is called when camera device's input capture queue becomes empty, and is ready to accept the next request.
void onClosed(CaptureSession session)
This method is called when the session is closed and all remaining capture requests are done.
void onConfigured(CaptureSession session)
This method is called when the camera device has finished configuring itself, and the session can start processing capture requests.
void onConfigureFailed(CaptureSession session, int error)
This method is called if the session cannot be configured as requested.
void onReady(CaptureSession session)
This method is called every time the session has no more capture requests to process.

Field Detail

ERROR_UNKNOWN

static final int ERROR_UNKNOWN

An error code that can be reported by onConfigureFailed(CaptureSession, int) indicating an unknown error has happened.

See Also:
onConfigureFailed(CaptureSession, int)

ERROR_INVALID_OUTPUTS

static final int ERROR_INVALID_OUTPUTS

An error code that can be reported by onConfigureFailed(CaptureSession, int) indicating that the output surfaces passed through CameraDevice.createCaptureSession() could not be used.

See Also:
onConfigureFailed(CaptureSession, int)

Method Detail

onConfigured

void onConfigured(@NonNull
                  CaptureSession session)

This method is called when the camera device has finished configuring itself, and the session can start processing capture requests.

If the camera device configuration fails, then onConfigureFailed(com.iristick.smartglass.core.camera.CaptureSession, int) will be invoked instead of this callback.

Parameters:
session - The ready-to-use capture session.

onConfigureFailed

void onConfigureFailed(@NonNull
                       CaptureSession session,
                       int error)

This method is called if the session cannot be configured as requested.

This can happen if the set of requested outputs contains unsupported sizes, or too many outputs are requested at once.

The session is considered to be closed, and all methods called on it after this callback is invoked will have no effect.

Parameters:
session - The capture session.
error - The error code, one of the ERROR_* values.
See Also:
ERROR_UNKNOWN

onClosed

void onClosed(@NonNull
              CaptureSession session)

This method is called when the session is closed and all remaining capture requests are done.

A session is closed when 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).

Parameters:
session - The capture session.

onActive

void onActive(@NonNull
              CaptureSession session)

This method is called when the session actively starts processing capture requests.

If the session runs out of capture requests to process and calls onReady(com.iristick.smartglass.core.camera.CaptureSession), then this callback will be invoked again once new requests are submitted for capture.

Parameters:
session - The capture session.

onCaptureQueueEmpty

void onCaptureQueueEmpty(@NonNull
                         CaptureSession session)

This method is called when camera device's input capture queue becomes empty, and is ready to accept the next request.

Pending capture requests exist in one of two queues: the in-flight queue where requests are already in different stages of processing pipeline, and an input queue where requests wait to enter the in-flight queue. The input queue is needed because more requests may be submitted than the current camera device pipeline depth. This callback is fired when the input queue becomes empty, and the camera device may have to fall back to the repeating request if set, or completely skip the next frame from the sensor. This can cause glitches to camera preview output, for example. This callback will only fire after requests queued by capture() or captureBurst(), not after a repeating request or burst enters the in-flight queue. For example, in the common case of a repeating request and a single-shot JPEG capture, this callback only fires when the JPEG request has entered the in-flight queue for capture. This callback is not fired when the session is first created. It is different from onReady(com.iristick.smartglass.core.camera.CaptureSession), which is fired when all requests in both queues have been processed.

Parameters:
session - The capture session.

onReady

void onReady(@NonNull
             CaptureSession session)

This method is called every time the session has no more capture requests to process.

During the creation of a new session, this callback is invoked right after onConfigured(com.iristick.smartglass.core.camera.CaptureSession).

Otherwise, 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.

Parameters:
session - The capture session.