Referencia Zigmedia-daemon: IPC del motor de medios (empaquetado)

media-daemon/ipc/media_engine_ipc.zig

Declaraciones públicas de media-daemon/ipc/media_engine_ipc.zig (media-daemon: IPC del motor de medios (empaquetado)).

ImplementadoSin versión del tren todavía· generada desde apps/docs/generated/zig/media-daemon-ipc-media-engine.json

Página generada desde native/zig/media-daemon/ipc/media_engine_ipc.zig. No se edita a mano: bun run docs:gen la regenera y bun run docs:check falla si difiere.

Packaging handlers of the control socket (dec-0110 §3, dec-0120; protocols/session-ipc messages/media-engine.md): Bun decides (engine per session, tracks, segment length), the daemon validates and executes. Bytes of media never travel here: the reply to cmd.media.openPackaging carries the HTTP/3 URLs the player fetches.

The request arrives already verified by spire (signature, allowlist, contract: engine enum, segmentMs bounds, digest shapes); what is left here is what the schema cannot say (a half binding, the asset itself, capacity).

dec-0117 I1/I2: capActor/capResource bind the packaging session in the capability authority, so /styx/pkg/<id>/... serves only a request carrying an SCT playback-svc signed for that pkg_*; closing unbinds it first (revocation). A session opened without a binding exists but no request can ever read it (deny-by-default).

H3Endpoint

type · línea 30

pub const H3Endpoint = struct

HTTP/3 endpoint advertised in an openPackaging reply.

Context

type · línea 39

pub const Context = struct

What the packaging handlers need from the daemon (nothing owned).

replyError

fn · línea 52

pub fn replyError(comptime Reply: type, code: []const u8, message: []const u8, recoverable: bool) Reply

Business error of a reply whose error field is ?E (every daemon reply shares the shape {code, message, recoverable}, one generated type each).

ErrorCode

type · línea 59

pub const ErrorCode = struct

Contract error code of an engine/source error and whether retrying can help.

errorCode

fn · línea 62

pub fn errorCode(err: anyerror) ErrorCode

Maps an engine or source error to its contract ErrorCode.

parseBinding

fn · línea 80

pub fn parseBinding(actor_hex: ?[]const u8, resource_hex: ?[]const u8) error{InvalidBinding}!?authority_mod.Binding

capActor + capResource: both → a binding, neither → null, only one → error. Shapes (32/64 hex) are already guaranteed by the contract.

openPackaging

fn · línea 96

pub fn openPackaging(ctx: Context, arena: std.mem.Allocator, req: contracts.MediaOpenPackagingRequest, deadline_ms: ?u64) std.mem.Allocator.Error!OpenReply

cmd.media.openPackaging. Strings of the reply live in arena. deadline_ms is the request envelope's (null = it had none): the open stops there, or at Store.max_open_ms (ZC7-P2-01).

closePackaging

fn · línea 165

pub fn closePackaging(ctx: Context, req: contracts.MediaClosePackagingRequest) contracts.MediaClosePackagingReply

cmd.media.closePackaging: revoke first (dec-0117 I2), so a request racing the close is refused before the entry goes away.