# Composition

> An item that holds other items and says where they sit.

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

## `append_child`

`otio_composition_append_child` · method

Adds a child to the end of a composition.

```c
OtioStatus otio_composition_append_child(
    OtioDocument *target,
    OtioNode parent,
    OtioNode child,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `out_error` | `text` | error |

## `child_at_time`

`otio_composition_child_at_time` · method · may answer nothing

Returns the child of a composition that covers an instant.

`shallow` stops at the composition's own children rather than descending into nested ones. Reports `OTIO_STATUS_NO_VALUE` when nothing covers it.

```c
OtioStatus otio_composition_child_at_time(
    const OtioDocument *source,
    OtioNode parent,
    OtioRationalTime time,
    bool shallow,
    OtioNode *out_child,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `time` | `OtioRationalTime` | input |
| `shallow` | `bool` | input |
| `out_child` | `node` | output |
| `out_error` | `text` | error |

## `children_in_range`

`otio_composition_children_in_range` · method

Returns the children of a composition that touch a span.

```c
OtioStatus otio_composition_children_in_range(
    const OtioDocument *source,
    OtioNode parent,
    OtioTimeRange search_range,
    OtioNode *out_nodes,
    size_t capacity,
    size_t *out_count,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `search_range` | `OtioTimeRange` | input |
| `out_nodes` | `list<node>` | output list |
| `capacity` | `size` | list capacity |
| `out_count` | `size` | output count |
| `out_error` | `text` | error |

## `clear_children`

`otio_composition_clear_children` · clearer

Removes every child of a composition, and returns them.

```c
OtioStatus otio_composition_clear_children(
    OtioDocument *target,
    OtioNode parent,
    OtioNode *out_nodes,
    size_t capacity,
    size_t *out_count,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `parent` | `node` | receiver |
| `out_nodes` | `list<node>` | output list |
| `capacity` | `size` | list capacity |
| `out_count` | `size` | output count |
| `out_error` | `text` | error |

## `detach_child`

`otio_composition_detach_child` · method

Removes a child by handle.

```c
OtioStatus otio_composition_detach_child(
    OtioDocument *target,
    OtioNode parent,
    OtioNode child,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `out_error` | `text` | error |

## `find_children_of_kind`

`otio_composition_find_children_of_kind` · method

Returns every object of a kind at or below a composition.

A null `search_range` searches all of it. `shallow` stops the walk at the composition's own children.

```c
OtioStatus otio_composition_find_children_of_kind(
    const OtioDocument *source,
    OtioNode parent,
    OtioNodeKind kind,
    const OtioTimeRange *search_range,
    bool shallow,
    OtioNode *out_nodes,
    size_t capacity,
    size_t *out_count,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `kind` | `OtioNodeKind` | input |
| `search_range` (optional) | `OtioTimeRange` | input |
| `shallow` | `bool` | input |
| `out_nodes` | `list<node>` | output list |
| `capacity` | `size` | list capacity |
| `out_count` | `size` | output count |
| `out_error` | `text` | error |

## `handles_of_child`

`otio_composition_handles_of_child` · method

Returns how much unused media a child has on each side.

```c
OtioStatus otio_composition_handles_of_child(
    const OtioDocument *source,
    OtioNode parent,
    OtioNode child,
    OtioHandles *out_handles,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `out_handles` | `OtioHandles` | output |
| `out_error` | `text` | error |

## `has_child`

`otio_composition_has_child` · method

Returns whether a composition holds an object directly.

```c
OtioStatus otio_composition_has_child(
    const OtioDocument *source,
    OtioNode parent,
    OtioNode child,
    bool *out_has,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `out_has` | `bool` | output |
| `out_error` | `text` | error |

## `index_of_child`

`otio_composition_index_of_child` · method

Returns where a child sits in its composition.

```c
OtioStatus otio_composition_index_of_child(
    const OtioDocument *source,
    OtioNode parent,
    OtioNode child,
    size_t *out_index,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `out_index` | `size` | output |
| `out_error` | `text` | error |

## `insert_child`

`otio_composition_insert_child` · method

Adds a child to a composition at an index.

A negative index counts from the end, as upstream's Python does. The child must not already be in a composition.

```c
OtioStatus otio_composition_insert_child(
    OtioDocument *target,
    OtioNode parent,
    int64_t index,
    OtioNode child,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `parent` | `node` | receiver |
| `index` | `int64` | input |
| `child` | `node` | input |
| `out_error` | `text` | error |

## `is_parent_of`

`otio_composition_is_parent_of` · method

Returns whether an object descends from a composition at any depth.

```c
OtioStatus otio_composition_is_parent_of(
    const OtioDocument *source,
    OtioNode parent,
    OtioNode other,
    bool *out_is,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `other` | `node` | input |
| `out_is` | `bool` | output |
| `out_error` | `text` | error |

## `neighbors_of`

`otio_composition_neighbors_of` · method

Returns the children on either side of one, or `otio_node_none` where there is none.

With `OTIO_NEIGHBOR_GAP_AROUND_TRANSITIONS`, a transition at the head or tail of a track gets a gap materialized for its overhang, which is why this takes a document it may edit.

```c
OtioStatus otio_composition_neighbors_of(
    OtioDocument *target,
    OtioNode parent,
    OtioNode child,
    OtioNeighborGapPolicy policy,
    OtioNode *out_before,
    OtioNode *out_after,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `policy` | `OtioNeighborGapPolicy` | input |
| `out_before` | `node` | output |
| `out_after` | `node` | output |
| `out_error` | `text` | error |

## `new`

`otio_composition_new` · constructor

Creates a bare composition: children with no layout of its own.

```c
OtioStatus otio_composition_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 |

## `range_of_child`

`otio_composition_range_of_child` · method

Returns where a child sits in a composition's clock, at any depth.

```c
OtioStatus otio_composition_range_of_child(
    const OtioDocument *source,
    OtioNode parent,
    OtioNode child,
    OtioTimeRange *out_range,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `out_range` | `OtioTimeRange` | output |
| `out_error` | `text` | error |

## `range_of_child_at_index`

`otio_composition_range_of_child_at_index` · method

Returns where the child at an index sits in its composition's clock.

A negative index counts from the end.

```c
OtioStatus otio_composition_range_of_child_at_index(
    const OtioDocument *source,
    OtioNode parent,
    int64_t index,
    OtioTimeRange *out_range,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `index` | `int64` | input |
| `out_range` | `OtioTimeRange` | output |
| `out_error` | `text` | error |

## `ranges_of_children`

`otio_composition_ranges_of_children` · method

Returns where every child of a composition sits, in one pass.

`out_nodes` and `out_ranges` are filled in step, so entry `i` of one goes with entry `i` of the other. Either may be null when only the count is wanted.

```c
OtioStatus otio_composition_ranges_of_children(
    const OtioDocument *source,
    OtioNode parent,
    OtioNode *out_nodes,
    OtioTimeRange *out_ranges,
    size_t capacity,
    size_t *out_count,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `out_nodes` (optional) | `list<node>` | output list |
| `out_ranges` (optional) | `list<OtioTimeRange>` | output list |
| `capacity` | `size` | list capacity |
| `out_count` | `size` | output count |
| `out_error` | `text` | error |

## `remove_child`

`otio_composition_remove_child` · method

Removes a child by index, and returns it.

The child stays in the document with no parent.

```c
OtioStatus otio_composition_remove_child(
    OtioDocument *target,
    OtioNode parent,
    int64_t index,
    OtioNode *out_child,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `target` | `document` | document mut |
| `parent` | `node` | receiver |
| `index` | `int64` | input |
| `out_child` | `node` | output |
| `out_error` | `text` | error |

## `trim_child_range`

`otio_composition_trim_child_range` · method · may answer nothing

Clips a range to a composition's own trim.

Reports `OTIO_STATUS_NO_VALUE` when nothing of it is left.

```c
OtioStatus otio_composition_trim_child_range(
    const OtioDocument *source,
    OtioNode parent,
    OtioTimeRange child_range,
    OtioTimeRange *out_range,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `child_range` | `OtioTimeRange` | input |
| `out_range` | `OtioTimeRange` | output |
| `out_error` | `text` | error |

## `trimmed_range_of_child`

`otio_composition_trimmed_range_of_child` · method · may answer nothing

Returns where a child sits after the composition's trim, at any depth.

Reports `OTIO_STATUS_NO_VALUE` when the trim excludes it entirely.

```c
OtioStatus otio_composition_trimmed_range_of_child(
    const OtioDocument *source,
    OtioNode parent,
    OtioNode child,
    OtioTimeRange *out_range,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `child` | `node` | input |
| `out_range` | `OtioTimeRange` | output |
| `out_error` | `text` | error |

## `trimmed_range_of_child_at_index`

`otio_composition_trimmed_range_of_child_at_index` · method

Returns where the child at an index sits, after the composition's own trim.

```c
OtioStatus otio_composition_trimmed_range_of_child_at_index(
    const OtioDocument *source,
    OtioNode parent,
    int64_t index,
    OtioTimeRange *out_range,
    OtioBuffer *out_error);
```

| Parameter | Type | Role |
| --- | --- | --- |
| `source` (optional) | `document` | document in |
| `parent` | `node` | receiver |
| `index` | `int64` | input |
| `out_range` | `OtioTimeRange` | output |
| `out_error` | `text` | error |

---

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