code wiki / (root) / nx_hls_parse.nx

nx_hls_parse.nx

buildroot/runtime/nx_hls_parse.nx

9271 B184 linesdepth 3pulls 3 transitivereach 20 importersview sourcekind tooltopic hls
docsdependenciesstructsconstsfunctions

about

nx_hls_parse.nx -- X-DLP rung 0: the sovereign HLS (.m3u8) manifest PARSER. The FLOOR of yt-dlp-class media download: an HLS stream is described by an M3U8 playlist (RFC 8216). A MASTER playlist lists variant streams (#EXT-X-STREAM-INF:BANDWIDTH=... then a variant URI); a MEDIA playlist lists segments (#EXTINF:<dur>, then a segment URI). This parser walks the text (no JS, no curl) into a flat entry table the downloader then fetches via the already-sovereign h2/https client. Non-JS path = independent of the JS engine. API: nx_hls_parse(buf, len, out, max_entries, meta) -> entry_count (>=0), or -1 if the text is not a valid playlist (missing #EXTM3U header -- tamper-honest). out[i*3+0] = URI start offset in buf out[i*3+1] = URI byte length out[i*3+2] = value: segment DURATION in millis (media) OR BANDWIDTH bps (master) meta[0] = is_master (0|1) meta[1] = target_duration sec meta[2] = count meta[3] = version GATE (main): KATs parse a real MEDIA playlist (3 segments, durations) + a MASTER playlist (2 variants, bandwidths) + a TAMPER case (non-m3u8 -> -1, never faked). license_tier: ORIGINAL (sovereign text STATE_MACHINE; team re-authors from the spec).

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_itoa_lib.nx nx_hls_parse.nx nx_hls_resolve.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nx_hls_resolve.nx

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

main hp_puts sys_write sys_mmap nx_hls_parse hls_starts hls_line_end hls_parse_dur_millis hls_find hls_slen hls_parse_uint hp_slen hp_uri_eq hp_slen ↻ hp_putn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_exit

structs

none

consts

none

functions

23func hls_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: hls_find
24func hls_line_end(buf: *u8, len: i64, p: i64) -> i64 { var e: i64 = p; while e < len { if buf[e] == (10 as u8) { return e } e = e + 1 } return e }
called by 1: nx_hls_parse
25func hls_starts(buf: *u8, len: i64, p: i64, lit: *u8) -> i64
called by 1: nx_hls_parse
34func hls_parse_uint(buf: *u8, len: i64, p: i64) -> i64
called by 1: nx_hls_parse
45func hls_parse_dur_millis(buf: *u8, len: i64, p: i64) -> i64
called by 1: nx_hls_parse
67func hls_find(buf: *u8, from: i64, to: i64, lit: *u8) -> i64
81func nx_hls_parse(buf: *u8, len: i64, out: *i64, max_entries: i64, meta: *i64) -> i64
121func hp_puts(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
126func hp_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
127func hp_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: hp_uri_eqmain
129func hp_uri_eq(buf: *u8, out: *i64, k: i64, want: *u8) -> i64
called by 1: main calls 1: hp_slen
137func main() -> i64