mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 10:48:15 +01:00
961 upstream commits since 7bb6c900. Resolutions:
- Test-only conflicts: upstream tests from before the base that our side
cut stay cut; tests new upstream are kept (audio aac/config, layout,
encode_format; cms lutfile; media mux; print windows_native, ticket;
update self_update; xml hostile).
- Code our side moved, with upstream's change carried to the new place:
craft-media mux roll sample groups (mux/boxes.rs) and writer-start
offsets with overflow checks (mux/progressive.rs); craft-print's
shrink-to-fit scale guard (sheets/plan.rs); craft-update's nextest
archive detection (self_update/detect.rs); craft-vectorcraft-format's
Tail::write_to_with (container.rs); craft-i18n's pedantic fixes
(bidi.rs, negotiation.rs).
- craft-ui: the old crate's modules stay removed; gpu_test_lock guarded
their per-test wgpu renderers, which the snapshot kit does not have.
- New upstream tests in crates that build their integration tests into
the library's test executable are modules of tests/main.rs (audio
flac_decode and qoa_oracle, cms, docpath, pcraft-format,
vectorcraft-format).
- The 22 new crates are optional members of the craft facade.
48 lines
2.2 KiB
Rust
48 lines
2.2 KiB
Rust
//! OMF Interchange 2.0 for audio post: written, and the same structures read.
|
||
//!
|
||
//! Written from the public *OMF Interchange Specification Version 2.0* (Avid Technology, 1995/97)
|
||
//! and Apple's *Bento Specification* revision 1.0d5 for the container.
|
||
//!
|
||
//! The file holds a composition mob (`CMOB`) with a timecode slot and one sound slot per audio
|
||
//! track (one per channel when broken out to mono): sequences (`SEQU`) of fillers (`FILL`), source
|
||
//! clips (`SCLP`) and transitions (`TRAN` with a `SimpleMonoAudioDissolve` effect); clip volume is a
|
||
//! `MonoAudioGain` effect (`EFFE`) whose slot −1 is the clip and slot 1 the amplitude
|
||
//! (`CVAL` constant or `VVAL` keyframes). Every media item has a master mob (`MMOB`), a file source
|
||
//! mob (`SMOB` with a `WAVD` / `AIFD` descriptor: embedded essence in a `WAVE` media data object,
|
||
//! or a locator to a separate file) and a tape source mob carrying its timecode. Times are in
|
||
//! samples (sound slots use the sample rate as edit rate) so edits are sample-exact.
|
||
//!
|
||
//! Only sound is written: picture tracks and markers of the model are left out, and a nested
|
||
//! composition is not written as one (readers of OMF do not follow compositions). A caller with
|
||
//! nested sequences mixes their sound and passes it as media like any other; Premiere Pro's OMF
|
||
//! export does the same.
|
||
//!
|
||
//! Private properties. `FilmCraft:SCLP:ClipName` (a clip's name) and `FilmCraft:EFFE:EffectID` (a
|
||
//! transition's name) are not in the specification; they were first written by FilmCraft and keep
|
||
//! their names so that existing files read back.
|
||
|
||
pub mod bento;
|
||
mod read;
|
||
mod write;
|
||
|
||
use crate::model::Document;
|
||
use crate::{Identity, Report, Result};
|
||
|
||
/// Write the sound of `doc`'s first composition as an OMF 2.0 file.
|
||
pub fn write(doc: &Document, identity: &Identity<'_>, report: &mut Report) -> Result<Vec<u8>> {
|
||
write::write(doc, identity, report)
|
||
}
|
||
|
||
/// Read an OMF 2.0 file (as written by [`fn@write`] and by applications using the same structures).
|
||
pub fn read(bytes: &[u8], report: &mut Report) -> Result<Document> {
|
||
read::read(bytes, report)
|
||
}
|
||
|
||
/// Whether `bytes` end with a Bento container label (OMF files do).
|
||
pub fn sniff(bytes: &[u8]) -> bool {
|
||
bento::sniff(bytes)
|
||
}
|
||
|
||
#[cfg(test)]
|
||
mod tests;
|