code wiki / _hdl_build / nx_galx_durbin_lib.nx

nx_galx_durbin_lib.nx

buildroot/runtime/_hdl_build/nx_galx_durbin_lib.nx

7048 B134 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic galx
docsdependenciesstructsconstsfunctions

about

nx_galx_durbin_lib.nx -- O(1) duration lookup for the gallery .ts seekbar. Compacts galx_dur.raw (text "size=.. dur_ms=<n>" per line, line N = recording N) into galx_dur.bin: a big-endian header [vidpaths_size(8)][n(8)] followed by n*[dur_ms(8)]. Then /vid/<id>/dur is ONE 8-byte seek+read instead of a 16 MB PCR re-scan. Mirrors gs_vidoff_build / galx_vid_off.bin exactly. The durindex is APPEND-ONLY (line N's duration is written once and never changes), so a .bin built from the first n lines stays correct for every id < n -- the file can keep growing under us without invalidating earlier entries. vidpaths_size guards against galx_vid_paths.tsv changing (line N -> a different video); on mismatch or a not-yet-indexed id we return -1 and the caller falls back to the live PCR scan. no main. license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_galx_durbin_lib.nx nx_gallery_serve.nx nx_galx_durbin.nx nx_galx_durbin_gate.nx

imports: nx_syscalls.nx

imported by: nx_gallery_serve.nxnx_galx_durbin.nxnx_galx_durbin_gate.nx

structs

none

consts

10const K_MAGIC_86400000: i64 = 86400000

functions

12func db_wb64(b: *u8, o: i64, v: i64) -> i64
called by 1: db_build
17func db_rb64(b: *u8, o: i64) -> i64
21func db_qint(buf: *u8, ls: i64, le: i64, needle: *u8, nlen: i64) -> i64
called by 1: db_build
37func db_build(raw_path: *u8, bin_path: *u8, vps: i64) -> i64
73func db_emit_u(out: *u8, o: i64, v: i64) -> i64
called by 1: db_batch_durs calls 1: sys_mmap
85func db_batch_durs(out: *u8, ids: *u8, bin_path: *u8, cur_vps: i64) -> i64
122func db_lookup(bin_path: *u8, id: i64, cur_vps: i64) -> i64