code wiki / _hdl_build / nx_m4b_book.nx

nx_m4b_book.nx

buildroot/runtime/_hdl_build/nx_m4b_book.nx

7548 B121 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_m4b_book.nx -- SOVEREIGN M4B / M4A / MP4 audiobook -> Nishi format (@kind=audio). The other common audiobook container (iTunes/Audible-non-DRM). MP4 = a tree of atoms (size:u32be + type:4 + payload); iTunes metadata is at moov/udta/meta/ilst/<©nam title|©ART artist/narrator|©alb album>/data. meta is a FULLBOX (4 version/flags bytes before its children). Carries the audio bytes through unchanged (no codec) -> audio.json + track0.m4b -> .nmz. Emits the SAME audio.json schema as nx_audio_book (rung 2 = unify both into one dispatching audio liberator). LEGAL LINE: liberates DRM-FREE M4B; Audible .aax/.aaxc DRM would be detected + declined (not built yet -- M4B itself is DRM-free). Usage: nx_m4b_book <m4b-path> <slug>. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_m4b_book.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main do_m4b sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ab_p ab_w sys_write ab_slen atom_type_eq find_atom be32 atom_type_eq ↻ mp4_value sys_mmap ↻ find_atom ↻ ensure_dir er_cat sys_openat_wr sys_write ↻ sys_close ↻ ab_w ↻ er_wjson sys_write ↻ ab_n nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap ab_pn ab_n ↻ ab_p ↻ sys_exit

structs

none

consts

10const K_MAGIC_1024: i64 = 1024

functions

12func ab_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: ab_w
13func ab_w(fd: i64, s: *u8) -> i64 { sys_write(fd, s, ab_slen(s)); return 0 }
called by 2: ab_pdo_m4b calls 2: sys_writeab_slen
18func ab_n(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 2: ab_pndo_m4b calls 1: nxi_fd
19func ab_p(s: *u8) -> i64 { ab_w(1, s); return 0 }
called by 2: do_m4bmain calls 1: ab_w
20func ab_pn(v: i64) -> i64 { ab_n(1, v); return 0 }
called by 1: do_m4b calls 1: ab_n
21func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 }
called by 1: do_m4b
22func er_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i }
called by 1: do_m4b
23func be32(b: *u8, o: i64) -> i64 { return ((b[o] as i64)<<24)|((b[o+1] as i64)<<16)|((b[o+2] as i64)<<8)|(b[o+3] as i64) }
called by 1: find_atom
24func er_wjson(fd: i64, s: *u8) -> i64
called by 1: do_m4b calls 1: sys_write
29func atom_type_eq(z: *u8, o: i64, t: *u8) -> i64 { if z[o+4]!=t[0]{return 0} if z[o+5]!=t[1]{return 0} if z[o+6]!=t[2]{return 0} if z[o+7]!=t[3]{return 0} return 1 }
called by 2: find_atomdo_m4b
31func find_atom(z: *u8, start: i64, end: i64, t: *u8, ps: *i64, pe: *i64) -> i64
called by 2: mp4_valuedo_m4b calls 2: be32atom_type_eq
45func mp4_value(z: *u8, ilst_s: i64, ilst_e: i64, t: *u8, out: *u8, cap: i64) -> i64
called by 1: do_m4b calls 2: sys_mmapfind_atom
55func do_m4b(path: *u8, slug: *u8) -> i64
114func main(argc: i64, argv: *i64) -> i64