<br />

Added: 7

## **PROTOCOLS**

## Manager

*Defined in [fuchsia.camera2/manager.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/manager.fidl;l=11)*
Removed: NEXT Deprecated: 25 Added: 7

<br />

### AcknowledgeDeviceEvent

AcknowledgeDeviceEvent must be called after any of the above events before more
events will be sent.

#### Request

\<EMPTY\>

### ConnectToStream

Connect to a camera stream:
`device_id` Refers to a specific device_id that has been advertised by OnDeviceAvailable.
`constraints` contains a set of constraints on the requested stream. The Camera
Manager will attempt to find a stream that meets the constraints. If multiple
streams match, one of the matching streams will be connected.
`token` refers to a Sysmem buffer allocation that will be used to pass images using
the Stream protocol. The Camera Manager will apply a BufferCollectionContraints
related to the image format(s), so the client does not need to apply any
ImageFormatConstraints.
Sync is assumed to have been called on `token` before it is passed to
ConnectToStream.
Since `constraints` may not dictate a specific format, the initial format of images
on the stream is indicated on the response.
The connection is considered to be successful once a response has been given, unless
`stream` is closed.

#### Request

| Name | Type |
|---|---|
| `device_id` | `int32` |
| `constraints` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#StreamConstraints` |
| `token` | `client_end:https://fuchsia.dev/reference/fuchsia.sysmem//https://fuchsia.dev/reference/fuchsia.sysmem#BufferCollectionToken` |
| `stream` | `server_end:https://fuchsia.dev/reference/fidl/fuchsia.camera2#Stream` |

#### Response

| Name | Type |
|---|---|
| `format` | `https://fuchsia.dev/reference/fuchsia.sysmem//https://fuchsia.dev/reference/fuchsia.sysmem#ImageFormat_2` |

### OnDeviceAvailable

Notifies the client when a camera becomes available. A number of these events will
be sent when a client first connects to this protocol.
`device_id` is used to identify the camera. The device_id should not change throughout
the lifetime of the camera.
`last_known_camera` is set to true when the Camera Manager has notified the client
of all the devices it currently knows about.
`description` describes the properties of the camera.

#### Response

| Name | Type |
|---|---|
| `device_id` | `int32` |
| `description` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#DeviceInfo` |
| `last_known_camera` | `bool` |

### OnDeviceMuteChanged

Notifies the client when a camera becomes muted or unmuted.
`device_id` refers to the device_id from the description of a previous OnDeviceAvailable
call.

#### Response

| Name | Type |
|---|---|
| `device_id` | `int32` |
| `currently_muted` | `bool` |

### OnDeviceUnavailable

Notifies the client when a camera becomes unavailable.

#### Response

| Name | Type |
|---|---|
| `device_id` | `int32` |

## MuteControl

*Defined in [fuchsia.camera2/manager.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/manager.fidl;l=68)*

### Mute

Mutes a camera. This is independent from stopping or closing a stream. A muted
camera will not produce any more images until
unmute is called. You can still connect to streams from a muted camera, but they
will not produce frames until the camera is unmuted.
`device_id` refers to the device_id from a previous OnDeviceAvailable call.

#### Request

| Name | Type |
|---|---|
| `device_id` | `int32` |

#### Response

| Name | Type |
|---|---|
| `status` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

### Unmute

#### Request

| Name | Type |
|---|---|
| `device_id` | `int32` |

#### Response

| Name | Type |
|---|---|
| `status` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

## Stream

*Defined in [fuchsia.camera2/stream.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=79)*

### AcknowledgeFrameError

Provides flow control for receiving frame errors. See OnFrameAvailable comment.

#### Request

\<EMPTY\>

### GetBuffers

Removed: NEXT Deprecated: 25

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `token` | `client_end:https://fuchsia.dev/reference/fuchsia.sysmem//https://fuchsia.dev/reference/fuchsia.sysmem#BufferCollectionToken` |

### GetBuffers2

Returns a token to the buffers that are being used to output frames on the stream. The
token is `dispensable` which means it doesn't have to be turned in to sysmem for allocation
to complete. This also means that any SetConstraints call on the returned token can't
conflict with the constraints in the `StreamConfig`, otherwise attempts to wait for buffers
on the token will fail.
Added: 25

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `token` | `client_end:https://fuchsia.dev/reference/fuchsia.sysmem2//https://fuchsia.dev/reference/fuchsia.sysmem2#BufferCollectionToken` |

### GetImageFormats

Get the image formats that this stream supports.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `image_formats` | `vector<https://fuchsia.dev/reference/fuchsia.sysmem//https://fuchsia.dev/reference/fuchsia.sysmem#ImageFormat_2>:256` |

### OnFrameAvailable

Sent by the driver to the client when a frame is available for processing,
or an error occurred. The frame is considered read-locked by the client
after this message. The client must call ReleaseFrame to release the
read-lock for a non-error frame, or the consumer will eventually run out of buffers.
If a frame has an error, the client must call AcknowledgeFrameError before
another OnFrameAvailable will be called with an error frame.

#### Response

| Name | Type |
|---|---|
| `frame` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#FrameAvailableInfo` |

### ReleaseFrame

Unlocks the specified frame, allowing the driver to reuse the memory.

#### Request

| Name | Type |
|---|---|
| `buffer_id` | `uint32` |

### SetImageFormat

Change the image format of the stream. This is called when clients want
to dynamically change the resolution of the stream while the streaming is
is going on.

#### Request

| Name | Type |
|---|---|
| `image_format_index` | `uint32` |

#### Response

| Name | Type |
|---|---|
| `s` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

### SetRegionOfInterest

Data operations
This is used by clients to provide inputs for region of interest
selection.
Inputs are the x \& y coordinates for the new bounding box.
For streams which do not support smart framing, this would
return an error.

#### Request

| Name | Type |
|---|---|
| `x_min` | `float32` |
| `y_min` | `float32` |
| `x_max` | `float32` |
| `y_max` | `float32` |

#### Response

| Name | Type |
|---|---|
| `s` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

### Start

Control Operations
Starts the streaming of frames.

#### Request

\<EMPTY\>

### Stop

Stops the streaming of frames.

#### Request

\<EMPTY\>

## **STRUCTS**

### FrameAvailableInfo

*Defined in [fuchsia.camera2/stream.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=38)*

Sent by the driver to the client when a frame is available for processing,
or an error occurred.

<br />

| Field | Type | Description | Default |
|---|---|---|---|
| `frame_status` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#FrameStatus` | Non zero if an error occurred. | No default |
| `buffer_id` | `uint32` | The index of the buffer in the buffer collection. | No default |
| `metadata` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#FrameMetadata` |   | No default |

### FrameRate

*Defined in [fuchsia.camera2/stream.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=48)*

| Field | Type | Description | Default |
|---|---|---|---|
| `frames_per_sec_numerator` | `uint32` | The frame rate is frames_per_sec_numerator / frames_per_sec_denominator. | No default |
| `frames_per_sec_denominator` | `uint32` |   | No default |

## **ENUMS**

### DeviceType [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.camera2/manager.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/manager.fidl;l=99)*

| Name | Value | Description |
|---|---|---|
| ### BUILTIN | `1` |   |
| ### VIRTUAL | `2` |   |

### FrameStatus [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.camera2/stream.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=15)*

Status to be set when a frame is signalled available.

<br />

| Name | Value | Description |
|---|---|---|
| ### OK | `0` |   |
| ### ERROR_FRAME | `1` | An error occurred during the production of a frame. No data will be available in the data buffer corresponding to this notification. |
| ### ERROR_BUFFER_FULL | `2` | No space was available in the data buffer, resulting in a dropped frame. |

## **TABLES**

### DeviceInfo

*Defined in [fuchsia.camera2/manager.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/manager.fidl;l=105)*

Identifying information about the device.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `vendor_id` | `uint16` | Information from physical device enumeration: |
| ### 2 | `vendor_name` | `string:255` |   |
| ### 3 | `product_id` | `uint16` |   |
| ### 4 | `product_name` | `string:255` |   |
| ### 5 | `type` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#DeviceType` | Information about the type of device: |

### FrameMetadata

*Defined in [fuchsia.camera2/stream.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=26)*

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `timestamp` | `int64` |   |
| ### 2 | `image_format_index` | `uint32` | \|image_format_index\| references the index into the vector of available formats supported by the stream. |
| ### 3 | `capture_timestamp` | `int64` | The value of the system monotonic clock at the moment the buffer used to construct this frame was received from the ISP. |

### StreamConstraints

*Defined in [fuchsia.camera2/manager.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/manager.fidl;l=88)*

These constraints are given to the Camera Manager when requesting a stream. The
Camera Manager will use these constraints to match an appropriate stream.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `properties` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#StreamProperties` | A table that describes the properties of the stream. Any properties specified will be considered requirements for matching streams. |
| ### 2 | `format_index` | `uint32` | If specified, the stream will be created using this index for the initial format index. If unspecified, the first stream format will be used. |

### StreamProperties

*Defined in [fuchsia.camera2/stream.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=74)*

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `stream_type` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2#CameraStreamType` | These could be one or more of the above mentioned Stream Types |

## **BITS**

### CameraStreamType [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.camera2/stream.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=56)*

Different Stream types provided by the camera stack.

<br />

| Name | Value | Description |
|---|---|---|
| ### MACHINE_LEARNING | 1 | ML request FR(Full Resolution) stream as well as a DS(Down Scaled Resolution) stream for Security Use Case which are of fixed resolutions |
| ### MONITORING | 2 | This is Security Video Stream which could support multiple resolutions at runtime. |
| ### FULL_RESOLUTION | 4 |   |
| ### DOWNSCALED_RESOLUTION | 8 | ML request a DS stream for Video Conferencing which is fixed resolution |
| ### VIDEO_CONFERENCE | 16 | This is Video Conferencing Stream which could support multiple resolutions at runtime. |
| ### EXTENDED_FOV | 32 | Stream with extended field of view. |

## **CONSTANTS**

| Name | Value | Type | Description |
|---|---|---|---|
| [MAX_IMAGE_FORMATS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2/stream.fidl;l=11) | `256` | `uint64` | Maximum number of image formats per stream. |