nx_codec.nx
buildroot/runtime/nx_codec.nx
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
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
| 70 | struct nx_codec |
consts
| 36 | const NX_CODEC_ID_UNKNOWN: i64 = 0 |
| 37 | const NX_CODEC_ID_NISHIVOICE_V1: i64 = 1 |
| 38 | const NX_CODEC_ID_NISHIVOICE_V2: i64 = 2 |
| 39 | const NX_CODEC_ID_NISHIVIDEO_V1: i64 = 11 |
| 40 | const NX_CODEC_ID_NISHIVIDEO_V2: i64 = 12 |
| 41 | const NX_CODEC_ID_PASSTHROUGH: i64 = 99 // test fixture |
| 42 | const NX_CODEC_ID_N: i64 = 100 |
| 46 | const NX_CODEC_KIND_UNKNOWN: i64 = 0 |
| 47 | const NX_CODEC_KIND_AUDIO: i64 = 1 |
| 48 | const NX_CODEC_KIND_VIDEO: i64 = 2 |
| 49 | const NX_CODEC_KIND_DATA: i64 = 3 |
| 50 | const NX_CODEC_KIND_N: i64 = 4 |
| 57 | const NX_CODEC_ERR_OUT_TOO_SMALL: i64 = -1 |
| 58 | const NX_CODEC_ERR_BAD_INPUT: i64 = -2 |
| 59 | const NX_CODEC_ERR_BAD_MAGIC: i64 = -3 |
| 60 | const NX_CODEC_ERR_BAD_TIER: i64 = -4 |
| 61 | const NX_CODEC_ERR_NOT_SUPPORTED: i64 = -5 |
| 92 | const NX_CODEC_BYTES: i64 = 96 |
functions
| 96 | func nx_codec_id(c: *nx_codec) -> i64 { return c.codec_id } |
| 97 | func nx_codec_kind(c: *nx_codec) -> i64 { return c.kind } |
| 98 | func nx_codec_frame_size_in(c: *nx_codec) -> i64 { return c.frame_size_in } |
| 99 | func nx_codec_frame_size_out(c: *nx_codec) -> i64 { return c.frame_size_out } |
| 100 | func nx_codec_sample_rate(c: *nx_codec) -> i64 { return c.sample_rate } |
| 101 | func nx_codec_bitrate_target(c: *nx_codec) -> i64 { return c.bitrate_target } |
| 102 | func nx_codec_tier(c: *nx_codec) -> i64 { return c.tier } |
| 111 | func nx_codec_encode(c: *nx_codec, src: *u8, src_n: i64, |
| 118 | func nx_codec_decode(c: *nx_codec, src: *u8, src_n: i64, |
| 125 | func nx_codec_frame_cas_hash(c: *nx_codec, frame: *u8, frame_n: i64, |
| 131 | func nx_codec_grade_card(c: *nx_codec, out_buf: *u8, out_cap: i64) -> i64 |
| 141 | func nx_codec_default_encode(c: *nx_codec, src: *u8, src_n: i64, |
| 146 | func nx_codec_default_decode(c: *nx_codec, src: *u8, src_n: i64, |
| 151 | func nx_codec_default_frame_cas_hash(c: *nx_codec, frame: *u8, frame_n: i64, |
| 156 | func nx_codec_default_grade_card(c: *nx_codec, out_buf: *u8, out_cap: i64) -> i64 |
| 167 | func nx_codec_init(c: *nx_codec, |