Merge branch 'main' into worktree-agent-a9fea98fe9839069d (filmcraft rev 2c5ba7a: AAF and OMF interchange)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
//! File ▸ Import; the default for export;
|
||||
//! - **FCPXML** 1.9–1.11 (`.fcpxml`);
|
||||
//! - **OpenTimelineIO** (`.otio`);
|
||||
//! - **CMX 3600 EDL** (`.edl`).
|
||||
//! - **CMX 3600 EDL** (`.edl`);
|
||||
//! - **AAF** (`.aaf`) and **OMF** (`.omf`) (embedded audio is not extracted).
|
||||
//!
|
||||
//! Parsing and writing is FilmCraft's `filmcraft-interchange` (our first-party sibling project);
|
||||
//! this crate maps its timeline model to compositions and back:
|
||||
@@ -58,10 +59,15 @@ pub enum TimelineFormat {
|
||||
Otio,
|
||||
/// CMX 3600 edit decision list.
|
||||
Edl,
|
||||
/// Advanced Authoring Format (AAF Edit Protocol), as Premiere Pro exports for audio post.
|
||||
Aaf,
|
||||
/// OMF Interchange 2.0.
|
||||
Omf,
|
||||
}
|
||||
|
||||
impl TimelineFormat {
|
||||
pub const ALL: [TimelineFormat; 4] = [TimelineFormat::Fcp7Xml, TimelineFormat::Fcpxml, TimelineFormat::Otio, TimelineFormat::Edl];
|
||||
pub const ALL: [TimelineFormat; 6] =
|
||||
[TimelineFormat::Fcp7Xml, TimelineFormat::Fcpxml, TimelineFormat::Otio, TimelineFormat::Edl, TimelineFormat::Aaf, TimelineFormat::Omf];
|
||||
|
||||
/// Id used by commands (`xml`, `fcpxml`, `otio`, `edl`).
|
||||
pub fn id(self) -> &'static str {
|
||||
@@ -70,6 +76,8 @@ impl TimelineFormat {
|
||||
TimelineFormat::Fcpxml => "fcpxml",
|
||||
TimelineFormat::Otio => "otio",
|
||||
TimelineFormat::Edl => "edl",
|
||||
TimelineFormat::Aaf => "aaf",
|
||||
TimelineFormat::Omf => "omf",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +87,8 @@ impl TimelineFormat {
|
||||
TimelineFormat::Fcpxml => "FCPXML",
|
||||
TimelineFormat::Otio => "OpenTimelineIO",
|
||||
TimelineFormat::Edl => "CMX 3600 EDL",
|
||||
TimelineFormat::Aaf => "AAF",
|
||||
TimelineFormat::Omf => "OMF",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +104,8 @@ impl TimelineFormat {
|
||||
"fcpxml" | "fcpxmld" | "fcpx" => Some(TimelineFormat::Fcpxml),
|
||||
"otio" | "opentimelineio" => Some(TimelineFormat::Otio),
|
||||
"edl" | "cmx3600" | "cmx" => Some(TimelineFormat::Edl),
|
||||
"aaf" => Some(TimelineFormat::Aaf),
|
||||
"omf" | "omfi" => Some(TimelineFormat::Omf),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -119,6 +131,8 @@ impl TimelineFormat {
|
||||
TimelineFormat::Fcpxml => filmcraft_interchange::Format::Fcpxml,
|
||||
TimelineFormat::Otio => filmcraft_interchange::Format::Otio,
|
||||
TimelineFormat::Edl => filmcraft_interchange::Format::Edl,
|
||||
TimelineFormat::Aaf => filmcraft_interchange::Format::Aaf,
|
||||
TimelineFormat::Omf => filmcraft_interchange::Format::Omf,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +142,8 @@ impl TimelineFormat {
|
||||
filmcraft_interchange::Format::Fcpxml => TimelineFormat::Fcpxml,
|
||||
filmcraft_interchange::Format::Otio => TimelineFormat::Otio,
|
||||
filmcraft_interchange::Format::Edl => TimelineFormat::Edl,
|
||||
filmcraft_interchange::Format::Aaf => TimelineFormat::Aaf,
|
||||
filmcraft_interchange::Format::Omf => TimelineFormat::Omf,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,6 +310,32 @@ fn imports_fcp7_xml_fcpxml_and_otio() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn imports_aaf_and_omf() {
|
||||
let (doc, main) = edit();
|
||||
for fmt in [fc::Format::Aaf, fc::Format::Omf] {
|
||||
let (bytes, _) = fc::export(&doc, main, fmt, &Default::default()).unwrap();
|
||||
let name = format!("Main.{}", fmt.extension());
|
||||
assert_eq!(TimelineFormat::detect(&bytes, Some(&name)).map(|f| f.fc()), Some(fmt));
|
||||
let (p, r) = import_doc(&bytes, &name, &mut probe);
|
||||
let c = p.comp(r.comps[0]).unwrap();
|
||||
if fmt == fc::Format::Aaf {
|
||||
assert_eq!((c.width, c.height), (W, H));
|
||||
}
|
||||
// Audio: an audio-only layer for the A1 clip (OMF carries the audio tracks only).
|
||||
let au = c.layers.iter().find(|l| !l.switches.video && l.switches.audio).expect("audio layer");
|
||||
assert!(near(au.in_point, Tick::ZERO) && near(au.out_point, t(3.0)));
|
||||
if fmt == fc::Format::Aaf {
|
||||
// The dissolve's clips overlap over the transition, the incoming one on top.
|
||||
let a = layer(c, "a.png");
|
||||
assert!(near(a.out_point, t(2.4)), "{}", a.out_point.seconds());
|
||||
let b = c.layers.iter().find(|l| near(l.in_point, t(1.6))).expect("incoming clip");
|
||||
assert!(c.index_of(b.id) < c.index_of(a.id));
|
||||
assert_eq!(b.transform().unwrap().get("opacity").unwrap().keys.len(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_media_become_placeholders() {
|
||||
let (doc, main) = edit();
|
||||
|
||||
Reference in New Issue
Block a user