code wiki / (root) / nx_media_pool.nx

nx_media_pool.nx

buildroot/runtime/nx_media_pool.nx

8663 B211 linesdepth 2pulls 2 transitivereach 34 importersview sourcekind librarytopic media
docsdependenciesstructsconstsfunctions

about

nx_media_pool.nx -- container for ingested media bytes + provenance. Foundation primitive of the multi-media ingestion system. Every per-media-type ingester (text / image / gif / video / audio) writes its raw bytes into a MediaPool record, then StoryBeats reference that media_id when they describe scenes / frames / spans extracted from it. Why pool, not per-beat allocation: a single gif might contribute 8 beats (one per scene-change frame group); they all share the same source bytes. Same for a video keyframe sequence, or a chapter's worth of paragraphs sharing one source text blob. Pool keeps bytes in one place, beats hold cheap i64 media_ids. Substrate-native: no external deps; pure sys_mmap allocation. See: docs/NISHI_MEDIA_INGESTION_ROADMAP.md for the full architecture. Composes with: nx_storybeat.nx -- beats hold media_id pointing here nx_storydb.nx -- single MediaPool per StoryDb nx_media_sniff.nx -- determines media_type field nx_media_fetch.nx -- adds bytes after fetching

dependencies 1 imports · 21 importers

nx_syscalls.nx nx_media_pool.nx nx_arc_anchor_test.nx nx_caption_emit.nx nx_caption_emit_test.nx nx_content_guard.nx nx_content_guard_test.nx nx_ingest_cli.nx nx_media_fetch.nx nx_media_sniff.nx nx_mvault.nx nx_mvault_context.nx

diagram shows first 10 each side; +0 more imports, +11 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_arc_anchor_test.nxnx_caption_emit.nxnx_caption_emit_test.nxnx_content_guard.nxnx_content_guard_test.nxnx_ingest_cli.nxnx_media_fetch.nxnx_media_sniff.nxnx_mvault.nxnx_mvault_context.nxnx_mvault_context_gate.nxnx_mvault_ingest.nxnx_mvault_reindex.nxnx_mvault_walk.nxnx_scene_index.nxnx_scene_index_test.nxnx_storydb.nxnx_term_extract.nxnx_term_extract_test.nxnx_text_ingest.nxnx_text_ingest_test.nx

structs

88struct MediaItem
126struct MediaPool

consts

54const NX_MEDIA_TYPE_UNKNOWN: i64 = 0
55const NX_MEDIA_TYPE_TEXT: i64 = 1 // plain text / markdown / prose
56const NX_MEDIA_TYPE_HTML: i64 = 2 // text/html (literotica wrapping)
57const NX_MEDIA_TYPE_IMAGE: i64 = 3 // PNG / JPEG / WebP / single frame
58const NX_MEDIA_TYPE_GIF: i64 = 4 // animated GIF (frame sequence)
59const NX_MEDIA_TYPE_VIDEO: i64 = 5 // MP4 / WebM / Matroska (A/V container)
60const NX_MEDIA_TYPE_AUDIO: i64 = 6 // WAV / MP3 / Opus / Vorbis
66const NX_MEDIA_TYPE_MODEL3D: i64 = 7 // STL / OBJ / PLY / glTF / 3MF / FBX / STEP mesh
67const NX_MEDIA_TYPE_BOOK: i64 = 8 // PDF / EPUB / MOBI / DJVU ebook
68const NX_MEDIA_TYPE_AUDIOBOOK: i64 = 9 // M4B / AAX narrated long-form audio
69const NX_MEDIA_TYPE_MANGA: i64 = 10 // CBZ / CBR / CB7 comic archive
70const NX_MEDIA_TYPE_WARC: i64 = 11 // WARC / WACZ archived web capture
71const NX_MEDIA_TYPE_ARCHIVE: i64 = 12 // generic zip/rar/7z/tar (container, not media)
78const NX_MEDIA_SRC_UNKNOWN: i64 = 0
79const NX_MEDIA_SRC_USER_PASTE: i64 = 1 // user pasted via stdin / clipboard
80const NX_MEDIA_SRC_USER_FILE: i64 = 2 // user pointed at filesystem path
81const NX_MEDIA_SRC_BROWSER: i64 = 3 // nishi-browser URL fetch
82const NX_MEDIA_SRC_VOICE: i64 = 4 // voice dictation / mic capture
83const NX_MEDIA_SRC_BATCH: i64 = 5 // nx_ingest_runner directory walk
84const NX_MEDIA_SRC_LLM_GEN: i64 = 6 // synthetic content from LLM
115const NX_MEDIA_ITEM_BYTES: i64 = 80
124const NX_MEDIA_POOL_DEFAULT_CAP: i64 = 1024

functions

132func nx_media_pool_alloc(cap: i64) -> *MediaPool
143func nx_media_pool_alloc_default() -> *MediaPool
147func nx_media_item_at(p: *MediaPool, i: i64) -> *MediaItem
159func nx_media_pool_add(p: *MediaPool, media_type: i64, src_kind: i64,
186func nx_media_pool_get(p: *MediaPool, media_id: i64,
198func nx_media_pool_type(p: *MediaPool, media_id: i64) -> i64
called by 2: nx_text_ingestmain calls 1: nx_media_item_at
206func nx_media_pool_src(p: *MediaPool, media_id: i64) -> i64
called by 1: main calls 1: nx_media_item_at