# visionai

## Summary

| ### Functions ||
|---|---|
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/namespace/visionai#group__control_1gaf02dbcbf82d0925ea9ac409bcabe516a(const https://docs.cloud.google.com/vision-ai/docs/reference/cpp/struct/visionai/service-connection-options#structvisionai_1_1_service_connection_options & options, absl::string_view stream_id)` | `absl::Status` Creates a new stream resource with id `stream_id`. |
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/namespace/visionai#group__control_1gadba521c0f18203b777077d40ceaf8f0d(const https://docs.cloud.google.com/vision-ai/docs/reference/cpp/struct/visionai/service-connection-options#structvisionai_1_1_service_connection_options & options, absl::string_view stream_id)` | `absl::Status` Deletes the stream with id `stream_id`. |
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/namespace/visionai#group__packet_1ga3e7200aee29a04eccaff5c25f4c172c5(Packet p)` | `absl::StatusOr< T >` FromPacket attempts to unmarshal a `Packet` into a desired C++ Type. |
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/namespace/visionai#group__media__io_1ga1cfd35ab24cab23ab9ddac13d6d787ab(const https://docs.cloud.google.com/vision-ai/docs/reference/cpp/struct/visionai/service-connection-options#structvisionai_1_1_service_connection_options & options, absl::string_view stream_id, absl::string_view file_name)` | `absl::Status` Ingests an MP4 video file on the local file system named `file_name` into a stream of id `stream_id`. |
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/namespace/visionai#group__media__io_1ga433f1815d32c410e809cd13bd885681d(const https://docs.cloud.google.com/vision-ai/docs/reference/cpp/struct/visionai/service-connection-options#structvisionai_1_1_service_connection_options & options, absl::string_view stream_id, absl::string_view rtsp_url)` | `absl::Status` Ingests an RTSP camera endpoint `rtsp_url` into a stream of id `stream_id`. |
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/namespace/visionai#group__packet_1gafbafc39eabf5f90258343404f82502c8(T && t)` | `absl::StatusOr< Packet >` ToPacket marshals an object of C++ type `T` into a `Packet`. |

| ### Classes ||
|---|---|
| [visionai::StreamReceiver](https://docs.cloud.google.com/vision-ai/docs/reference/cpp/class/visionai/stream-receiver) | `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/class/visionai/stream-receiver#classvisionai_1_1_stream_receiver` is the client through which users receive `Packet`s from a stream. |
| [visionai::StreamSender](https://docs.cloud.google.com/vision-ai/docs/reference/cpp/class/visionai/stream-sender) | `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/class/visionai/stream-sender#classvisionai_1_1_stream_sender` is the client through which users send `Packet`s to a stream. |

| ### Structs ||
|---|---|
| [visionai::ServiceConnectionOptions](https://docs.cloud.google.com/vision-ai/docs/reference/cpp/struct/visionai/service-connection-options) | [ServiceConnectionOptions](https://docs.cloud.google.com/vision-ai/docs/reference/cpp/struct/visionai/service-connection-options#structvisionai_1_1_service_connection_options) is a structure that contains options to connect to the Agent Platform Vision service. |

## Functions

### CreateStream

```c++
absl::Status CreateStream(
  const ServiceConnectionOptions & options,
  absl::string_view stream_id
)
```
Creates a new stream resource with id `stream_id`.

<br />

Details Parameters `option` Connection options. `stream_id` The id of the stream to connect to. **Returns** OK on success. Otherwise the error indicating the cause.

### DeleteStream

```c++
absl::Status DeleteStream(
  const ServiceConnectionOptions & options,
  absl::string_view stream_id
)
```
Deletes the stream with id `stream_id`.

### FromPacket

```c++
absl::StatusOr< T > FromPacket(
  Packet p
)
```
FromPacket attempts to unmarshal a `Packet` into a desired C++ Type.

An error code will be returned if `p` cannot be extracted as the requested C++ type.

### IngestMp4

```c++
absl::Status IngestMp4(
  const ServiceConnectionOptions & options,
  absl::string_view stream_id,
  absl::string_view file_name
)
```
Ingests an MP4 video file on the local file system named `file_name` into a stream of id `stream_id`.

This call blocks until the file is fully ingested.

The file is ingested at the rate of its playback. For example, if the playback duration of the video is 1 minute, then this function will take 1 minute to complete.

Returns OK on success; otherwise, an error message telling why the ingestion could not complete successfully.

### IngestRtsp

```c++
absl::Status IngestRtsp(
  const ServiceConnectionOptions & options,
  absl::string_view stream_id,
  absl::string_view rtsp_url
)
```
Ingests an RTSP camera endpoint `rtsp_url` into a stream of id `stream_id`.

This call blocks and ingests the RTSP feed indefinitely. It may complete if the RTSP feed reaches the end, or is otherwise terminated for any reason.

Returns OK on success; otherwise, an error message telling why the ingestion could not complete successfully.

### ToPacket

```c++
absl::StatusOr< Packet > ToPacket(
  T && t
)
```
ToPacket marshals an object of C++ type `T` into a `Packet`.

The set of possible C++ types that can be marshalled are listed in visionai/streams/packet/packet_codecs/codec_selector.h