nx_uxf_remux_test.nx
buildroot/runtime/nx_uxf_remux_test.nx
about
nx_uxf_remux_test.nx -- UXF arc #2 (real remux), rung 3: the remux DATA-FLOW, end to end.
Parses a SimpleBlock's frame bytes out of an EBML element (the MKV input side) and carries those
EXACT bytes into an MP4 mdat box, recording the sample size in a stsz box (the MP4 output side).
Proves the remux EXECUTES LOSSLESSLY at the byte level -- the frame is rewrapped, not re-encoded
(the cheap path B's negotiation selects). Composes the rung-1 (mp4box) + rung-2 (ebml) primitives
(inlined here for a self-contained proof).
HONEST SCOPE: one frame, flat structure -- proves the parse->carry->write DATA PATH. A fully
spec-complete *playable* MKV->MP4 (real SimpleBlock header decode, multi-frame/track sample
tables stts/stsc/stco, codec-private in stsd, timestamps, proper moov nesting) is the next rung.
No hardware writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 14 | func r_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 15 | func r_putn(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 - m; sys_write(1, "-" as *u8, 1) } let t: *u8 = sys_mmap(28); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 } sys_write(1, bb, k); return 0 } |
| 18 | func ev_len(b: i64) -> i64 |
| 29 | func ev_id(buf: *u8, pos: *i64) -> i64 |
| 39 | func ev_size(buf: *u8, pos: *i64) -> i64 |
| 51 | func mw32(out: *u8, off: i64, v: i64) -> i64 { out[off] = ((v >> 24) & 0xff) as u8; out[off + 1] = ((v >> 16) & 0xff) as u8; out[off + 2] = ((v >> 8) & 0xff) as u8; out[off + 3] = (v & 0xff) as u8; return off + 4 } |
| 52 | func mr32(buf: *u8, off: i64) -> i64 { return ((buf[off] as i64) * 16777216) + ((buf[off + 1] as i64) * 65536) + ((buf[off + 2] as i64) * 256) + (buf[off + 3] as i64) } |
| 53 | func m4cc(out: *u8, off: i64, a: i64, b: i64, c: i64, d: i64) -> i64 { out[off] = a as u8; out[off + 1] = b as u8; out[off + 2] = c as u8; out[off + 3] = d as u8; return off + 4 } |
| 54 | func mbegin(out: *u8, off: i64, a: i64, b: i64, c: i64, d: i64) -> i64 { mw32(out, off, 0); m4cc(out, off + 4, a, b, c, d); return off + 8 } |
| 55 | func mend(out: *u8, start: i64, cur: i64) -> i64 { mw32(out, start, cur - start); return cur } |
| 56 | func mcopy(out: *u8, off: i64, src: *u8, srcoff: i64, n: i64) -> i64 { var i: i64 = 0; while i < n { out[off + i] = src[srcoff + i]; i = i + 1 } return off + n } called by 1: main |
| 57 | func mwalk(buf: *u8, n: i64) -> i64 { var off: i64 = 0; while (off + 8) <= n { let sz: i64 = mr32(buf, off); if sz < 8 { return 0 } off = off + sz } if off == n { return 1 } return 0 } |
| 58 | func beq(a: *u8, aoff: i64, b: *u8, boff: i64, n: i64) -> i64 { var i: i64 = 0; while i < n { if a[aoff + i] != b[boff + i] { return 0 } i = i + 1 } return 1 } called by 1: main |
| 60 | func main() -> i64 |