The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
/* Ratatoskr media receive core, C ABI.
*
* The OBS plugin calls these and implements no transport of its own . The plugin
* this replaces hand - rolled CultNet RUDP in C + + and could not receive upstream
* fixes ; if you find yourself adding a sequence number or an ACK mask on the C
* side , it belongs in the Rust core or in CultLib , not here .
*
* Hand - written rather than generated , because the surface is meant to stay
* small enough to read in one sitting . If it outgrows that , the split is wrong .
*/
# ifndef RATATOSKR_H
# define RATATOSKR_H
# include <stddef.h>
# include <stdint.h>
# ifdef __cplusplus
extern " C " {
# endif
# define RATATOSKR_OK 0
# define RATATOSKR_NONE 1
# define RATATOSKR_ERR_ARGUMENT (-1)
# define RATATOSKR_ERR_OPEN (-2)
# define RATATOSKR_ERR_POLL (-3)
# define RATATOSKR_ERR_BUFFER_TOO_SMALL (-4)
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
# define RATATOSKR_ERR_CATALOG (-5)
# define RATATOSKR_ERR_REQUEST (-6)
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
2026-09-10 21:21:47 +02:00
/* What a payload is, so a caller can route it without parsing anything. A
* video payload is a whole access unit ( Annex B for H .264 / H .265 ) : chunking and
* parity are the transport ' s business and never cross this boundary . */
2026-09-10 02:03:41 +02:00
# define RATATOSKR_KIND_VIDEO 0
2026-09-10 21:21:47 +02:00
# define RATATOSKR_KIND_AUDIO 1
2026-09-10 02:03:41 +02:00
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
/* ---- receiving ---- */
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
typedef struct RatatoskrHandle RatatoskrHandle ;
2026-09-10 23:03:30 +02:00
/* Dials the producer at `producer` ("host:port": the advertised media_endpoint)
* and keeps dialling until it answers , so it may be opened before the
* producer has started . This host admits nothing inbound . ` video_relay ` may
* be NULL , or a " host:port " that every whole video access unit is also
* copied to as a raw byte stream over UDP , for a local decoder that reads one
* ( OBS ' s own ffmpeg source does ) . Release with ratatoskr_receiver_close
* exactly once . */
int ratatoskr_receiver_open ( const char * producer ,
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
const char * runtime_id ,
unsigned int connection_id ,
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
const char * video_relay ,
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
RatatoskrHandle * * out_handle ) ;
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
/* Drains the transport, gives up on frames that are too old, and tells the
* producer what was lost . Returns payloads now waiting , or a negative error . */
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
int ratatoskr_receiver_poll ( RatatoskrHandle * handle ) ;
/* Takes the next payload. RATATOSKR_NONE when empty. On
* RATATOSKR_ERR_BUFFER_TOO_SMALL the required size is written to out_len and
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
* the payload stays queued rather than being discarded . out_pts_ns receives
* the producer ' s presentation time in nanoseconds ; it may be NULL . */
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
int ratatoskr_receiver_next_payload ( RatatoskrHandle * handle ,
uint8_t * buffer ,
size_t capacity ,
2026-09-10 02:03:41 +02:00
size_t * out_len ,
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
int * out_kind ,
int64_t * out_pts_ns ) ;
2026-09-10 02:03:41 +02:00
/* Payloads that arrived on the media channel and did not decode. Non-zero means
* the producer and this build disagree about the envelope . */
uint64_t ratatoskr_receiver_undecodable ( RatatoskrHandle * handle ) ;
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
2026-09-10 23:03:30 +02:00
/* 1 while the producer has answered and not since gone quiet, else 0. */
int ratatoskr_receiver_attached ( RatatoskrHandle * handle ) ;
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
/* Payloads and bytes actually delivered, never what was requested. Either out
* pointer may be NULL . */
void ratatoskr_receiver_delivered ( RatatoskrHandle * handle ,
uint64_t * out_payloads ,
uint64_t * out_bytes ) ;
2026-09-10 21:21:47 +02:00
/* What became of the video frames: completed, chunks given back by parity, and
* frames given up on ( aged out or evicted ) . Any out pointer may be NULL . */
void ratatoskr_receiver_video_stats ( RatatoskrHandle * handle ,
uint64_t * out_completed ,
uint64_t * out_repaired_chunks ,
uint64_t * out_given_up ) ;
2026-09-10 21:39:33 +02:00
/* What was said back to the producer: records sent, chunks asked for again,
* keyframes requested , and records the transport refused ( usually : no producer
* attached ) . Any out pointer may be NULL . */
void ratatoskr_receiver_feedback_stats ( RatatoskrHandle * handle ,
uint64_t * out_sent ,
uint64_t * out_chunks_requested ,
uint64_t * out_keyframes_requested ,
uint64_t * out_not_sent ) ;
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
void ratatoskr_receiver_close ( RatatoskrHandle * handle ) ;
/* A free loopback UDP port for a local decoder to listen on. Bound and
* released ; use it promptly . 0 on failure . */
uint16_t ratatoskr_free_udp_port ( void ) ;
/* ---- discovering and asking ---- */
typedef struct RatatoskrCatalog RatatoskrCatalog ;
/* One stream a producer advertises. Every pointer is owned by the catalog and
* valid until ratatoskr_catalog_close . Parallel arrays pair ids with labels . */
typedef struct RatatoskrStreamInfo {
const char * stream_id ;
const char * producer_id ;
const char * label ;
const char * state ; /* "available", "streaming", "unavailable" */
size_t video_source_count ;
const char * const * video_source_ids ;
const char * const * video_source_labels ;
size_t audio_source_count ;
const char * const * audio_source_ids ;
const char * const * audio_source_labels ;
size_t video_codec_count ;
const char * const * video_codecs ;
size_t audio_codec_count ;
const char * const * audio_codecs ;
uint32_t audio_sample_rate ;
uint32_t audio_channels ;
uint32_t default_video_bitrate_kbps ;
uint32_t default_latency_budget_ms ;
uint32_t media_packet_bytes ;
2026-09-10 23:03:30 +02:00
const char * media_endpoint ; /* "host:port" the producer serves from */
uint32_t media_connection_id ; /* dial media_endpoint with this */
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
} RatatoskrStreamInfo ;
/* Pulls every advertised stream from Odin ("rudp://host:port" or "host:port").
* Blocks for the pull , seconds at most : call from a worker , never a render
* thread . state_dir holds a small working store per runtime id . */
int ratatoskr_catalog_pull ( const char * odin ,
const char * runtime_id ,
const char * state_dir ,
RatatoskrCatalog * * out_catalog ) ;
size_t ratatoskr_catalog_count ( const RatatoskrCatalog * catalog ) ;
/* Advertisements present but malformed and left out of the count. */
size_t ratatoskr_catalog_rejected ( const RatatoskrCatalog * catalog ) ;
int ratatoskr_catalog_stream ( const RatatoskrCatalog * catalog ,
size_t index ,
RatatoskrStreamInfo * out_info ) ;
2026-09-10 23:03:30 +02:00
/* Asks the producer of stream `index` to serve it. This receiver is known to
* the producer by the catalog ' s runtime id ; it dials media_endpoint itself .
The OBS source, and the mesh side it needs
A new source type, "CultMesh Media Stream". Its properties pull every
gamecult.media_stream_advertisement Odin holds and offer each stream's
video sources, audio sources and codecs from the advertisement, with
bitrate and latency budget; activating publishes a
gamecult.media_stream_request naming this receiver's endpoint. Nothing
in the picker comes from configuration or from Muninn.
The core grows the mesh half (catalog.rs): pull the advertisements,
publish a request, read the producer's answer, all over cultmesh-rs and
tested against an Odin-shaped RUDP catalog server on loopback. The C ABI
gains the catalog and request calls, a video relay that copies each
whole access unit to a loopback UDP port as a raw byte stream, and the
producer's presentation time on every payload.
The plugin itself owns only the OBS lifecycle. Video is drawn from a
private ffmpeg_source child reading the relay — the arrangement the
previous plugin proved in the field, minus the 2,500 lines of transport
it hand-rolled underneath. Audio is PCM straight to
obs_source_output_audio.
Built against a libobs-only build of obs-studio 32.2.2 with obs-deps
2026-07-15 under .sdk/ (git-ignored; the README says how). Installed to
the per-user OBS plugins directory. Not yet exercised with a live stream.
cargo test -p ratatoskr-core -> 31 passed
abi_smoke.exe ratatoskr_core.dll -> ABI SMOKE PASSED
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 22:22:42 +02:00
* Empty source ids mean none of that kind ; zero bitrate or latency means the
* producer ' s default . Blocks for the publish . */
int ratatoskr_request_start ( const RatatoskrCatalog * catalog ,
size_t index ,
const char * video_source_id ,
const char * audio_source_id ,
const char * video_codec ,
const char * audio_codec ,
unsigned int video_bitrate_kbps ,
unsigned int latency_budget_ms ) ;
/* Asks the producer of stream `index` to stop serving it to this receiver. */
int ratatoskr_request_stop ( const RatatoskrCatalog * catalog , size_t index ) ;
/* The producer's current answer for stream `index`, copied into the buffers
* ( NUL - terminated , truncated to capacity ) . RATATOSKR_NONE when the mesh holds
* no request from this receiver for it . Blocks for the pull . */
int ratatoskr_request_state ( const RatatoskrCatalog * catalog ,
size_t index ,
char * state ,
size_t state_capacity ,
char * detail ,
size_t detail_capacity ) ;
void ratatoskr_catalog_close ( RatatoskrCatalog * catalog ) ;
The squirrel, carrying messages it does not own
Ratatoskr subscribes to a CultMesh media stream and hands frames to a renderer.
First lowering target is OBS.
It exists because the receiver it replaces hand-rolled CultNet RUDP in C++
inside Mimir: acknowledgement, fragment reassembly, sockets, cultmesh:// URL
parsing, wire framing and two erasure codes, in 973 lines of headers linking no
CultLib. That made the receiving end of a protocol a separate implementation
from the sending end, in another language and another repository, and every
CultNet fix from August and September reached cultnet-rs and cultnet-ts without
reaching it.
So the constraint this repo holds is that it implements no transport. It
consumes CultNet. A sequence number or an ACK mask appearing here means
something belongs upstream in CultLib instead, where both ends can share it.
What works: the core opens a subscription over cultnet-rs, drains it, and hands
payloads across a C ABI. Nine Rust tests and fourteen C checks, the latter
loading the cdylib and verifying the header tells the truth rather than assuming
it. The MSVC staticlib is what the plugin will link; the C smoke test loads the
cdylib dynamically so the ABI is checkable with any compiler.
What does not: no reassembly, no FEC, no receiver feedback, and no plugin. It
cannot decode a real Muninn stream yet, because the wire envelope
(MuninnMediaWireRecord, encode_media_wire_record) still lives in Muninn and
needs to move to CultLib where both ends can reach it. README says so plainly
rather than implying more than exists.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:40:26 +02:00
/* Last error on this thread. Returns the full length; truncates to capacity. */
size_t ratatoskr_last_error ( char * buffer , size_t capacity ) ;
# ifdef __cplusplus
}
# endif
# endif /* RATATOSKR_H */