code wiki / (root) / nx_ts_dur.nx

nx_ts_dur.nx

buildroot/runtime/nx_ts_dur.nx

4510 B102 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic ts
docsdependenciesstructsconstsfunctions

about

nx_ts_dur.nx -- MPEG-TS total duration via FIRST + LAST PCR (no full-file scan; reads only an 8 MB window at each end). PCR lives in the adaptation field (afc>=2, PCR_flag bit 0x10), a 33-bit base clock @ 90 kHz. Also reports the PCR endpoints so the daemon can do proportional time<->byte seeking (byte ~= start + (T-first)/(last-first)*size). Usage: nx_ts_dur <in.ts> Prints: size=<n> first_pcr90=<n> last_pcr90=<n> dur_ms=<n>. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_vid_dur_lib.nx nx_ts_dur.nx

imports: nx_syscalls.nxnx_vid_dur_lib.nx

imported by: nobody (leaf or entry point)

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

main tp_p sys_write sys_openat_rd sys_lseek sys_mmap read_window sys_read vd_sniff sys_mmap ↻ vd_find vd_mp4_dur vd_find ↻ vd_u32 vd_u64 sys_close tp_n sys_mmap ↻ sys_write ↻ vd_mkv_dur sys_mmap ↻ vd_find ↻ vd_ieee64 vd_ieee32 scan_pcr

structs

none

consts

8const K_MAGIC_8589934592: i64 = 8589934592
10const WIN: 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 1: main calls 1: sys_write
13func tp_n(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
23func scan_pcr(buf: *u8, n: i64, fp: *i64, lp: *i64) -> i64
called by 1: main
46func read_window(fd: i64, buf: *u8, cap: i64) -> i64
called by 1: main calls 1: sys_read
52func main(argc: i64, argv: *i64) -> i64