A payload carries its own tables, so a fully valid 3 KB WIV1 decodes a 2^30-byte clip, and a 384-byte WIA1 held gigabytes to present one sample. The stream's length does not bound the work; the header does, within the caps, and a sink applies its own size policy before decoding. - int_payload::declared_cost(cap, payload, params): the output bytes, the symbols, and the most bytes the reference decode holds at once beside the payload and the parsed set, from the header and the set's layer geometry, with the refusals a decode gives before its first symbol. container::declared_size reads the header alone (no feature, no set); the C ABI has wai_int_payload_declared (wai_int_declared_t) and wai-web intPayloadCost. - Each decoder's pre-decode checks are one plan function the decode and the cost share (cond_plan, audio_plan, splat_plan, int_video::check); networks are planned with their live buffer sizes (plan_net). Latents and frames grow to their declared size and no further, and spent buffers are dropped, so the declared figure is what the decode holds. - WIA1: the latent must be the one t_out needs: the synthesis of lat_len gives at least t_out samples and that of lat_len - 1 fewer (geometry_mismatch). Fixture wia1_latent_too_long. - integer-payloads.md §7 states the bound: output, symbols and buffers with their bytes per element, read before decoding; a short stream stops at its first missing symbol; a sink's policy refuses past what it will spend. The claim that work grows with what a stream carries is gone, here and in the CHANGELOG. Tests: tests/int_payload_cost.rs (own binary, live-bytes allocator; CI fast-kernel steps): the declared working bytes bound what each committed decode holds and equal it for keyframe-0 WIV1, including, in release, the 3 KB clip at the cap (declared and held both 1073445624 bytes); tests/int_payload_preflight.rs refuses the reviewer's 384-byte WIA1 (geometry_mismatch, before a symbol, and by declared_cost); ffi_envelope::int_payload_declared_reads_the_header; wai-web the_declared_cost_is_read_before_decoding. Co-Authored-By: Claude Opus 5.5 <[email protected]>
50 lines
1.5 KiB
TOML
50 lines
1.5 KiB
TOML
# cbindgen config — generates include/wai.h from the FFI surface in
|
|
# src/ffi.rs and the public constants in src/lib.rs. The header is
|
|
# committed so SDK consumers can browse without building the crate.
|
|
|
|
language = "C"
|
|
include_guard = "WAI_H"
|
|
pragma_once = true
|
|
cpp_compat = true
|
|
documentation = true
|
|
documentation_style = "doxy"
|
|
header = """
|
|
/*
|
|
* WAI — Web AI media transport + execution.
|
|
*
|
|
* Auto-generated by cbindgen from src/ffi.rs. DO NOT EDIT — regenerate
|
|
* by rebuilding `wai-rs` (the build.rs runs cbindgen) or by running
|
|
* cbindgen --config cbindgen.toml --crate wai --output include/wai.h
|
|
*
|
|
* SDK contract:
|
|
* - Every `wai_*` function returns a `wai_status_t` (typedef int).
|
|
* 0 = ok; non-zero = see WAI_ERR_* below + wai_last_error().
|
|
* - Any `WaiBuffer` written into an out parameter MUST be freed via
|
|
* `wai_buffer_free`. Passing a zero-cap buffer to free is safe.
|
|
* - `wai_last_error()` returns a NUL-terminated UTF-8 string that is
|
|
* valid until the next wai_* call on the same thread.
|
|
*
|
|
* Build the library:
|
|
* cargo build --release # produces libwai.{so,dylib,a}
|
|
* Link with:
|
|
* gcc your.c -lwai # static or dynamic per linker
|
|
*/
|
|
"""
|
|
|
|
[parse]
|
|
parse_deps = false
|
|
|
|
[export]
|
|
prefix = ""
|
|
# Only export items whose names start with `wai_` or `WAI_` — keeps
|
|
# internal helpers out of the public C surface.
|
|
[export.rename]
|
|
"WaiBuffer" = "wai_buffer_t"
|
|
"WaiDecoded" = "wai_decoded_t"
|
|
"WaiIntDeclared" = "wai_int_declared_t"
|
|
|
|
[fn]
|
|
prefix = ""
|
|
|
|
[enum]
|
|
prefix_with_name = false
|