code wiki / (root) / nx_codec.nx

nx_codec.nx

buildroot/runtime/nx_codec.nx

7404 B185 linesdepth 2pulls 2 transitivereach 6 importersview sourcekind librarytopic codec
docsdependenciesstructsconstsfunctions

about

nx_codec.nx -- abstract codec base class. The reusable composition primitive that audio (NishiVoice v1/v2) and video (NishiVideo v1/v2) codecs implement. Consumers (audio session, video session, future passthrough/test fakes) hold a `*nx_codec` and never touch concrete codec types directly -- the vtable handles dispatch. Per cardinal feedback-bits-up-exceed-never-match: codecs grade themselves via nx_codec_grade. The vtable's grade_card_fn lets any consumer ask any codec for its honest WIN/LOSE/TIE/UNMEASURED per-axis verdict at runtime. Per cardinal feedback-end-to-end-bit-traceability-architecture: every codec frame carries a CAS hash via frame_cas_hash_fn so streams become Merkle chains; any consumer can prove tamper- freedom of replayed bytes. genealogy_id: nx_voice_codec_v1 + nx_video_codec_v1 + nx_codec_grade + nx_attest_merkle_chain + nx_media_session lineage_id: nx_codec_q10

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_codec.nx nx_audio_session.nx nx_call.nx nx_video_codec_v1_adapter.nx nx_video_session.nx nx_voice_codec_v1_adapter.nx

imports: nx_syscalls.nx

imported by: nx_audio_session.nxnx_call.nxnx_video_codec_v1_adapter.nxnx_video_session.nxnx_voice_codec_v1_adapter.nx

structs

70struct nx_codec

consts

36const NX_CODEC_ID_UNKNOWN: i64 = 0
37const NX_CODEC_ID_NISHIVOICE_V1: i64 = 1
38const NX_CODEC_ID_NISHIVOICE_V2: i64 = 2
39const NX_CODEC_ID_NISHIVIDEO_V1: i64 = 11
40const NX_CODEC_ID_NISHIVIDEO_V2: i64 = 12
41const NX_CODEC_ID_PASSTHROUGH: i64 = 99 // test fixture
42const NX_CODEC_ID_N: i64 = 100
46const NX_CODEC_KIND_UNKNOWN: i64 = 0
47const NX_CODEC_KIND_AUDIO: i64 = 1
48const NX_CODEC_KIND_VIDEO: i64 = 2
49const NX_CODEC_KIND_DATA: i64 = 3
50const NX_CODEC_KIND_N: i64 = 4
57const NX_CODEC_ERR_OUT_TOO_SMALL: i64 = -1
58const NX_CODEC_ERR_BAD_INPUT: i64 = -2
59const NX_CODEC_ERR_BAD_MAGIC: i64 = -3
60const NX_CODEC_ERR_BAD_TIER: i64 = -4
61const NX_CODEC_ERR_NOT_SUPPORTED: i64 = -5
92const NX_CODEC_BYTES: i64 = 96

functions

96func nx_codec_id(c: *nx_codec) -> i64 { return c.codec_id }
97func nx_codec_kind(c: *nx_codec) -> i64 { return c.kind }
98func nx_codec_frame_size_in(c: *nx_codec) -> i64 { return c.frame_size_in }
99func nx_codec_frame_size_out(c: *nx_codec) -> i64 { return c.frame_size_out }
100func nx_codec_sample_rate(c: *nx_codec) -> i64 { return c.sample_rate }
101func nx_codec_bitrate_target(c: *nx_codec) -> i64 { return c.bitrate_target }
102func nx_codec_tier(c: *nx_codec) -> i64 { return c.tier }
111func nx_codec_encode(c: *nx_codec, src: *u8, src_n: i64,
118func nx_codec_decode(c: *nx_codec, src: *u8, src_n: i64,
125func nx_codec_frame_cas_hash(c: *nx_codec, frame: *u8, frame_n: i64,
131func nx_codec_grade_card(c: *nx_codec, out_buf: *u8, out_cap: i64) -> i64
141func nx_codec_default_encode(c: *nx_codec, src: *u8, src_n: i64,
146func nx_codec_default_decode(c: *nx_codec, src: *u8, src_n: i64,
151func nx_codec_default_frame_cas_hash(c: *nx_codec, frame: *u8, frame_n: i64,
156func nx_codec_default_grade_card(c: *nx_codec, out_buf: *u8, out_cap: i64) -> i64
167func nx_codec_init(c: *nx_codec,