SessionConfiguration

public final class SessionConfiguration
extends Object

java.lang.Object
   ↳ android.hardware.camera2.params.SessionConfiguration


A helper class that aggregates all supported arguments for capture session initialization.

Summary

Constants

int SESSION_HIGH_SPEED

A high speed session type that can only contain instances of OutputConfiguration.

int SESSION_REGULAR

A regular session type containing instances of OutputConfiguration running at regular non high speed FPS ranges and optionally InputConfiguration for reprocessable sessions.

Public constructors

SessionConfiguration(int sessionType, List<OutputConfiguration> outputs, Executor executor, CameraCaptureSession.StateCallback cb)

Create a new SessionConfiguration.

Public methods

Executor getExecutor()

Retrieve the Executor for the capture session.

InputConfiguration getInputConfiguration()

Retrieve the InputConfiguration.

List<OutputConfiguration> getOutputConfigurations()

Retrieve the OutputConfiguration list for the capture session.

CaptureRequest getSessionParameters()

Retrieve the session wide camera parameters (see CaptureRequest).

int getSessionType()

Retrieve the type of the capture session.

CameraCaptureSession.StateCallback getStateCallback()

Retrieve the CameraCaptureSession.StateCallback for the capture session.

void setInputConfiguration(InputConfiguration input)

Sets the InputConfiguration for a reprocessable session.

void setSessionParameters(CaptureRequest params)

Sets the session wide camera parameters (see CaptureRequest).

Inherited methods

Constants

SESSION_HIGH_SPEED

int SESSION_HIGH_SPEED

A high speed session type that can only contain instances of OutputConfiguration. The outputs can run using high speed FPS ranges. Calls to setInputConfiguration(InputConfiguration) are not supported.

Constant Value: 1 (0x00000001)

SESSION_REGULAR

int SESSION_REGULAR

A regular session type containing instances of OutputConfiguration running at regular non high speed FPS ranges and optionally InputConfiguration for reprocessable sessions.

Constant Value: 0 (0x00000000)

Public constructors

SessionConfiguration

SessionConfiguration (int sessionType, 
                List<OutputConfiguration> outputs, 
                Executor executor, 
                CameraCaptureSession.StateCallback cb)

Create a new SessionConfiguration.

Parameters
sessionType int: The session type.

Value is SESSION_REGULAR or SESSION_HIGH_SPEED.

outputs List: A list of output configurations for the capture session.

This value must never be null.

executor Executor: The executor which should be used to invoke the callback. In general it is recommended that camera operations are not done on the main (UI) thread.

This value must never be null.

Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use getMainExecutor(). To dispatch events through a shared thread pool, you can use THREAD_POOL_EXECUTOR.

cb CameraCaptureSession.StateCallback: A state callback interface implementation.

This value must never be null.

Public methods

getExecutor

Executor getExecutor ()

Retrieve the Executor for the capture session.

Returns
Executor The Executor on which the callback will be invoked.

getInputConfiguration

InputConfiguration getInputConfiguration ()

Retrieve the InputConfiguration.

Returns
InputConfiguration The capture session input configuration.

getOutputConfigurations

List<OutputConfiguration> getOutputConfigurations ()

Retrieve the OutputConfiguration list for the capture session.

Returns
List<OutputConfiguration> A list of output configurations for the capture session.

getSessionParameters

CaptureRequest getSessionParameters ()

Retrieve the session wide camera parameters (see CaptureRequest).

Returns
CaptureRequest A capture request that includes the initial values for any available session wide capture keys.

getSessionType

int getSessionType ()

Retrieve the type of the capture session.

Returns
int The capture session type.

Value is SESSION_REGULAR or SESSION_HIGH_SPEED.

getStateCallback

CameraCaptureSession.StateCallback getStateCallback ()

Retrieve the CameraCaptureSession.StateCallback for the capture session.

Returns
CameraCaptureSession.StateCallback A state callback interface implementation.

setInputConfiguration

void setInputConfiguration (InputConfiguration input)

Sets the InputConfiguration for a reprocessable session. Input configuration are not supported for SESSION_HIGH_SPEED.

Parameters
input InputConfiguration: Input configuration.

This value must never be null.

Throws
UnsupportedOperationException In case it is called for SESSION_HIGH_SPEED type session configuration.

setSessionParameters

void setSessionParameters (CaptureRequest params)

Sets the session wide camera parameters (see CaptureRequest). This argument can be set for every supported session type and will be passed to the camera device as part of the capture session initialization. Session parameters are a subset of the available capture request parameters (see getAvailableSessionKeys()) and their application can introduce internal camera delays. To improve camera performance it is suggested to change them sparingly within the lifetime of the capture session and to pass their initial values as part of this method.

Parameters
params CaptureRequest: A capture request that includes the initial values for any available session wide capture keys.