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

Class CaptureRequest.Builder

Enclosing class:
CaptureRequest

public abstract static class CaptureRequest.Builder
extends Object

This class allows to construct immutable capture requests.

To obtain a builder instance, use the CameraDevice.createCaptureRequest(int) method, which initializes the request fields to one of the templates defined in CameraDevice.

Method Summary

Modifier and Type Method and Description
abstract void addTarget(Surface outputTarget)
Adds a surface to the list of targets for this request.
abstract CaptureRequest build()
Builds a request using the current target surfaces and settings.
abstract <T> T get(CaptureRequest.Key<T> key)
Gets a capture request field value.
abstract void removeTarget(Surface outputTarget)
Removes a surface from the list of targets for this request.
abstract <T> void set(CaptureRequest.Key<T> key, T value)
Sets a capture request field value.
abstract void setTag(Object tag)
Sets the tag for this request.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

addTarget

public abstract void addTarget(@NonNull
                               Surface outputTarget)

Adds a surface to the list of targets for this request.

Adding a target more than once has no effect.

Parameters:
outputTarget - Surface to use as an output target for this request.

removeTarget

public abstract void removeTarget(@NonNull
                                  Surface outputTarget)

Removes a surface from the list of targets for this request.

Removing a target that is not currently added has no effect.

Parameters:
outputTarget - Surface to remove from the output target of this request.

get

@CheckResult
 @Nullable
public abstract <T> T get(@NonNull
                                                  CaptureRequest.Key<T> key)
Gets a capture request field value.
Type Parameters:
T - The key type.
Parameters:
key - The field to read (keys are defined as constants in CaptureRequest.
Returns:
The value of the key, or null if the field is not set.

set

public abstract <T> void set(@NonNull
                             CaptureRequest.Key<T> key,
                             @Nullable
                             T value)
Sets a capture request field value.
Type Parameters:
T - The key type.
Parameters:
key - The field to set (keys are defined as constants in CaptureRequest.
value - The value to set the field to.

setTag

public abstract void setTag(@Nullable
                            Object tag)

Sets the tag for this request.

Tags allow easy identification of a capture request. They are not used by the camera device.

Parameters:
tag - An arbitrary object to store with this request. This value may be null.

build

@CheckResult
 @NonNull
public abstract CaptureRequest build()

Builds a request using the current target surfaces and settings.

Note that, although it is possible to create a CaptureRequest with no target surfaces, passing such a request into CaptureSession.capture, CaptureSession.captureBurst, or CaptureSession.setRepeatingRequest will cause that method to throw an IllegalArgumentException.

Returns:
A new capture request instance, ready for submission to the camera device.