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

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 1236 of file camera3.h.

Field Documentation

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 1278 of file camera3.h.

uint32_t height

The height in pixels of the buffers in this stream

Definition at line 1255 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 1321 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 1327 of file camera3.h.

int stream_type

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

Definition at line 1245 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 1314 of file camera3.h.

uint32_t width

The width in pixels of the buffers in this stream

Definition at line 1250 of file camera3.h.

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