Expand description
C bindings for moq_net.
Provides a C-compatible API for real-time pub/sub over QUIC.
§Concepts
- Session: Network connection to a MoQ relay
- Origin: Collection of broadcasts
- Broadcast: Container for tracks
- Track: Named stream of groups
- Group: Collection of frames
- Frame: Sized payload with timestamp
§Error Handling
All functions return negative error codes on failure or non-negative values on success. Resources are managed through opaque integer handles that must be explicitly closed.
Structs§
- Audio
- Decoder
Output - What
moq_decode_videodelivers per frame: the requested CPU pixel format and target size, validated up front so the delivery loop never second-guesses. - Id
- Opaque resource identifier returned to C code.
- Video
- Raw-video state: encoders being published, plus decoder tasks and their buffered decoded frames.
- moq_
announce_ update - A route announcement or retraction from an origin.
- moq_
audio_ config - Information about an audio rendition in the catalog.
- moq_
audio_ decoder_ output - PCM layout the caller wants out of
moq_decode_audio. - moq_
audio_ encoder_ input - PCM layout the caller hands to
moq_encode_audio_frame. - moq_
audio_ encoder_ output - Codec-side configuration.
sample_rate/channels= 0 means “match the input (snapping the rate up to a libopus-supported value if necessary)”. - moq_
audio_ frame - One audio frame: payload bytes plus a presentation timestamp.
- moq_
audio_ init - Configuration for moq_publish_audio.
- moq_
client_ config - Settings for moq_session_connect, or NULL to dial with the defaults.
- moq_
connection_ snapshot - Statistics and protocol sampled from the same connection by moq_session_snapshot.
- moq_
connection_ stats - A snapshot of connection statistics, filled in by moq_session_stats.
- moq_
container - The container of a video or audio rendition, plus whatever that container needs to describe itself.
- moq_
container_ init - Configuration for moq_publish_container.
- moq_
datagram - A best-effort raw track datagram delivered via moq_consume_datagrams.
- moq_
frame - Information about a frame of media.
- moq_
json_ snapshot_ config - Options for a JSON snapshot track (lossy latest-value mode).
- moq_
json_ stream_ config - Options for a JSON stream track (lossless append-log mode).
- moq_
json_ value - A JSON value delivered by a consumer callback.
- moq_
protocol_ error - A protocol failure a peer sent: scope, verbatim wire code, and recognized kind.
- moq_
route - A route advertisement: hops and costs.
- moq_
section - One untyped application catalog section: a name and its JSON value.
- moq_
string - A borrowed UTF-8 string slice, NOT NULL terminated.
- moq_
subscription - Subscriber-side raw track delivery preferences.
- moq_
track_ info - Publisher-side raw track properties.
- moq_
video_ config - Information about a video rendition in the catalog.
- moq_
video_ decoder_ output - Decode-side configuration the caller passes to
moq_decode_video. - moq_
video_ encoder_ frame - One raw frame handed to
moq_encode_video_frame. - moq_
video_ encoder_ input - Raw frame layout the caller hands to
moq_encode_video_frame, plus the resolution and rate the encoder is opened at. Every published frame must matchwidthxheight; scale before publishing if your source moves. - moq_
video_ encoder_ output - Codec-side configuration for
moq_encode_video. Every knob spells “unset” as 0. - moq_
video_ frame - One decoded video frame from
moq_decode_video: pixels plus a presentation timestamp. - moq_
video_ hint - Optional catalog fields for moq_video_init::hint.
- moq_
video_ init - Configuration for moq_publish_video.
- moq_
video_ properties - Catalog properties shared by every video rendition.
Enums§
- Error
- Error types that can occur in the FFI layer.
- moq_
audio_ format - A single audio codec moq_publish_audio can parse.
- moq_
audio_ sample_ format - Raw PCM sample layout, mirroring WebCodecs
AudioData.format. - moq_
container_ format - A container moq_publish_container can demux, which may publish several tracks.
- moq_
container_ kind - How a media track’s frames are wrapped, independent of the codec.
- moq_
demand - Whether a published track has subscribers, as reported by a demand watcher.
- moq_
error_ scope - Whether a protocol code is from the session or stream registry.
- moq_
protocol_ kind - A recognized protocol kind. Pair with
moq_error_scope:CANCELis 0 on a session and 1 on a stream.APPandUNKNOWNkeep the numeric code inmoq_protocol_error. - moq_
video_ codec - Output video codec for
moq_encode_video. - moq_
video_ encoder_ kind - Which encoder implementation
moq_encode_videoshould use. - moq_
video_ format - A single video codec moq_publish_video can parse.
- moq_
video_ pixel_ format - Pixel layout of the raw frames handed to
moq_encode_video_frame.
Constants§
- MOQ_
ERROR_ ANNOUNCEMENT_ NOT_ FOUND - MOQ_
ERROR_ AUDIO - MOQ_
ERROR_ BROADCAST_ NOT_ FOUND - MOQ_
ERROR_ BUFFER_ NOT_ CONSUMED - MOQ_
ERROR_ CATALOG_ NOT_ FOUND - MOQ_
ERROR_ CONNECT - MOQ_
ERROR_ FORBIDDEN - MOQ_
ERROR_ FRAME_ NOT_ FOUND - MOQ_
ERROR_ GROUP_ NOT_ FOUND - MOQ_
ERROR_ HANG - MOQ_
ERROR_ INIT_ FAILED - MOQ_
ERROR_ INVALID_ CODE - MOQ_
ERROR_ INVALID_ CONFIG - MOQ_
ERROR_ INVALID_ ID - MOQ_
ERROR_ INVALID_ POINTER - MOQ_
ERROR_ JSON - MOQ_
ERROR_ JSON_ TRACK - MOQ_
ERROR_ LEVEL - MOQ_
ERROR_ MEDIA_ NOT_ FOUND - MOQ_
ERROR_ MOQ - MOQ_
ERROR_ MUX - MOQ_
ERROR_ NATIVE - MOQ_
ERROR_ NOT_ FOUND - MOQ_
ERROR_ NO_ INDEX - MOQ_
ERROR_ NUL - MOQ_
ERROR_ OFFLINE - MOQ_
ERROR_ ORIGIN_ NOT_ FOUND - MOQ_
ERROR_ PANIC - MOQ_
ERROR_ SESSION_ NOT_ FOUND - MOQ_
ERROR_ TIMESTAMP_ OVERFLOW - MOQ_
ERROR_ TRACK_ NOT_ FOUND - MOQ_
ERROR_ UNAUTHORIZED - MOQ_
ERROR_ UNKNOWN_ FORMAT - MOQ_
ERROR_ UNRESOLVABLE_ BROADCAST - MOQ_
ERROR_ URL - MOQ_
ERROR_ UTF8 - MOQ_
ERROR_ VIDEO
Functions§
- moq_
bandwidth_ close - Release a bandwidth handle. Reservations taken against it stay until they themselves are closed (or the session’s allocator is gone).
- moq_
bandwidth_ reserve - Reserve up to
max_bpsfortrack, returning a reservation handle. - moq_
broadcast_ request_ accept - Accept a broadcast request with an unannounced broadcast producer.
- moq_
broadcast_ request_ free - Free a broadcast request without accepting or rejecting it.
- moq_
broadcast_ ⚠request_ path - The path of a broadcast request delivered to a moq_origin_dynamic callback.
- moq_
broadcast_ request_ reject - Reject a broadcast request with an application error code.
- moq_
client_ defaults - The settings moq_session_connect dials with when given NULL.
- moq_
consume_ ⚠audio - Consume an audio track from a broadcast, emitting the frames in order.
- moq_
consume_ audio_ cancel - Stop an audio track consumer’s background task.
- moq_
consume_ ⚠audio_ config - Query information about an audio track in a catalog.
- moq_
consume_ ⚠catalog - Create a catalog consumer for a broadcast.
- moq_
consume_ catalog_ cancel - Stop a catalog consumer’s background subscription.
- moq_
consume_ catalog_ free - Free a catalog snapshot received via the moq_consume_catalog callback.
- moq_
consume_ ⚠catalog_ section - Look up an application catalog section by name.
- moq_
consume_ ⚠catalog_ section_ at - Query an application catalog section by index, keyed by name.
- moq_
consume_ catalog_ section_ count - Number of untyped application catalog sections in a catalog snapshot.
- moq_
consume_ close - Close a broadcast consumer and clean up its resources.
- moq_
consume_ ⚠datagram - Read a datagram delivered via the moq_consume_datagrams callback.
- moq_
consume_ datagram_ free - Free a datagram delivered via the moq_consume_datagrams callback, releasing its payload.
- moq_
consume_ ⚠datagrams - Subscribe to a raw track’s best-effort datagrams by name.
- moq_
consume_ datagrams_ cancel - Stop a datagram subscription’s background task.
- moq_
consume_ ⚠frame - Get a chunk of a frame’s payload.
- moq_
consume_ frame_ free - Free a decoded frame delivered via a moq_consume_video or moq_consume_audio callback.
- moq_
consume_ json_ cancel - Stop a JSON consumer’s background task (snapshot or stream).
- moq_
consume_ ⚠json_ snapshot - Subscribe to a JSON snapshot track (lossy latest-value) by name.
- moq_
consume_ ⚠json_ stream - Subscribe to a JSON stream track (lossless append-log) by name.
- moq_
consume_ ⚠json_ value - Read a JSON value delivered via a moq_consume_json_snapshot or moq_consume_json_stream callback.
- moq_
consume_ json_ value_ free - Release a JSON value delivered via a consumer callback.
- moq_
consume_ ⚠track - Subscribe to a raw track by name, delivering each frame’s payload as-is.
- moq_
consume_ track_ cancel - Stop a raw track consumer’s background task.
- moq_
consume_ ⚠track_ frame - Read a raw frame’s payload delivered via the moq_consume_track callback.
- moq_
consume_ track_ frame_ free - Free a raw frame delivered via the moq_consume_track callback, releasing its payload.
- moq_
consume_ ⚠track_ update - Update a raw track subscription’s delivery preferences.
- moq_
consume_ ⚠video - Consume a video track from a broadcast, delivering frames in order.
- moq_
consume_ video_ cancel - Stop a video track consumer’s background task.
- moq_
consume_ ⚠video_ config - Query information about a video track in a catalog.
- moq_
consume_ ⚠video_ properties - Query the catalog properties shared by every video rendition.
- moq_
consume_ ⚠video_ stalled - Query whether the publisher recommends temporarily avoiding a video rendition.
- moq_
decode_ ⚠audio - Subscribe to an audio track and decode it into PCM.
- moq_
decode_ audio_ cancel - Stop an audio (raw PCM) consumer’s background task.
- moq_
decode_ ⚠audio_ frame - Copy a delivered frame’s metadata into
dst. - moq_
decode_ audio_ frame_ free - Free a frame previously delivered through the consume callback. Required for every delivered frame ID; closing the parent consumer is not enough.
- moq_
decode_ ⚠video - Subscribe to a video track and decode it into raw frames in the requested
CPU pixel format and size (see
moq_video_decoder_output). - moq_
decode_ video_ cancel - Stop a video (raw) consumer’s background task.
- moq_
decode_ ⚠video_ frame - Copy a delivered frame’s metadata into
dst. - moq_
decode_ video_ frame_ free - Free a frame previously delivered through the consume callback. Required for every delivered frame id; closing the parent consumer is not enough.
- moq_
encode_ ⚠audio - Open an audio track on a broadcast.
- moq_
encode_ ⚠audio_ demand - Watch whether the encoded audio track has subscribers, so the microphone and
encoder run only while someone listens. See
crate::moq_publish_media_demandfor the callback contract. - moq_
encode_ audio_ finish - Flush any pending samples and finalize an audio producer.
- moq_
encode_ ⚠audio_ frame - Push one audio frame.
- moq_
encode_ audio_ reservation - This encoder’s bandwidth reservation, or 0 if it was published without one.
- moq_
encode_ ⚠video - Open a video track on a broadcast, encoding the raw frames you publish to it.
- moq_
encode_ video_ bitrate - Retune a live encoder to
bitratebits per second, taking effect from roughly the next frame. No keyframe is forced, so this is cheap enough to drive from a congestion controller. - moq_
encode_ video_ cut - Cut a new group at the next published frame.
- moq_
encode_ ⚠video_ demand - Watch whether the encoded video track has subscribers, so the camera and encoder
run only while someone watches. See
crate::moq_publish_media_demandfor the callback contract. - moq_
encode_ video_ finish - Flush any frames the codec is still holding and finalize the video track.
- moq_
encode_ ⚠video_ frame - Encode and publish one raw frame.
- moq_
encode_ video_ reservation - This encoder’s bandwidth reservation, or 0 if it was published without one.
- moq_
error - Human-readable reason for the most recent failed call on the calling thread.
- moq_
error_ ⚠protocol - Structured protocol details for the most recent failed call on the calling thread.
- moq_
group_ request_ abort - Reject a group request with an application error code, failing the waiting fetches.
- moq_
group_ request_ accept - Accept a group request, resolving the waiting fetches with the group you then fill.
- moq_
group_ ⚠request_ frame_ start - The first frame of the group the fetch wants; 0 is the whole group.
- moq_
group_ request_ free - Free a group request without accepting it, which rejects it.
- moq_
group_ ⚠request_ priority - The delivery priority the fetching consumer asked for.
- moq_
group_ ⚠request_ sequence - The group sequence a group request asks for.
- moq_
log_ ⚠level - Initialize the library with a log level.
- moq_
origin_ ⚠announced - Learn about broadcasts matching a pattern scope under an origin.
- moq_
origin_ ⚠announced_ broadcast - Consume a broadcast from an origin by path, waiting until something can serve it.
- moq_
origin_ announced_ broadcast_ cancel - Abort a wait started by moq_origin_announced_broadcast.
- moq_
origin_ announced_ cancel - Stop receiving announcements for broadcasts published to an origin.
- moq_
origin_ announced_ free - Free a single announcement delivered to a moq_origin_announced
on_announcecallback. - moq_
origin_ ⚠announced_ info - Query information about a broadcast discovered by moq_origin_announced.
- moq_
origin_ close - Close an origin and clean up its resources.
- moq_
origin_ create - Create an origin for publishing broadcasts.
- moq_
origin_ ⚠create_ broadcast - Create a broadcast at
pathon an origin, for publishing media tracks. - moq_
origin_ ⚠dynamic - Advertise
prefixand serve the requests beneath it. - moq_
origin_ dynamic_ cancel - Stop serving and retract the route.
- moq_
origin_ ⚠dynamic_ update - Re-price a served route in place. The prefix cannot change.
- moq_
origin_ ⚠request - Request a broadcast from an origin by path, resolving as soon as it can be served.
- moq_
origin_ request_ cancel - Abort a request started by moq_origin_request.
- moq_
publish_ ⚠announce - Advertise a broadcast’s exact path as a route.
- moq_
publish_ ⚠audio - Publish one audio codec as a new media track.
- moq_
publish_ ⚠audio_ config - Add or replace an audio rendition in a broadcast’s catalog.
- moq_
publish_ ⚠audio_ remove - Remove an audio rendition from a broadcast’s catalog by name.
- moq_
publish_ ⚠catalog_ section - Set (or replace) a top-level application catalog section by name.
- moq_
publish_ ⚠catalog_ section_ remove - Remove a top-level application catalog section by name.
- moq_
publish_ ⚠container - Publish a container, which demuxes and publishes its own tracks.
- moq_
publish_ container_ cut - Declare that the next chunk starts a new segment, rolling a group on every track the container publishes.
- moq_
publish_ container_ finish - Finish every track the container publishes and release the handle.
- moq_
publish_ container_ seek - Start a new segment and number its groups
sequence. - moq_
publish_ ⚠container_ write - Write a whole chunk of container bytes.
- moq_
publish_ demand_ cancel - Stop a demand watcher from moq_publish_track_demand, moq_publish_media_demand,
crate::moq_encode_video_demand, orcrate::moq_encode_audio_demand. - moq_
publish_ ⚠dynamic - Serve subscriber requests for tracks the broadcast has not declared.
- moq_
publish_ dynamic_ cancel - Stop a request handler from moq_publish_dynamic, moq_publish_track_dynamic, or moq_track_request_dynamic. Requests not yet delivered are rejected.
- moq_
publish_ finish - Finish a broadcast and release it, ending its catalog cleanly.
- moq_
publish_ group_ abort - Abort a raw group with an application error code.
- moq_
publish_ group_ finish - Finish a raw group. No more frames can be written.
- moq_
publish_ ⚠group_ frame - Write a frame into a raw group created by moq_publish_track_group.
- moq_
publish_ ⚠json_ snapshot - Create a JSON snapshot track (lossy latest-value) on a broadcast.
- moq_
publish_ json_ snapshot_ finish - Finish a JSON snapshot track. No more values can be published.
- moq_
publish_ ⚠json_ snapshot_ update - Publish a new value to a JSON snapshot track.
valueis a UTF-8 JSON document. A no-op if unchanged from the previous update. - moq_
publish_ ⚠json_ stream - Create a JSON stream track (lossless append-log) on a broadcast.
- moq_
publish_ ⚠json_ stream_ append - Append one record to a JSON stream track.
valueis a UTF-8 JSON document. - moq_
publish_ json_ stream_ finish - Finish a JSON stream track. No more records can be appended.
- moq_
publish_ media_ cut - Draw a group boundary on a media importer.
- moq_
publish_ ⚠media_ demand - Watch whether a media track has subscribers, so an encoder runs only while someone watches.
- moq_
publish_ media_ finish - Finish a media track, flushing any buffered frames. No more frames can be written.
- moq_
publish_ ⚠media_ frame - Write data to a track.
- moq_
publish_ media_ seek - Draw a group boundary and number the next group
sequence. - moq_
publish_ ⚠track - Create a raw track on a broadcast for arbitrary byte payloads.
- moq_
publish_ track_ abort - Abort a raw track with an application error code.
- moq_
publish_ ⚠track_ datagram - Send a best-effort datagram on a raw track created by moq_publish_track.
- moq_
publish_ ⚠track_ demand - Watch whether a raw track has subscribers. See moq_publish_media_demand for the callback contract.
- moq_
publish_ ⚠track_ dynamic - Serve fetches of groups a raw track no longer has cached.
- moq_
publish_ track_ finish - Finish a raw track. No more groups or frames can be written.
- moq_
publish_ track_ finish_ at - Declare a raw track’s exclusive final group sequence.
- moq_
publish_ ⚠track_ frame - Write a single-frame group to a raw track with a timestamp.
- moq_
publish_ track_ group - Append a new group to a raw track, returning a group producer.
- moq_
publish_ track_ group_ at - Create a raw group with an explicit sequence number.
- moq_
publish_ unannounce - Retract a broadcast’s exact-path advertisement, if any.
- moq_
publish_ ⚠video - Publish one video codec as a new media track.
- moq_
publish_ ⚠video_ config - Add or replace a video rendition in a broadcast’s catalog.
- moq_
publish_ ⚠video_ properties - Replace the catalog properties shared by every video rendition.
- moq_
publish_ ⚠video_ remove - Remove a video rendition from a broadcast’s catalog by name.
- moq_
qlog_ supported - Whether this build can capture qlog traces.
- moq_
reservation_ close - Release a reservation, handing its share back to siblings.
- moq_
reservation_ ⚠grant - This reservation’s slice right now, in bits per second.
- moq_
reservation_ update - Change the ceiling, keeping the same claim.
- moq_
session_ bandwidth - The session’s bandwidth allocator. Clones share one reservation registry.
- moq_
session_ close - Request that a session shut down.
- moq_
session_ ⚠connect - Start establishing a connection to a MoQ server.
- moq_
session_ ⚠snapshot - Snapshot statistics and the negotiated protocol from the same live connection.
- moq_
session_ ⚠stats - Snapshot the current connection statistics for a session.
- moq_
track_ request_ abort - Reject a track request with an application error code, failing the waiting subscribers.
- moq_
track_ ⚠request_ accept - Accept a track request as a raw track, resolving the waiting subscribers.
- moq_
track_ ⚠request_ audio - Accept a track request as an audio track, the importer picking the timescale.
- moq_
track_ ⚠request_ dynamic - Serve fetches of uncached groups on a requested track, before accepting it.
- moq_
track_ request_ free - Free a track request without accepting it, which rejects it.
- moq_
track_ ⚠request_ name - The name of a track request delivered to a moq_publish_dynamic callback.
- moq_
track_ ⚠request_ video - Accept a track request as a video track, the importer picking the timescale.
- moq_
versions ⚠ - List the protocol versions offered during the handshake by default.
Type Aliases§
- Status
- Status code returned by FFI functions.
- moq_
status_ callback - A callback receiving a positive handle/value, zero on clean completion, or a negative error.