nx_hls_parse.nx
buildroot/runtime/nx_hls_parse.nx
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
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
structs
| none |
consts
| none |
functions
| 23 | func 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 |
| 24 | func 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 |
| 25 | func hls_starts(buf: *u8, len: i64, p: i64, lit: *u8) -> i64 called by 1: nx_hls_parse |
| 34 | func hls_parse_uint(buf: *u8, len: i64, p: i64) -> i64 called by 1: nx_hls_parse |
| 45 | func hls_parse_dur_millis(buf: *u8, len: i64, p: i64) -> i64 called by 1: nx_hls_parse |
| 67 | func hls_find(buf: *u8, from: i64, to: i64, lit: *u8) -> i64 |
| 81 | func nx_hls_parse(buf: *u8, len: i64, out: *i64, max_entries: i64, meta: *i64) -> i64 |
| 121 | func 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 } |
| 126 | func hp_putn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 127 | func hp_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 129 | func hp_uri_eq(buf: *u8, out: *i64, k: i64, want: *u8) -> i64 |
| 137 | func main() -> i64 |