camera3_stream Struct Reference

camera3_stream Struct Reference

#include < camera3.h >

Data Fields

int  stream_type
uint32_t  width
uint32_t  height
int  format
uint32_t  usage
uint32_t  max_buffers
void *  priv
android_dataspace_t  data_space
int  rotation
void *  reserved [7]

Detailed Description


A handle to a single camera input or output stream. A stream is defined by the framework by its buffer resolution and format, and additionally by the HAL with the gralloc usage flags and the maximum in-flight buffer count.

The stream structures are owned by the framework, but pointers to a camera3_stream passed into the HAL by configure_streams() are valid until the end of the first subsequent configure_streams() call that does not include that camera3_stream as an argument, or until the end of the close() call.

All camera3_stream framework-controlled members are immutable once the camera3_stream is passed into configure_streams(). The HAL may only change the HAL-controlled parameters during a configure_streams() call, except for the contents of the private pointer.

If a configure_streams() call returns a non-fatal error, all active streams remain valid as if configure_streams() had not been called.

The endpoint of the stream is not visible to the camera HAL device. In DEVICE_API_VERSION_3_1, this was changed to share consumer usage flags on streams where the camera is a producer (OUTPUT and BIDIRECTIONAL stream types) see the usage field below.

Definition at line 1523 of file camera3.h .

Field Documentation

android_dataspace_t data_space

A field that describes the contents of the buffer. The format and buffer dimensions define the memory layout and structure of the stream buffers, while dataSpace defines the meaning of the data within the buffer.

For most formats, dataSpace defines the color space of the image data. In addition, for some formats, dataSpace indicates whether image- or depth-based data is requested. See system/core/include/system/graphics.h for details of formats and valid dataSpace values for each format.

Version information:


Not defined and should not be accessed. dataSpace should be assumed to be HAL_DATASPACE_UNKNOWN, and the appropriate color space, etc, should be determined from the usage flags and the format.


Always set by the camera service. HAL must use this dataSpace to configure the stream to the correct colorspace, or to select between color and depth outputs if supported. The dataspace values are the legacy definitions in graphics.h


Always set by the camera service. HAL must use this dataSpace to configure the stream to the correct colorspace, or to select between color and depth outputs if supported. The dataspace values are set using the V0 dataspace definitions in graphics.h

Definition at line 1648 of file camera3.h .

int format

The pixel format for the buffers in this stream. Format is a value from the HAL_PIXEL_FORMAT_* list in system/core/include/system/graphics.h, or from device-specific headers.

If HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED is used, then the platform gralloc module will select a format based on the usage flags provided by the camera device and the other endpoint of the stream.


The camera HAL device must inspect the buffers handed to it in the subsequent register_stream_buffers() call to obtain the implementation-specific format details, if necessary.


register_stream_buffers() won't be called by the framework, so the HAL should configure the ISP and sensor pipeline based purely on the sizes, usage flags, and formats for the configured streams.

Definition at line 1565 of file camera3.h .

uint32_t height

The height in pixels of the buffers in this stream

Definition at line 1542 of file camera3.h .

uint32_t max_buffers

The maximum number of buffers the HAL device may need to have dequeued at the same time. The HAL device may not have more buffers in-flight from this stream than this value.

Definition at line 1608 of file camera3.h .

void* priv

A handle to HAL-private information for the stream. Will not be inspected by the framework code.

Definition at line 1614 of file camera3.h .

void* reserved[7]

Definition at line 1677 of file camera3.h .

int rotation

The required output rotation of the stream, one of the camera3_stream_rotation_t values. This must be inspected by HAL along with stream width and height. For example, if the rotation is 90 degree and the stream width and height is 720 and 1280 respectively, camera service will supply buffers of size 720x1280, and HAL should capture a 1280x720 image and rotate the image by 90 degree counterclockwise. The rotation field is no-op when the stream type is input. Camera HAL must ignore the rotation field for an input stream.


Not defined and must not be accessed. HAL must not apply any rotation on output images.


Always set by camera service. HAL must inspect this field during stream configuration and returns -EINVAL if HAL cannot perform such rotation. HAL must always support CAMERA3_STREAM_ROTATION_0, so a configure_streams() call must not fail for unsupported rotation if rotation field of all streams is CAMERA3_STREAM_ROTATION_0.

Definition at line 1674 of file camera3.h .

int stream_type

The type of the stream, one of the camera3_stream_type_t values.

Definition at line 1532 of file camera3.h .

uint32_t usage

The gralloc usage flags for this stream, as needed by the HAL. The usage flags are defined in gralloc.h (GRALLOC_USAGE_*), or in device-specific headers.

For output streams, these are the HAL's producer usage flags. For input streams, these are the HAL's consumer usage flags. The usage flags from the producer and the consumer will be combined together and then passed to the platform gralloc HAL module for allocating the gralloc buffers for each stream.

Version information:


No initial value guaranteed when passed via configure_streams(). HAL may not use this field as input, and must write over this field with its usage flags.


For stream_type OUTPUT and BIDIRECTIONAL, when passed via configure_streams(), the initial value of this is the consumer's usage flags. The HAL may use these consumer flags to decide stream configuration. For stream_type INPUT, when passed via configure_streams(), the initial value of this is 0. For all streams passed via configure_streams(), the HAL must write over this field with its usage flags.

Definition at line 1601 of file camera3.h .

uint32_t width

The width in pixels of the buffers in this stream

Definition at line 1537 of file camera3.h .

The documentation for this struct was generated from the following file: