nx_media_pool.nx
buildroot/runtime/nx_media_pool.nx
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
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
| 88 | struct MediaItem |
| 126 | struct MediaPool |
consts
| 54 | const NX_MEDIA_TYPE_UNKNOWN: i64 = 0 |
| 55 | const NX_MEDIA_TYPE_TEXT: i64 = 1 // plain text / markdown / prose |
| 56 | const NX_MEDIA_TYPE_HTML: i64 = 2 // text/html (literotica wrapping) |
| 57 | const NX_MEDIA_TYPE_IMAGE: i64 = 3 // PNG / JPEG / WebP / single frame |
| 58 | const NX_MEDIA_TYPE_GIF: i64 = 4 // animated GIF (frame sequence) |
| 59 | const NX_MEDIA_TYPE_VIDEO: i64 = 5 // MP4 / WebM / Matroska (A/V container) |
| 60 | const NX_MEDIA_TYPE_AUDIO: i64 = 6 // WAV / MP3 / Opus / Vorbis |
| 66 | const NX_MEDIA_TYPE_MODEL3D: i64 = 7 // STL / OBJ / PLY / glTF / 3MF / FBX / STEP mesh |
| 67 | const NX_MEDIA_TYPE_BOOK: i64 = 8 // PDF / EPUB / MOBI / DJVU ebook |
| 68 | const NX_MEDIA_TYPE_AUDIOBOOK: i64 = 9 // M4B / AAX narrated long-form audio |
| 69 | const NX_MEDIA_TYPE_MANGA: i64 = 10 // CBZ / CBR / CB7 comic archive |
| 70 | const NX_MEDIA_TYPE_WARC: i64 = 11 // WARC / WACZ archived web capture |
| 71 | const NX_MEDIA_TYPE_ARCHIVE: i64 = 12 // generic zip/rar/7z/tar (container, not media) |
| 78 | const NX_MEDIA_SRC_UNKNOWN: i64 = 0 |
| 79 | const NX_MEDIA_SRC_USER_PASTE: i64 = 1 // user pasted via stdin / clipboard |
| 80 | const NX_MEDIA_SRC_USER_FILE: i64 = 2 // user pointed at filesystem path |
| 81 | const NX_MEDIA_SRC_BROWSER: i64 = 3 // nishi-browser URL fetch |
| 82 | const NX_MEDIA_SRC_VOICE: i64 = 4 // voice dictation / mic capture |
| 83 | const NX_MEDIA_SRC_BATCH: i64 = 5 // nx_ingest_runner directory walk |
| 84 | const NX_MEDIA_SRC_LLM_GEN: i64 = 6 // synthetic content from LLM |
| 115 | const NX_MEDIA_ITEM_BYTES: i64 = 80 |
| 124 | const NX_MEDIA_POOL_DEFAULT_CAP: i64 = 1024 |
functions
| 132 | func nx_media_pool_alloc(cap: i64) -> *MediaPool |
| 143 | func nx_media_pool_alloc_default() -> *MediaPool calls 1: nx_media_pool_alloc |
| 147 | func nx_media_item_at(p: *MediaPool, i: i64) -> *MediaItem |
| 159 | func nx_media_pool_add(p: *MediaPool, media_type: i64, src_kind: i64, called by 10: mainmainbuild_indexmainnx_fetch_path_into_poolnx_fetch_stdin_into_pool+4 calls 1: nx_media_item_at |
| 186 | func nx_media_pool_get(p: *MediaPool, media_id: i64, |
| 198 | func nx_media_pool_type(p: *MediaPool, media_id: i64) -> i64 |
| 206 | func nx_media_pool_src(p: *MediaPool, media_id: i64) -> i64 |