#[non_exhaustive]pub enum FileNaming {
Exact,
Indexed,
Pattern(String),
}Expand description
How a recorder names the files of a session from its RecordingTarget.
The directory the name leads to must exist and be writable. See
Self::Exact for the tested exclusive-open behavior and the limits of
preflight.
The expanded filename must be absolute. It must fit exactly in the
recorder’s event field, at most 4094 UTF-8 bytes with the current SDK.
Preflight counts the spelling the SDK will use, including redundant
separators and . components, and reserves at least 20 digits for each
index token to cover future rollovers. Start and rollover refuse relative
or oversized filenames with Error::InvalidInput.
Preflight checks the exact filename or the first indexed candidate against
the destination filesystem. If later indexes can add digits, it also checks
a candidate with the maximum index width. Start and rollover return
Error::Io if the widest basename exceeds a filesystem limit, even
when the first candidate fits. Shorten the basename prefix or remove a
repeated index token to fit the limit.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Exact
Name each file exactly as its RecordingTarget says, with no index.
FileRecorder::start and FileRecorder::rollover refuse a target
that already exists with an Error::Io of kind
AlreadyExists, before the SDK is
called.
This preflight does not reserve the path. A collision created after
the check is handled by the native library; a rollover may return
success before its later open fails and stops the session. Linux File
SDK 6.4.0.2 uses exclusive creation and preserves existing files,
including symlinks, in this race. Other platforms and SDK releases
have not been verified. Use a recorder-controlled output directory
when uninterrupted recording or destination containment matters;
mutable parent directories are not pinned by this API.
One target names one file, so a session cannot move to a new file by itself:
- a format change of the source closes the file and ends the session,
which
RecordingReport::stopped_by_sdkthen reports; seeFileRecorderOptions::format_change_rollover; - format-change rollover switched on, or a nonzero
FileRecorderOptions::rollover_size, is refused withError::InvalidInputwhen the recorder is created; FileRecorder::set_sourceis refused during a session withStateConflict::ExactFileName.
FileRecorder::rollover to a new target still works. Use
Indexed, or a Pattern with
{index}, for recordings that must survive these changes.
Indexed
The SDK’s indexed {prefix}_{index:03}.mkv: the target take becomes
take_001.mkv, and each new file of the session takes the lowest
unused index.
Pattern(String)
A filename pattern using {prefix}, {index} and {index:N} tokens.
{prefix} is replaced by the RecordingTarget, and {index:N} pads
the index with zeros to N digits, from 1 through 1024. The pattern
may name a directory, for example {prefix}/{index:03}.mkv; that
directory must exist. Index tokens must be in the file name: directories
may come only from literal text and {prefix}. A pattern placing an
index in a directory is refused when the recorder is created.
Use {prefix}{index}.mkv with RecordingTarget::new("take") to
write take1.mkv in the directory in effect when the target is built.
A pattern may also contain a literal absolute path.
A pattern without {index} or {index:N} names its file exactly,
with every rule of Exact.
A pattern that is empty, or has an unknown token or unbalanced braces,
is refused with Error::InvalidInput when the recorder is created,
and one that contains a NUL with Error::InvalidCString.