# Clip

> A piece of media, trimmed to the part an edit uses.

Symbols in this group are spelled `otio_clip_…`. An SDK drops that prefix.

## `active_media_reference_key`

`otio_clip_active_media_reference_key` · getter

Returns which of a clip's media references is in use.

```c
OtioStatus otio_clip_active_media_reference_key(
    const OtioDocument *source,
    OtioNode node_handle,
    OtioBuffer *out_key,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `node_handle` | `node` | receiver |
| `out_key` | `text` | output |
| `out_error` | `text` | error |

## `media_reference`

`otio_clip_media_reference` · method · may answer nothing

Returns one of a clip's media references.

A null `key` means the active one. Reports `OTIO_STATUS_NO_VALUE` if the key names nothing, which for the active key is a clip with no media.

```c
OtioStatus otio_clip_media_reference(
    const OtioDocument *source,
    OtioNode node_handle,
    const char *key,
    OtioNode *out_reference,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `node_handle` | `node` | receiver |
| `key` (optional) | `text` | input |
| `out_reference` | `node` | output |
| `out_error` | `text` | error |

## `media_reference_count`

`otio_clip_media_reference_count` · getter

Returns how many media references a clip holds.

```c
OtioStatus otio_clip_media_reference_count(
    const OtioDocument *source,
    OtioNode node_handle,
    size_t *out_count,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `node_handle` | `node` | receiver |
| `out_count` | `size` | output |
| `out_error` | `text` | error |

## `media_reference_key_at`

`otio_clip_media_reference_key_at` · method

Returns the key of one of a clip's media references.

The references are ordered by key, so walking the indices walks them in a stable order.

```c
OtioStatus otio_clip_media_reference_key_at(
    const OtioDocument *source,
    OtioNode node_handle,
    size_t index,
    OtioBuffer *out_key,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `node_handle` | `node` | receiver |
| `index` | `size` | input |
| `out_key` | `text` | output |
| `out_error` | `text` | error |

## `new`

`otio_clip_new` · constructor

Creates a clip. `name` may be null for an unnamed one.

```c
OtioStatus otio_clip_new(
    OtioDocument *target,
    const char *name,
    OtioNode *out_node,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `name` (optional) | `text` | input |
| `out_node` | `node` | output |
| `out_error` | `text` | error |

## `remove_media_reference`

`otio_clip_remove_media_reference` · method · may answer nothing

Removes one of a clip's media references, and returns it.

```c
OtioStatus otio_clip_remove_media_reference(
    OtioDocument *target,
    OtioNode node_handle,
    const char *key,
    OtioNode *out_reference,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `node_handle` | `node` | receiver |
| `key` | `text` | input |
| `out_reference` | `node` | output |
| `out_error` | `text` | error |

## `set_active_media_reference_key`

`otio_clip_set_active_media_reference_key` · setter

Sets which of a clip's media references is in use.

```c
OtioStatus otio_clip_set_active_media_reference_key(
    OtioDocument *target,
    OtioNode node_handle,
    const char *key,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `node_handle` | `node` | receiver |
| `key` | `text` | input |
| `out_error` | `text` | error |

## `set_media_reference`

`otio_clip_set_media_reference` · setter

Sets one of a clip's media references, adding it if the key is new.

```c
OtioStatus otio_clip_set_media_reference(
    OtioDocument *target,
    OtioNode node_handle,
    const char *key,
    OtioNode reference,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `node_handle` | `node` | receiver |
| `key` | `text` | input |
| `reference` | `node` | input |
| `out_error` | `text` | error |

---

Page: https://otio-rust-docs.vercel.app/reference/clip/
