code wiki / (root) / nx_ts_probe.nx

nx_ts_probe.nx

buildroot/runtime/nx_ts_probe.nx

10858 B187 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind probetopic ts
docsdependenciesstructsconstsfunctions

about

nx_ts_probe.nx -- Rung 1 of the sovereign MPEG-TS -> fMP4 remuxer. Parses an MPEG-TS file (188-byte packets), reads PAT -> PMT -> elementary-stream table, identifies the video PID + codec, reassembles the video PES into an Annex-B elementary stream, and scans it for NAL units (SPS=7 / PPS=8 / IDR=5). Reports what it finds so we can confirm H.264 before building the MP4 muxer. NishiLang only, no ffmpeg. Usage: nx_ts_probe <file.ts> (default = first recording in the vid index). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_ts_probe.nx

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

main sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close tp_p sys_write sys_exit sys_openat_rd ↻ sys_read ↻ sys_close ↻ tp_hex sys_mmap ↻ sys_write ↻ tp_n sys_mmap ↻ sys_write ↻ tp_rate tp_p ↻

structs

none

consts

7const K_MAGIC_2048: i64 = 2048
9const TSREAD: i64 = 8388608 // probe the first 8 MB (PAT/PMT + plenty of video to find SPS/PPS/IDR)
10const ESCAP: i64 = 8388608

functions

12func tp_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: tp_ratemain calls 1: sys_write
13func tp_n(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;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 }
called by 1: main calls 2: sys_mmapsys_write
14func tp_hex(v: i64) -> i64 { let h: *u8="0123456789abcdef" as *u8; let b: *u8=sys_mmap(4); b[0]=h[(v>>4)&0xf]; b[1]=h[v&0xf]; sys_write(1,b,2); return 0 }
called by 1: main calls 2: sys_mmapsys_write
15func tp_rate(idx: i64) -> i64
called by 1: main calls 1: tp_p
31func main(argc: i64, argv: *i64) -> i64