code wiki / (root) / nx_galx_durindex.nx

nx_galx_durindex.nx

buildroot/runtime/nx_galx_durindex.nx

7674 B144 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic galx
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_itoa_lib.nx nx_vid_dur_lib.nx nx_galx_durindex.nx

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

main di_p sys_write di_atoi sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close di_done_lines sys_mmap ↻ sys_read_file ↻ di_n nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_openat_wr sys_flock sys_openat_append extract_dur sys_openat_rd ↻ sys_lseek ↻ read_window sys_read ↻ vd_sniff sys_mmap ↻ vd_find vd_mp4_dur vd_find ↻ vd_u32 vd_u64 vd_mkv_dur sys_mmap ↻ vd_find ↻ vd_ieee64

structs

none

consts

12const K_MAGIC_8589934592: i64 = 8589934592
13const K_MAGIC_2048: i64 = 2048
15const WIN: i64 = 8388608

functions

17func 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 }
called by 1: main calls 1: sys_write
22func di_n(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
23func 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
24func 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
25func di_bn(buf: *u8, off: i64, v: i64) -> i64
called by 1: extract_dur calls 1: sys_mmap
35func di_done_lines(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
43func read_window(fd: i64, buf: *u8, cap: i64) -> i64
called by 1: extract_dur calls 1: sys_read
49func scan_pcr(buf: *u8, n: i64, fp: *i64, lp: *i64) -> i64
called by 1: extract_dur
66func extract_dur(path: *u8, buf: *u8, line: *u8, fp: *i64, lp: *i64) -> i64
95func main(argc: i64, argv: *i64) -> i64