code wiki / _hdl_build / nx_nv1.nx

nx_nv1.nx

buildroot/runtime/_hdl_build/nx_nv1.nx

4946 B130 linesdepth 2pulls 2 transitivereach 23 importersview sourcekind librarytopic nv1
docsdependenciesstructsconstsfunctions

about

nx_nv1.nx -- NishiLossless v1 (NLC1) circle container: writer + validator. The named exceed rung from the video session: circles recorded LOSSLESSLY (Int16 PCM at the device's NATIVE rate -- the same no-resample doctrine as live call audio) + JPEG frames, in OUR OWN container. MediaRecorder/webm/ opus is gone from the record path. The browser client (app.js nv1Pack/ nv1Parse) implements this same format; THIS module is the team-side authority: the gate proves the format, and the daemon can later validate uploads server-side with nv1_validate. Format (all little-endian): header (24B): "NLC1" | u32 version=1 | u32 sample_rate | u32 channels=1 | u32 reserved | u32 reserved chunk (9B + payload): u8 kind | u32 len | u32 t_ms | payload kind 0x41 'A': Int16 PCM mono (len bytes = 2*samples), t_ms derived from the running SAMPLE COUNT (sample-exact, not clock) kind 0x56 'V': one JPEG frame, t_ms = capture time kind 0x4C 'L': LPC-compressed Int16 PCM (see nx_nv1_lpc.nx; payload starts u8 mode | u8 k | u32 nsamples), counts toward audio chunks + total samples like 'A' kind 0x45 'E': terminator, len MUST be 0, t_ms = total duration The terminator must be the FINAL bytes of the container (no trailing). FLAC-class LPC compression of the PCM (the named next rung) now lives in nx_nv1_lpc.nx as chunk kind 'L'; 'A' remains valid (raw path + back-compat). license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_nv1.nx nx_nv1_gate.nx nx_nv1_lpc.nx nx_sites_daemon_v2.nx

imports: nx_syscalls.nx

imported by: nx_nv1_gate.nxnx_nv1_lpc.nxnx_sites_daemon_v2.nx

structs

none

consts

29const NV1_MAGIC_65536: i64 = 65536
30const NV1_MAGIC_16777216: i64 = 16777216
32const NV1_HDR: i64 = 24
33const NV1_CHDR: i64 = 9

functions

35func nv1_rd_u32(b: *u8, off: i64) -> i64
43func nv1_wr_u32(b: *u8, off: i64, v: i64) -> i64
51func nv1_write_header(out: *u8, rate: i64) -> i64
called by 3: mainmainmain calls 1: nv1_wr_u32
62func nv1_write_chunk(out: *u8, w: i64, kind: i64, t_ms: i64, payload: *u8, n: i64) -> i64
called by 4: mainmainmainmain calls 1: nv1_wr_u32
71func nv1_write_end(out: *u8, w: i64, dur_ms: i64) -> i64
called by 4: mainmainmainmain calls 1: nv1_wr_u32
85func nv1_validate(buf: *u8, n: i64, info: *i64) -> i64