OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Rust API referencev12.0

FileToAttach

pub struct FileToAttach<'a>

One file to add to a recording that has already been written.

Borrowed rather than owned: the native side copies every payload before the call returns, so there is no reason to make the caller hand over its bytes.

Why there is no compress

crate::AttachmentSink::add has one and ignores it on a recording: an MKV attachment stream is stored verbatim, so there is nothing to deflate. A field that could only ever be ignored is not offered here rather than offered and quietly dropped.

FileToAttach — fields

name: &'a str

The name a reader should see, at most 255 bytes of UTF-8. Names need not be unique: a name the recording already carries gets a second entry rather than replacing the first.

mime: &'a str

The MIME type, at most 255 bytes. Empty is written as "application/octet-stream", exactly as it is for a provider's files.

data: &'a [u8]

The content. Must be at least one byte: Matroska stores no entry for an empty attachment (measured on ffmpeg 7.1.5, the muxer writes nothing at all for one), so a zero-length file is refused rather than accepted and silently dropped.

FileToAttach — methods

pub fn new(name: &'a str, data: &'a [u8]) -> Self

One file, named, with no MIME type stated.

pub fn with_mime(name: &'a str, mime: &'a str, data: &'a [u8]) -> Self

The same, declaring a MIME type.