code wiki / _hdl_build / nx_galx_durbin_lib.nx
nx_galx_durbin_lib.nx
buildroot/runtime/_hdl_build/nx_galx_durbin_lib.nx
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
imports: nx_syscalls.nx
imported by: nx_gallery_serve.nxnx_galx_durbin.nxnx_galx_durbin_gate.nx
structs
| none |
consts
| 10 | const K_MAGIC_86400000: i64 = 86400000 |
functions
| 12 | func db_wb64(b: *u8, o: i64, v: i64) -> i64 called by 1: db_build |
| 17 | func db_rb64(b: *u8, o: i64) -> i64 |
| 21 | func db_qint(buf: *u8, ls: i64, le: i64, needle: *u8, nlen: i64) -> i64 called by 1: db_build |
| 37 | func db_build(raw_path: *u8, bin_path: *u8, vps: i64) -> i64 |
| 73 | func db_emit_u(out: *u8, o: i64, v: i64) -> i64 |
| 85 | func db_batch_durs(out: *u8, ids: *u8, bin_path: *u8, cur_vps: i64) -> i64 |
| 122 | func db_lookup(bin_path: *u8, id: i64, cur_vps: i64) -> i64 |