Reading and writing the interchange formats.
Symbols in this group are spelled otio_read_… or otio_write_…. An SDK drops that prefix, which is why the name beside each call is the short one.
Reads a document from the bytes of a file in some format.
`options` may be null for the format's usual behaviour. The bundle formats are refused with `OTIO_STATUS_UNSUPPORTED`: read one from its path.
OtioStatus otio_read_from_bytes(
OtioFormat format,
const uint8_t *data,
size_t len,
const OtioReadOptions *options,
OtioDocument **out_document,
OtioBuffer *out_error);| Parameter | Type | Role |
|---|---|---|
| format | OtioFormat | input |
| data | bytes | a buffer of bytes |
| len | size | the length of the buffer before it |
| options ? | OtioReadOptions | input |
| out_document | document | written through, not read |
| out_error | text | why the call failed, or null to skip it |
Reads a document from a file on disk in some format.
An AAF is read where it lies, seeking around the file, rather than copied into memory first. An `.otiod` is a directory, and `path` names it.
A build without a file system, such as one for WebAssembly, reports `OTIO_STATUS_UNSUPPORTED`; use [`otio_read_from_bytes`] there.
* if (otio_read_from_file(OTIO_FORMAT_CMX_3600, "cut.edl", NULL, &document,
* &error)) {
* fprintf(stderr, "%s\n", error.data);| Parameter | Type | Role |
|---|---|---|
| format | OtioFormat | input |
| path | text | input |
| options ? | OtioReadOptions | input |
| out_document | document | written through, not read |
| out_error | text | why the call failed, or null to skip it |
Returns the defaults, for a caller that wants to change one field.
* then call `otio_read_options_init()` or `otio_write_options_init()`, which
* fill every field that size covers with its default:
*
* OtioReadOptions options;| Parameter | Type | Role |
|---|---|---|
| out_options | OtioReadOptions | written through, not read |
Returns the defaults, for a caller that wants to change one field.
* then call `otio_read_options_init()` or `otio_write_options_init()`, which
* fill every field that size covers with its default:
*
* OtioReadOptions options;| Parameter | Type | Role |
|---|---|---|
| out_options | OtioWriteOptions | written through, not read |
Writes a document as the bytes of a file in some format.
The buffer is NUL-terminated, so a text format's output can be used as a C string; `len` is what matters for a binary one. The bundle formats are refused with `OTIO_STATUS_UNSUPPORTED`: write one to a path.
OtioStatus otio_write_to_bytes(
OtioFormat format,
const OtioDocument *source,
const OtioWriteOptions *options,
OtioBuffer *out_bytes,
OtioBuffer *out_error);| Parameter | Type | Role |
|---|---|---|
| format | OtioFormat | input |
| source ? | document | the document, borrowed |
| options ? | OtioWriteOptions | input |
| out_bytes | bytes | written through, not read |
| out_error | text | why the call failed, or null to skip it |
Writes a document to a file on disk in some format.
A bundle is written from the document's root, which has to be a timeline, along with a copy of every media file it references; an `.otiod` is a directory, and `path` names it. Neither overwrites: a bundle whose `path` already exists is refused.
A build without a file system, such as one for WebAssembly, reports `OTIO_STATUS_UNSUPPORTED`; use [`otio_write_to_bytes`] there.
* otio_write_to_file(OTIO_FORMAT_OTIO_JSON, document, "cut.otio", NULL, NULL);| Parameter | Type | Role |
|---|---|---|
| format | OtioFormat | input |
| source ? | document | the document, borrowed |
| path | text | input |
| options ? | OtioWriteOptions | input |
| out_error | text | why the call failed, or null to skip it |