code wiki / _hdl_build / nx_movie_probe.nx
nx_movie_probe.nx
buildroot/runtime/_hdl_build/nx_movie_probe.nx
about
nx_movie_probe.nx -- MOVIE LIVENESS PROBE (operator 2026-07-04: "broken movies where i cant see the start,
finish, chapters, the dead air, the performance"). The video rung of the media-liveness plane (serving != working).
A SOVEREIGN ISO-BMFF (MP4/M4V/MOV) box parser: reads ONLY the small `moov` metadata box (seeks past the huge
`mdat` -- never loads GB of media) and reports: structural completeness (ftyp/moov/mdat present, not truncated),
duration (start->finish), video WxH + codec, audio presence + codec, chapters, embedded cover(thumbnail), fast-
start(moov-before-mdat = seekable/streamable), and bitrate (performance). Verdict OK|DEGRADED|BROKEN.
HONEST SCOPE: MKV/WebM(EBML) detected + flagged as a TODO rung; true DEAD-AIR(silence) + keyframe-thumbnail-gen
need audio/H.264 DECODE (separate rungs) -- we report hasAudio + hasThumbnail, not silence spans. license_tier: ORIGINAL
expect_exit: 0
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
| 11 | const R_MAGIC_4096: i64 = 4096 |
| 12 | const R_MAGIC_8192: i64 = 8192 |
| 13 | const R_MAGIC_67108864: i64 = 67108864 |
| 14 | const R_MAGIC_2048: i64 = 2048 |
| 15 | const R_MAGIC_1048576: i64 = 1048576 |
| 16 | const R_MAGIC_4095: i64 = 4095 |
| 17 | const R_MAGIC_1048000: i64 = 1048000 |
| 20 | const R_TS: i64=0 const R_DUR: i64=1 const R_W: i64=2 const R_H: i64=3 |
| 21 | const R_VID: i64=4 const R_AUD: i64=5 const R_VCC: i64=6 const R_ACC: i64=7 |
| 22 | const R_CHP: i64=8 const R_COVR: i64=9 const R_NTRAK: i64=10 const R_FTYP: i64=11 |
| 23 | const R_MOOV: i64=12 const R_MDAT: i64=13 const R_TRUNC: i64=14 const R_FAST: i64=15 |
| 24 | const R_SIZE: i64=16 const R_MKV: i64=17 const R_MOOVSZ: i64=18 const R_POSTER: i64=19 |
| 25 | const R_TSFMT: i64=20 const R_FLV: i64=21 |
functions
| 27 | func pw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 28 | func pn(v: i64) -> i64 { let b: *u8=sys_mmap(24); var m: i64=v; if m<0{pw("-" as *u8);m=0-m} let t: *u8=sys_mmap(24); 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{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } |
| 29 | func p4(buf: *u8, o: i64) -> i64 { sys_write(1,(buf as i64+o) as *u8,4); return 0 } calls 1: sys_write |
| 30 | func be32(buf: *u8, o: i64) -> i64 { return ((buf[o] as i64)<<24)|((buf[o+1] as i64)<<16)|((buf[o+2] as i64)<<8)|(buf[o+3] as i64) } |
| 31 | func be64(buf: *u8, o: i64) -> i64 { return (be32(buf,o)<<32)|be32(buf,o+4) } |
| 32 | func fcc(buf: *u8, o: i64, a: i64, b: i64, c: i64, d: i64) -> i64 { if (buf[o] as i64)!=a {return 0} if (buf[o+1] as i64)!=b {return 0} if (buf[o+2] as i64)!=c {return 0} if (buf[o+3] as i64)!=d {return 0} return 1 } |
| 33 | func sys_lseek(fd: i64, off: i64, whence: i64) -> i64 { return __syscall(8, fd, off, whence, 0, 0, 0) } |
| 34 | func mp_read_at(fd: i64, off: i64, buf: *u8, n: i64) -> i64 |
| 41 | func mp_iscontainer(buf: *u8, o: i64) -> i64 |
| 54 | func mp_find(buf: *u8, start: i64, end: i64, a: i64, b: i64, c: i64, d: i64, depth: i64) -> i64 |
| 76 | func mp_trak(buf: *u8, start: i64, end: i64, res: *i64) -> i64 |
| 100 | func mp_probe_moov(buf: *u8, moovlen: i64, res: *i64) -> i64 |
| 124 | func mp_probe(path: *u8, res: *i64) -> i64 |
| 184 | func mp_has_poster(path: *u8) -> i64 |
| 193 | func mp_vstr(v: i64) -> *u8 { if v==2 {return "OK"} if v==1 {return "DEGRADED"} return "BROKEN" } |
| 195 | func mp_p4(v: i64) -> i64 { if v==0 { pw("-" as *u8); return 0 } let b: *u8=sys_mmap(4); b[0]=((v>>24)&0xff) as u8; b[1]=((v>>16)&0xff) as u8; b[2]=((v>>8)&0xff) as u8; b[3]=(v&0xff) as u8; sys_write(1,b,4); return 0 } |
| 198 | func mp_js(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o } called by 1: mp_sweep |
| 200 | func mp_dec(dst: *u8, o: i64, v: i64) -> i64 { var m: i64=v; if m<0{dst[o]=45 as u8;o=o+1;m=0-m} let t: *u8=sys_mmap(24); 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{dst[o]=t[k-1-i];o=o+1;i=i+1} return o } |
| 202 | func mp_jesc(dst: *u8, o: i64, s: *u8, cap: i64) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c==34 { if o<cap-2 {dst[o]=92 as u8;dst[o+1]=34 as u8;o=o+2} } else { if c==92 { if o<cap-2 {dst[o]=92 as u8;dst[o+1]=92 as u8;o=o+2} } else { if c>=32 { if o<cap-1 {dst[o]=s[i] as u8;o=o+1} } } } i=i+1 } return o } called by 1: mp_sweep |
| 206 | func mp_sweep(catalog: *u8, outpath: *u8, max: i64) -> i64 |
| 267 | func main(argc: i64, argv: *i64) -> i64 |