RecommendedStreamConfigurationMap


public final class RecommendedStreamConfigurationMap
extends Object

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


Immutable class to store the recommended stream configurations to set up Surfaces for creating a capture session with CameraDevice.createCaptureSession(SessionConfiguration).

The recommended list does not replace or deprecate the exhaustive complete list found in StreamConfigurationMap. It is a suggestion about available power and performance efficient stream configurations for a specific use case. Per definition it is only a subset of StreamConfigurationMap and can be considered by developers for optimization purposes.

This also duplicates the minimum frame durations and stall durations from the StreamConfigurationMap for each format/size combination that can be used to calculate effective frame rate when submitting multiple captures.

An instance of this object is available by invoking CameraCharacteristics#getRecommendedStreamConfigurationMap and passing a respective usecase id. For more information about supported use case constants see USECASE_PREVIEW.

CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(cameraId);
 RecommendedStreamConfigurationMap configs = characteristics.getRecommendedStreamConfigurationMap(
         RecommendedStreamConfigurationMap.USECASE_PREVIEW);
 

Summary

Constants

int USECASE_10BIT_OUTPUT

If supported, the recommended 10-bit output stream configurations must include a subset of the advertised ImageFormat.YCBCR_P010 and ImageFormat.PRIVATE outputs that are optimized for power and performance when registered along with a supported 10-bit dynamic range profile.

int USECASE_LOW_LATENCY_SNAPSHOT

The recommended stream configuration map for use case low latency snapshot must contain subset of configurations with end-to-end latency that does not exceed 200 ms.

int USECASE_PREVIEW

The recommended stream configuration map for use case preview must contain a subset of efficient, non-stalling configurations that must include both ImageFormat.PRIVATE and ImageFormat.YUV_420_888 output formats.

int USECASE_RAW

In case the device supports CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_RAW, the recommended stream configuration map for use case RAW must contain a subset of efficient configurations that include the ImageFormat.RAW_SENSOR and other RAW output formats.

int USECASE_RECORD

The recommended stream configuration map for recording must contain a subset of efficient video configurations that include ImageFormat.PRIVATE output format for at least all supported profiles.

int USECASE_SNAPSHOT

The recommended stream configuration map for use case snapshot must contain a subset of efficient still capture configurations that must include ImageFormat.JPEG output format and at least one configuration with size approximately equal to the sensor pixel array size CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE.

int USECASE_VIDEO_SNAPSHOT

The recommended stream configuration map for use case video snapshot must only contain a subset of efficient liveshot configurations that include ImageFormat.JPEG output format.

int USECASE_ZSL

In case the device supports CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING and/or CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING, the recommended stream configuration map for use case ZSL must contain a subset of efficient configurations that include the suggested input and output format mappings.

Public methods

Set<Size> getHighResolutionOutputSizes(int format)

Get a list of supported high resolution sizes, which cannot operate at full BURST_CAPTURE rate.

Set<Range<Integer>> getHighSpeedVideoFpsRanges()

Get a list of supported high speed video recording FPS ranges.

Set<Range<Integer>> getHighSpeedVideoFpsRangesFor(Size size)

Get the frame per second ranges (fpsMin, fpsMax) for input high speed video size.

Set<Size> getHighSpeedVideoSizes()

Get a list of supported high speed video recording sizes.

Set<Size> getHighSpeedVideoSizesFor(Range<Integer> fpsRange)

Get the supported video sizes for an input high speed FPS range.

Set<Integer> getInputFormats()

Get the image format input formats in this stream configuration.

Set<Size> getInputSizes(int format)

Get the supported input sizes for this input format.

Set<Integer> getOutputFormats()

Get the image format output formats in this stream configuration.

<T> long getOutputMinFrameDuration(Class<T> klass, Size size)

Get the minimum frame duration for the class/size combination (in nanoseconds).

long getOutputMinFrameDuration(int format, Size size)

Get the minimum frame duration for the format/size combination (in nanoseconds).

Set<Size> getOutputSizes(int format)

Get a list of sizes compatible with the requested image format.

<T> Set<Size> getOutputSizes(Class<T> klass)

Get a list of sizes compatible with klass to use as an output.

long getOutputStallDuration(int format, Size size)

Get the stall duration for the format/size combination (in nanoseconds).

<T> long getOutputStallDuration(Class<T> klass, Size size)

Get the stall duration for the class/size combination (in nanoseconds).

int getRecommendedUseCase()

Get the use case value for the recommended stream configurations.

Set<Integer> getValidOutputFormatsForInput(int inputFormat)

Get the image format output formats for a reprocessing input format.

boolean isOutputSupportedFor(Surface surface)

Determine whether or not the surface in its current state is suitable to be included in a session as an output.

boolean isOutputSupportedFor(int format)

Determine whether or not output surfaces with a particular user-defined format can be passed createCaptureSession.

Inherited methods

Constants

USECASE_10BIT_OUTPUT

Added in API level 33
public static final int USECASE_10BIT_OUTPUT

If supported, the recommended 10-bit output stream configurations must include a subset of the advertised ImageFormat.YCBCR_P010 and ImageFormat.PRIVATE outputs that are optimized for power and performance when registered along with a supported 10-bit dynamic range profile. for details.

Constant Value: 8 (0x00000008)

USECASE_LOW_LATENCY_SNAPSHOT

Added in API level 29
public static final int USECASE_LOW_LATENCY_SNAPSHOT

The recommended stream configuration map for use case low latency snapshot must contain subset of configurations with end-to-end latency that does not exceed 200 ms. under standard operating conditions (reasonable light levels, not loaded system). The expected output format will be primarily ImageFormat.JPEG however other image formats can be present as well. Even if available for the camera device, high speed and input configurations will be absent. This suggested configuration map may be absent on some devices that can not support any low latency requests.

Constant Value: 6 (0x00000006)

USECASE_PREVIEW

Added in API level 29
public static final int USECASE_PREVIEW

The recommended stream configuration map for use case preview must contain a subset of efficient, non-stalling configurations that must include both ImageFormat.PRIVATE and ImageFormat.YUV_420_888 output formats. Even if available for the camera device, high speed or input configurations will be absent.

Constant Value: 0 (0x00000000)

USECASE_RAW

Added in API level 29
public static final int USECASE_RAW

In case the device supports CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_RAW, the recommended stream configuration map for use case RAW must contain a subset of efficient configurations that include the ImageFormat.RAW_SENSOR and other RAW output formats. Even if available for the camera device, high speed and input configurations will be absent.

Constant Value: 5 (0x00000005)

USECASE_RECORD

Added in API level 29
public static final int USECASE_RECORD

The recommended stream configuration map for recording must contain a subset of efficient video configurations that include ImageFormat.PRIVATE output format for at least all supported profiles. High speed configurations if supported will be available as well. Even if available for the camera device, input configurations will be absent.

Constant Value: 1 (0x00000001)

USECASE_SNAPSHOT

Added in API level 29
public static final int USECASE_SNAPSHOT

The recommended stream configuration map for use case snapshot must contain a subset of efficient still capture configurations that must include ImageFormat.JPEG output format and at least one configuration with size approximately equal to the sensor pixel array size CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE. Even if available for the camera device, high speed or input configurations will be absent.

Constant Value: 3 (0x00000003)

USECASE_VIDEO_SNAPSHOT

Added in API level 29
public static final int USECASE_VIDEO_SNAPSHOT

The recommended stream configuration map for use case video snapshot must only contain a subset of efficient liveshot configurations that include ImageFormat.JPEG output format. The sizes will match at least the maximum resolution of usecase record and will not cause any preview glitches. Even if available for the camera device, high speed or input configurations will be absent.

Constant Value: 2 (0x00000002)

USECASE_ZSL

Added in API level 29
public static final int USECASE_ZSL

In case the device supports CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING and/or CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING, the recommended stream configuration map for use case ZSL must contain a subset of efficient configurations that include the suggested input and output format mappings. Even if available for the camera device, high speed configurations will be absent.

Constant Value: 4 (0x00000004)

Public methods

getHighResolutionOutputSizes

Added in API level 29
public Set<Size> getHighResolutionOutputSizes (int format)

Get a list of supported high resolution sizes, which cannot operate at full BURST_CAPTURE rate.

For further information refer to StreamConfigurationMap#getHighResolutionOutputSizes.

Parameters
format int: Value is ImageFormat.UNKNOWN, PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGB_888, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, android.graphics.ImageFormat.Y16, ImageFormat.YCBCR_P010, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, android.graphics.ImageFormat.RAW_DEPTH, android.graphics.ImageFormat.RAW_DEPTH10, ImageFormat.PRIVATE, ImageFormat.HEIC, or ImageFormat.JPEG_R

Returns
Set<Size> a non-modifiable set of supported slower high-resolution sizes, or null if the BURST_CAPTURE capability is not supported

getHighSpeedVideoFpsRanges

Added in API level 29
public Set<Range<Integer>> getHighSpeedVideoFpsRanges ()

Get a list of supported high speed video recording FPS ranges.

For further information refer to StreamConfigurationMap#getHighSpeedVideoFpsRanges.

Returns
Set<Range<Integer>> a non-modifiable set of supported high speed video recording FPS ranges The upper bound of returned ranges is guaranteed to be larger or equal to 120. This value may be null.

getHighSpeedVideoFpsRangesFor

Added in API level 29
public Set<Range<Integer>> getHighSpeedVideoFpsRangesFor (Size size)

Get the frame per second ranges (fpsMin, fpsMax) for input high speed video size.

For further information refer to StreamConfigurationMap#getHighSpeedVideoFpsRangesFor.

Parameters
size Size: one of the sizes returned by getHighSpeedVideoSizes() This value cannot be null.

Returns
Set<Range<Integer>> a non-modifiable set of supported high speed video recording FPS ranges The upper bound of returned ranges is guaranteed to be greater than or equal to 120. This value may be null.

Throws
IllegalArgumentException if input size does not exist in the return value of getHighSpeedVideoSizes

getHighSpeedVideoSizes

Added in API level 29
public Set<Size> getHighSpeedVideoSizes ()

Get a list of supported high speed video recording sizes.

For more information refer to StreamConfigurationMap#getHighSpeedVideoSizes.

Returns
Set<Size> a non-modifiable set of supported high speed video recording sizes This value may be null.

getHighSpeedVideoSizesFor

Added in API level 29
public Set<Size> getHighSpeedVideoSizesFor (Range<Integer> fpsRange)

Get the supported video sizes for an input high speed FPS range.

For further information refer to StreamConfigurationMap#getHighSpeedVideoSizesFor.

Parameters
fpsRange Range: one of the FPS ranges returned by getHighSpeedVideoFpsRanges() This value cannot be null.

Returns
Set<Size> A non-modifiable set of video sizes to create high speed capture sessions for high speed streaming use cases. This value may be null.

Throws
IllegalArgumentException if input FPS range does not exist in the return value of getHighSpeedVideoFpsRanges

getInputFormats

Added in API level 29
public Set<Integer> getInputFormats ()

Get the image format input formats in this stream configuration.

All image formats returned by this function will be defined in either ImageFormat or in PixelFormat (and there is no possibility of collision).

Returns
Set<Integer> a non-modifiable set of Integer formats This value may be null.

getInputSizes

Added in API level 29
public Set<Size> getInputSizes (int format)

Get the supported input sizes for this input format.

The format must have come from getInputFormats(); otherwise null is returned.

Parameters
format int: a format from getInputFormats() Value is ImageFormat.UNKNOWN, PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGB_888, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, android.graphics.ImageFormat.Y16, ImageFormat.YCBCR_P010, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, android.graphics.ImageFormat.RAW_DEPTH, android.graphics.ImageFormat.RAW_DEPTH10, ImageFormat.PRIVATE, ImageFormat.HEIC, or ImageFormat.JPEG_R

Returns
Set<Size> a non-modifiable set of sizes, or null if the format was not available.

getOutputFormats

Added in API level 29
public Set<Integer> getOutputFormats ()

Get the image format output formats in this stream configuration.

For more information refer to StreamConfigurationMap#getOutputFormats.

Returns
Set<Integer> a non-modifiable set of Integer formats This value cannot be null.

getOutputMinFrameDuration

Added in API level 29
public long getOutputMinFrameDuration (Class<T> klass, 
                Size size)

Get the minimum frame duration for the class/size combination (in nanoseconds).

For more information refer to StreamConfigurationMap#getOutputMinFrameDuration(Class, Size).

Parameters
klass Class: a class which has a non-empty array returned by getOutputSizes(java.lang.Class) This value cannot be null.

size Size: an output-compatible size This value cannot be null.

Returns
long a minimum frame duration > 0 in nanoseconds, or 0 if the minimum frame duration is not available. Value is 0 or greater

Throws
IllegalArgumentException if klass or size was not supported

getOutputMinFrameDuration

Added in API level 29
public long getOutputMinFrameDuration (int format, 
                Size size)

Get the minimum frame duration for the format/size combination (in nanoseconds).

For further information refer to StreamConfigurationMap#getOutputMinFrameDuration.

Parameters
format int: an image format from ImageFormat or PixelFormat Value is ImageFormat.UNKNOWN, PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGB_888, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, android.graphics.ImageFormat.Y16, ImageFormat.YCBCR_P010, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, android.graphics.ImageFormat.RAW_DEPTH, android.graphics.ImageFormat.RAW_DEPTH10, ImageFormat.PRIVATE, ImageFormat.HEIC, or ImageFormat.JPEG_R

size Size: an output-compatible size This value cannot be null.

Returns
long a minimum frame duration > 0 in nanoseconds, or 0 if the minimum frame duration is not available. Value is 0 or greater

Throws
IllegalArgumentException if format or size was not supported

getOutputSizes

Added in API level 29
public Set<Size> getOutputSizes (int format)

Get a list of sizes compatible with the requested image format.

For more information refer to StreamConfigurationMap#getOutputSizes.

Parameters
format int: an image format from ImageFormat or PixelFormat Value is ImageFormat.UNKNOWN, PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGB_888, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, android.graphics.ImageFormat.Y16, ImageFormat.YCBCR_P010, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, android.graphics.ImageFormat.RAW_DEPTH, android.graphics.ImageFormat.RAW_DEPTH10, ImageFormat.PRIVATE, ImageFormat.HEIC, or ImageFormat.JPEG_R

Returns
Set<Size> a non-modifiable set of supported sizes, or null if the format is not a supported output

getOutputSizes

Added in API level 29
public Set<Size> getOutputSizes (Class<T> klass)

Get a list of sizes compatible with klass to use as an output.

For further information refer to StreamConfigurationMap#getOutputSizes(Class).

Parameters
klass Class: a Class object reference This value cannot be null.

Returns
Set<Size> a non-modifiable set of supported sizes for ImageFormat#PRIVATE format, or null if the klass is not a supported output.

getOutputStallDuration

Added in API level 29
public long getOutputStallDuration (int format, 
                Size size)

Get the stall duration for the format/size combination (in nanoseconds).

For further information refer to StreamConfigurationMap#getOutputStallDuration.

Parameters
format int: an image format from ImageFormat or PixelFormat Value is ImageFormat.UNKNOWN, PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGB_888, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, android.graphics.ImageFormat.Y16, ImageFormat.YCBCR_P010, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, android.graphics.ImageFormat.RAW_DEPTH, android.graphics.ImageFormat.RAW_DEPTH10, ImageFormat.PRIVATE, ImageFormat.HEIC, or ImageFormat.JPEG_R

size Size: an output-compatible size This value cannot be null.

Returns
long a stall duration >= 0 in nanoseconds Value is 0 or greater

Throws
IllegalArgumentException if format or size was not supported

getOutputStallDuration

Added in API level 29
public long getOutputStallDuration (Class<T> klass, 
                Size size)

Get the stall duration for the class/size combination (in nanoseconds).

For more information refer to StreamConfigurationMap#getOutputStallDuration(Class, Size).

Parameters
klass Class: a class which has a non-empty array returned by getOutputSizes(java.lang.Class). This value cannot be null.

size Size: an output-compatible size This value cannot be null.

Returns
long a minimum frame duration > 0 in nanoseconds, or 0 if the stall duration is not available. Value is 0 or greater

Throws
IllegalArgumentException if klass or size was not supported

getRecommendedUseCase

Added in API level 29
public int getRecommendedUseCase ()

Get the use case value for the recommended stream configurations.

Returns
int Use case id. Value is USECASE_PREVIEW, USECASE_RECORD, USECASE_VIDEO_SNAPSHOT, USECASE_SNAPSHOT, USECASE_ZSL, USECASE_RAW, USECASE_LOW_LATENCY_SNAPSHOT, or USECASE_10BIT_OUTPUT

getValidOutputFormatsForInput

Added in API level 29
public Set<Integer> getValidOutputFormatsForInput (int inputFormat)

Get the image format output formats for a reprocessing input format.

For more information refer to StreamConfigurationMap#getValidOutputFormatsForInput.

Parameters
inputFormat int: Value is ImageFormat.UNKNOWN, PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGB_888, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, android.graphics.ImageFormat.Y16, ImageFormat.YCBCR_P010, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, android.graphics.ImageFormat.RAW_DEPTH, android.graphics.ImageFormat.RAW_DEPTH10, ImageFormat.PRIVATE, ImageFormat.HEIC, or ImageFormat.JPEG_R

Returns
Set<Integer> a non-modifiable set of Integer formats This value may be null.

isOutputSupportedFor

Added in API level 29
public boolean isOutputSupportedFor (Surface surface)

Determine whether or not the surface in its current state is suitable to be included in a session as an output.

For more information refer to StreamConfigurationMap#isOutputSupportedFor.

Parameters
surface Surface: a Surface object reference This value cannot be null.

Returns
boolean true if this is supported, false otherwise

Throws
IllegalArgumentException if the Surface endpoint is no longer valid

isOutputSupportedFor

Added in API level 29
public boolean isOutputSupportedFor (int format)

Determine whether or not output surfaces with a particular user-defined format can be passed createCaptureSession.

For further information refer to StreamConfigurationMap#isOutputSupportedFor.

Parameters
format int: an image format from either ImageFormat or PixelFormat Value is ImageFormat.UNKNOWN, PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGB_888, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, android.graphics.ImageFormat.Y16, ImageFormat.YCBCR_P010, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, android.graphics.ImageFormat.RAW_DEPTH, android.graphics.ImageFormat.RAW_DEPTH10, ImageFormat.PRIVATE, ImageFormat.HEIC, or ImageFormat.JPEG_R

Returns
boolean true if using a surface with this format will be supported with CameraDevice#createCaptureSession(SessionConfiguration)

Throws
IllegalArgumentException if the image format was not a defined named constant from either ImageFormat or PixelFormat