nx_galx_durindex.nx
buildroot/runtime/nx_galx_durindex.nx
about
nx_galx_durindex.nx -- build the per-recording DURATION index so the gallery can SORT BY RUNTIME for
EVERY format. IN-PROCESS extraction (no per-video fork): for each path it reads the header window and
derives the duration directly -- mp4/mov via moov->mvhd, mkv/webm via EBML Duration (nx_vid_dur_lib),
MPEG-TS via first/last PCR. Writes "size=<n> first_pcr90=<n> last_pcr90=<n> dur_ms=<n>" per line, line N =
recording N, then nx_galx_sortindex's reader parses dur_ms=. SEQUENTIAL, RESUMABLE (skips already-written
lines), IDEMPOTENT. (The old fork-nx_ts_dur design silently captured ZERO on this NAS volume; in-process
direct writes fix it.) usage: nx_galx_durindex <vid_paths.tsv> <unused> <out_dur.raw> [limit=0]
license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.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
structs
| none |
consts
| 12 | const K_MAGIC_8589934592: i64 = 8589934592 |
| 13 | const K_MAGIC_2048: i64 = 2048 |
| 15 | const WIN: i64 = 8388608 |
functions
| 17 | func di_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 22 | func di_n(v: i64) -> i64 { nxi_out(v); return 0 } |
| 23 | func di_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8) { let c: i64=s[i] as i64; if c<48 { return v } if c>57 { return v } v=v*10+(c-48); i=i+1 } return v } called by 1: main |
| 24 | func di_bcat(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8) { buf[off+i]=s[i]; i=i+1 } return off+i } called by 1: extract_dur |
| 25 | func di_bn(buf: *u8, off: i64, v: i64) -> i64 |
| 35 | func di_done_lines(path: *u8) -> i64 |
| 43 | func read_window(fd: i64, buf: *u8, cap: i64) -> i64 |
| 49 | func scan_pcr(buf: *u8, n: i64, fp: *i64, lp: *i64) -> i64 called by 1: extract_dur |
| 66 | func extract_dur(path: *u8, buf: *u8, line: *u8, fp: *i64, lp: *i64) -> i64 |
| 95 | func main(argc: i64, argv: *i64) -> i64 |