refactor: drop internal bridge/ffi layers; exporter family lands

Single-lib cleanup: the per-crate src/bridge/ and src/ffi.rs layers are
gone (oakundo/oakcommon/oaknode/oaktimeline/oakcodec/oakaudio/
oakrender/oaktask/oakplugin/oakstorage); cross-crate calls are plain
Rust, CHandle marshalling shrinks to the oakengine boundary, and tests
call the Rust APIs directly (pure C-ABI wrapper tests removed where
the domain layer already covers the behavior).

exporter.h family implemented: oakengine_export_render (CLI contract),
oakengine_export_render_with_params (was a stub), last_error and
progress callback; synchronous path reuses task_create_export +
start_sync. Fixes on the way: oaktask video ticket self-deadlock,
audio params dropped on the export path, codec encoder AAC slicing and
H.264 time base. Real-mp4 tests cover both entry points, progress and
the illegal-argument matrix.

Also: oakstorage session maps null project handles to None (version-
info path), configstore test double literal 3.14 -> 3.15 (clippy PI
lint), oakaudio output callback scratch buffer + env-aware P1 test,
cli media round-trip test uses a generated 16-frame clip (no more
minute-long debug runs).
This commit is contained in:
2026-08-16 00:33:45 +08:00
parent 2248be8567
commit ab1a2e9c7b
293 changed files with 27826 additions and 90128 deletions
-7
View File
@@ -1,7 +0,0 @@
#[test]
fn dbg_dlsym() {
let p = oaknode::bridge::dlsym::resolve("oaknode_xml_writer_init");
eprintln!("writer init symbol: {:?}", p);
let p2 = oaknode::bridge::dlsym::resolve("oakundo_command_init_multi");
eprintln!("undo multi symbol: {:?}", p2);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+52 -44
View File
@@ -357,55 +357,77 @@ fn serializer_value_codecs() {
);
}
/// bridge::undo: vtable commands + multi commands through the stubs.
///
/// Needs the `test-stubs` feature: the bridge resolves `oakundo_*`
/// symbols via dlsym, which only resolves in the test binary when the
/// in-crate stubs are compiled in.
#[cfg(feature = "test-stubs")]
/// oakundo `UndoCommand`: vtable commands + multi commands (direct Rust
/// calls, single-lib unification).
#[test]
fn undo_command_roundtrip() {
use std::ffi::c_void;
use std::sync::atomic::{AtomicI32, Ordering};
use std::sync::Arc;
use oakundo::undocommand::{OakUndoCommandVtable, UndoCommand};
struct Closures {
redo: Box<dyn FnMut() + Send>,
undo: Box<dyn FnMut() + Send>,
}
unsafe extern "C" fn redo_thunk(ud: *mut c_void) {
let c = unsafe { &mut *(ud as *mut Closures) };
(c.redo)();
}
unsafe extern "C" fn undo_thunk(ud: *mut c_void) {
let c = unsafe { &mut *(ud as *mut Closures) };
(c.undo)();
}
unsafe extern "C" fn free_thunk(ud: *mut c_void) {
if !ud.is_null() {
unsafe { drop(Box::from_raw(ud as *mut Closures)) };
}
}
fn from_closures(
redo: impl FnMut() + Send + 'static,
undo: impl FnMut() + Send + 'static,
) -> UndoCommand {
let ud = Box::into_raw(Box::new(Closures {
redo: Box::new(redo),
undo: Box::new(undo),
}));
UndoCommand::from_vtable(
OakUndoCommandVtable {
redo: Some(redo_thunk),
undo: Some(undo_thunk),
free_fn: Some(free_thunk),
},
ud as *mut c_void,
)
}
let value = Arc::new(AtomicI32::new(0));
let value_redo = value.clone();
let value_undo = value.clone();
let value_check = value.clone();
let mut cmd = oaknode::bridge::undo::command_from_closures(
let mut cmd = from_closures(
move || {
value_redo.fetch_add(1, Ordering::SeqCst);
},
move || {
value_undo.fetch_sub(1, Ordering::SeqCst);
},
)
.expect("undo stub available");
);
// redo applies, undo reverts; redo_now is idempotent.
assert_eq!(
oaknode::bridge::undo::command_redo_now(cmd.clone()).unwrap(),
0
);
cmd.redo_now();
assert_eq!(value_check.load(Ordering::SeqCst), 1);
assert_eq!(
oaknode::bridge::undo::command_redo_now(cmd.clone()).unwrap(),
0
);
cmd.redo_now();
assert_eq!(
value_check.load(Ordering::SeqCst),
1,
"redo no-ops when done"
);
assert_eq!(
oaknode::bridge::undo::command_undo_now(cmd.clone()).unwrap(),
0
);
cmd.undo_now();
assert_eq!(value_check.load(Ordering::SeqCst), 0);
assert_eq!(
oaknode::bridge::undo::command_undo_now(cmd.clone()).unwrap(),
0
);
cmd.undo_now();
assert_eq!(
value_check.load(Ordering::SeqCst),
0,
@@ -413,8 +435,8 @@ fn undo_command_roundtrip() {
);
// Multi command batches children.
let mut multi = oaknode::bridge::undo::command_init_multi().unwrap();
let mut child = oaknode::bridge::undo::command_from_closures(
let mut multi = UndoCommand::multi();
let child = from_closures(
{
let value = value_check.clone();
move || {
@@ -427,26 +449,12 @@ fn undo_command_roundtrip() {
value.fetch_sub(1, Ordering::SeqCst);
}
},
)
.unwrap();
assert_eq!(
oaknode::bridge::undo::command_multi_add_child(multi.clone(), child.clone()).unwrap(),
0
);
assert_eq!(
oaknode::bridge::undo::command_redo_now(multi.clone()).unwrap(),
0
);
multi.multi_add_child(child);
multi.redo_now();
assert_eq!(value_check.load(Ordering::SeqCst), 1);
assert_eq!(
oaknode::bridge::undo::command_undo_now(multi.clone()).unwrap(),
0
);
multi.undo_now();
assert_eq!(value_check.load(Ordering::SeqCst), 0);
oaknode::bridge::undo::command_free(&mut cmd);
oaknode::bridge::undo::command_free(&mut multi);
oaknode::bridge::undo::command_free(&mut child);
}
/// track.rs: branch coverage the ffi contract tests leave open —
-29
View File
@@ -322,35 +322,6 @@ fn track_block_ordering() {
);
}
/// ClipBlock cache passthrough: the C ABI export accepts the call (the
/// cache UUID copy is inert until the oakrender bridge creates per-node
/// caches).
#[test]
fn clip_cache_passthrough() {
use oaknode::error::OAKNODE_OK;
use oaknode::ffi::block::oaknode_block_clip_create;
use oaknode::ffi::block::oaknode_block_free;
use oaknode::ffi::block::oaknode_clip_add_cache_passthrough_from;
use oaknode::ffi::project::oaknode_project_free;
use oaknode::ffi::project::oaknode_project_init;
use oaknode::handle::CHandle;
let mut p = unsafe { oaknode_project_init() };
let mut clip = unsafe { oaknode_block_clip_create() };
let mut other = unsafe { oaknode_block_clip_create() };
assert_eq!(
unsafe { oaknode_clip_add_cache_passthrough_from(clip.clone(), other.clone()) },
OAKNODE_OK
);
assert_eq!(
unsafe { oaknode_clip_add_cache_passthrough_from(CHandle::null(), other.clone()) },
oaknode::error::OAKNODE_E_INVALID
);
unsafe { oaknode_block_free(&mut clip) };
unsafe { oaknode_block_free(&mut other) };
unsafe { oaknode_project_free(&mut p) };
}
/// Footage behavior: state without a codec module (probe fails
/// gracefully without partial state); proxy fields, counts, duration.
#[test]