code wiki / (root) / nx_uxf_negotiate.nx

nx_uxf_negotiate.nx

buildroot/runtime/nx_uxf_negotiate.nx

4354 B96 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic uxf
docsdependenciesstructsconstsfunctions

about

nx_uxf_negotiate.nx -- UXF arc B: ENDPOINT-ADAPTIVE capability negotiation -- "never a walled garden, serve what the endpoint can consume" (Law-1/2). Given a stored media asset's self-describing profile {container, vcodec, acodec} and an endpoint's declared capabilities (data-driven, knowledge/registry/endpoint_caps.tsv), decide the EMIT PLAN: DIRECT -- endpoint supports container + both codecs -> serve bytes unchanged. REMUX -- both CODECS supported but CONTAINER not -> rewrap losslessly (NO re-encode). This is the real "Chrome can't play MKV" fix: H.264/AAC-in-MKV -> MP4, lossless. TRANSCODE -- a codec is unsupported -> must re-encode (lossy/expensive) -- the heavy downstream. HONEST SCOPE: this organ builds + proves the PLAN (the negotiation). The actual remux/transcode EXECUTION (container rewrap, codec re-encode) is the named heavy downstream, NOT faked here. No hardware writes (Rule 26). license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_uxf_negotiate.nx nx_uxf_media_asset_test.nx nx_uxf_negotiate_test.nx

imports: nx_syscalls.nx

imported by: nx_uxf_media_asset_test.nxnx_uxf_negotiate_test.nx

structs

none

consts

14const PLAN_DIRECT: i64 = 0
15const PLAN_REMUX: i64 = 1
16const PLAN_TRANSCODE: i64 = 2

functions

18func ng_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
21func ng_csv_has(list: *u8, token: *u8) -> i64
called by 1: ng_negotiate calls 1: ng_slen
45func ng_streq_slice(buf: *u8, a: i64, b: i64, z: *u8) -> i64
called by 1: ng_caps_lookup calls 1: ng_slen
53func ng_copy_slice(buf: *u8, a: i64, b: i64, dst: *u8) -> i64
called by 1: ng_caps_lookup
61func ng_caps_lookup(tsv: *u8, n: i64, endpoint: *u8, out_cont: *u8, out_codec: *u8) -> i64
89func ng_negotiate(container: *u8, vcodec: *u8, acodec: *u8, ep_cont: *u8, ep_codec: *u8) -> i64
called by 2: mainmain calls 1: ng_csv_has