code wiki / (root) / nx_mp4_faststart_gate.nx

nx_mp4_faststart_gate.nx

buildroot/runtime/nx_mp4_faststart_gate.nx

9477 B150 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic mp4
docsdependenciesstructsconstsfunctions

about

nx_mp4_faststart_gate.nx -- proves the qt-faststart remux is byte-correct: constructs a synthetic NON-faststart mp4 ([ftyp][mdat][moov>trak>mdia>minf>stbl>stco]) with a known chunk offset, forks the real nx_mp4_faststart.sov.elf on it, and asserts the output is [ftyp][moov][mdat] with the stco offset rewritten by +moov_size. A remuxer that silently corrupts offsets = broken video, so this gate is the liar-killer: T-neg replays a WRONG shift (0) and REQUIRES the check to fail. MIGRATED 2026-09-02 onto nx_gate_verdict (D001): every tooth is a named gv_check, the missing-elf case is a gv_need precondition (SKIP, never RED -- "could not look" is not "broken"), and /api/gate_run reads the verdict from the exit code. The teeth and their fixtures are unchanged; the hand-rolled pass/total line is gone. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_mp4_faststart_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ sys_mmap ↻ g_build g_p32 g_t sys_openat_wr sys_write ↻ sys_close g_run_elf sys_mmap ↻ sys_openat_rd sys_close ↻ sys_openat_wr ↻ sys_fork sys_dup3 sys_execve sys_exit ↻ sys_wait4 gv_need gv_puts ↻ gv_verdict

structs

none

consts

13const G_TEST: *u8 = "/tmp/_fs_gate_in.mp4"
14const G_OUT: *u8 = "/tmp/_fs_gate_out.mp4"
15const G_LOG: *u8 = "knowledge/status/mp4_faststart_gate.log"

functions

17func g_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
calls 1: sys_write
18func g_be32(b: *u8, o: i64) -> i64 { return ((b[o] as i64)<<24)|((b[o+1] as i64)<<16)|((b[o+2] as i64)<<8)|(b[o+3] as i64) }
called by 1: main
19func g_p32(b: *u8, o: i64, v: i64) -> i64 { b[o]=((v>>24)&0xff) as u8; b[o+1]=((v>>16)&0xff) as u8; b[o+2]=((v>>8)&0xff) as u8; b[o+3]=(v&0xff) as u8; return 0 }
called by 2: g_buildg_build_co64
20func g_t(b: *u8, o: i64, t: *u8) -> i64 { var i: i64=0; while i<4 { b[o+i]=t[i]; i=i+1 } return 0 }
called by 2: g_buildg_build_co64
21func g_teq(b: *u8, o: i64, t: *u8) -> i64 { var i: i64=0; while i<4 { if b[o+i]!=t[i] { return 0 } i=i+1 } return 1 }
called by 1: main
22func g_ck(name: *u8, c: i64, ctr: *i64) -> i64 { gv_check(name, c == 1, ctr); return c }
called by 1: main calls 1: gv_check
25func g_build(b: *u8, chunk_off: i64) -> i64
called by 1: main calls 2: g_p32g_t
40func g_p64(b: *u8, o: i64, v: i64) -> i64 { var i: i64=0; while i<8 { b[o+7-i]=((v>>(i*8))&0xff) as u8; i=i+1 } return 0 }
called by 1: g_build_co64
41func g_be64(b: *u8, o: i64) -> i64 { var v: i64=0; var i: i64=0; while i<8 { v=(v<<8)|(b[o+i] as i64); i=i+1 } return v }
called by 1: main
44func g_build_co64(b: *u8, chunk_off: i64) -> i64
called by 1: main calls 3: g_p32g_tg_p64
57func g_run_elf(inp: *u8, outp: *u8) -> i64
87func main() -> i64