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
- Id
- Opaque resource identifier returned to C code.
- Video
- Raw-video state: encoders being published, plus decoder tasks and their buffered decoded frames.
- moq_
announced - Information about a broadcast announced by 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_consume_audio_raw. - moq_
audio_ encoder_ input - PCM layout the caller hands to
moq_publish_audio_raw_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_
connection_ stats - A snapshot of connection statistics, filled in by moq_session_stats.
- 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_
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_consume_video_raw. - moq_
video_ encoder_ frame - One raw frame handed to
moq_publish_video_raw_frame. - moq_
video_ encoder_ input - Raw frame layout the caller hands to
moq_publish_video_raw_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_publish_video_raw. Every knob spells “unset” as 0. - moq_
video_ frame - One decoded video frame from
moq_consume_video_raw: packed I420 plus a presentation timestamp. - moq_
video_ properties - Catalog properties shared by every video rendition.
Enums§
- Error
- Error types that can occur in the FFI layer.
- moq_
audio_ format - Raw PCM sample layout, mirroring WebCodecs
AudioData.format. - moq_
video_ codec - Output video codec for
moq_publish_video_raw. - moq_
video_ encoder_ kind - Which encoder implementation
moq_publish_video_rawshould use. - moq_
video_ pixel_ format - Pixel layout of the raw frames handed to
moq_publish_video_raw_frame.
Functions§
- moq_
backends ⚠ - List the QUIC backends this build was compiled with.
- moq_
client_ close - Release a client configuration created by moq_client_create.
- moq_
client_ ⚠connect - Start establishing a connection to a MoQ server using a client configuration.
- moq_
client_ create - Create a client configuration for moq_client_connect.
- moq_
client_ ⚠get_ backoff_ initial - Read the first reconnect delay, in milliseconds. See moq_client_set_backoff_initial.
- moq_
client_ ⚠get_ backoff_ max - Read the reconnect delay ceiling, in milliseconds. See moq_client_set_backoff_max.
- moq_
client_ ⚠get_ backoff_ multiplier - Read the reconnect delay multiplier. See moq_client_set_backoff_multiplier.
- moq_
client_ ⚠get_ backoff_ timeout - Read how long reconnecting keeps trying, in milliseconds. Zero means forever. See moq_client_set_backoff_timeout.
- moq_
client_ ⚠get_ connect_ timeout - Read the connect timeout, in milliseconds. See moq_client_set_connect_timeout.
- moq_
client_ ⚠get_ failover_ delay - Read the Happy Eyeballs stagger, in milliseconds. See moq_client_set_failover_delay and moq_client_get_connect_timeout for what an unset knob reports.
- moq_
client_ ⚠get_ quic_ idle_ timeout - Read the QUIC idle timeout, in milliseconds. See moq_client_set_quic_idle_timeout.
- moq_
client_ ⚠get_ quic_ keep_ alive - Read the QUIC keep-alive interval, in milliseconds. Zero means the pings are disabled. See moq_client_set_quic_keep_alive.
- moq_
client_ ⚠get_ quic_ max_ streams - Read the maximum concurrent QUIC streams. See moq_client_set_quic_max_streams.
- moq_
client_ ⚠get_ websocket_ delay - Read the WebSocket fallback delay, in milliseconds. See moq_client_set_websocket_delay.
- moq_
client_ ⚠get_ websocket_ enabled - Read whether the WebSocket fallback races the QUIC attempt. See moq_client_set_websocket_enabled.
- moq_
client_ ⚠set_ backend - Choose the QUIC backend:
"quinn","quiche", or"noq". - moq_
client_ set_ backoff_ initial - Set the delay before the first reconnect attempt, in milliseconds.
- moq_
client_ set_ backoff_ max - Set the ceiling on the growing reconnect delay, in milliseconds.
- moq_
client_ set_ backoff_ multiplier - Set the multiplier applied to the reconnect delay after each failed attempt.
- moq_
client_ set_ backoff_ timeout - Set how long to keep retrying before giving up, in milliseconds.
- moq_
client_ ⚠set_ bind - Set the local UDP socket address to bind, e.g.
"[::]:0"(the default) or"192.0.2.7:0"to pin the outgoing interface. - moq_
client_ set_ connect_ timeout - Bound one connection attempt, covering both the dial and the MoQ handshake, in milliseconds.
- moq_
client_ set_ failover_ delay - Delay before also dialing the next resolved address (Happy Eyeballs), in milliseconds.
- moq_
client_ ⚠set_ quic_ congestion_ control - Set the congestion control family.
- moq_
client_ set_ quic_ gso - Enable or disable UDP generic segmentation offload.
- moq_
client_ set_ quic_ idle_ timeout - Set the idle timeout before an inactive connection is dropped, in milliseconds.
- moq_
client_ set_ quic_ keep_ alive - Set the keep-alive ping interval, in milliseconds.
- moq_
client_ set_ quic_ max_ streams - Set the maximum concurrent QUIC streams per connection, bidirectional and unidirectional alike.
- moq_
client_ set_ quic_ mtu_ discovery - Enable or disable path MTU discovery.
- moq_
client_ ⚠set_ quic_ qlog - Set the directory to write qlog traces into.
- moq_
client_ ⚠set_ tls_ cert - Present this PEM certificate chain when the relay requires mTLS.
- moq_
client_ set_ tls_ disable_ verify - Skip TLS certificate verification.
- moq_
client_ ⚠set_ tls_ fingerprints - Pin the peer to a certificate with one of these SHA-256 fingerprints, hex encoded.
- moq_
client_ ⚠set_ tls_ host_ name - Override the TLS server name (SNI) sent during the handshake.
- moq_
client_ ⚠set_ tls_ key - Present this PEM private key when the relay requires mTLS.
- moq_
client_ ⚠set_ tls_ roots - Trust these PEM root certificate files.
- moq_
client_ set_ tls_ system_ roots - Whether to also trust the platform’s native root certificates.
- moq_
client_ ⚠set_ versions - Restrict the protocol versions offered during the handshake.
- moq_
client_ set_ websocket_ delay - Delay before racing a WebSocket fallback against the QUIC dial, in milliseconds.
- moq_
client_ set_ websocket_ enabled - Enable or disable the WebSocket fallback entirely.
- moq_
consume_ ⚠audio - Consume an audio track from a broadcast, emitting the frames in order.
- moq_
consume_ audio_ close - Stop an audio track consumer’s background task.
- moq_
consume_ ⚠audio_ config - Query information about an audio track in a catalog.
- moq_
consume_ ⚠audio_ raw - Subscribe to an audio track and decode it into PCM.
- moq_
consume_ audio_ raw_ close - Stop an audio (raw PCM) consumer’s background task.
- moq_
consume_ ⚠audio_ raw_ frame - Copy a delivered frame’s metadata into
dst. - moq_
consume_ audio_ raw_ 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_
consume_ ⚠catalog - Create a catalog consumer for a broadcast.
- moq_
consume_ catalog_ close - 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_ close - 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_ close - 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_ close - 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_ close - 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_ raw - Subscribe to a video track and decode it into raw I420 frames.
- moq_
consume_ video_ raw_ close - Stop a video (raw) consumer’s background task.
- moq_
consume_ ⚠video_ raw_ frame - Copy a delivered frame’s metadata into
dst. - moq_
consume_ video_ raw_ 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_
error - Human-readable reason for the most recent failed call on the calling thread.
- moq_
log_ ⚠level - Initialize the library with a log level.
- moq_
origin_ ⚠announced - Learn about all broadcasts published to an origin.
- moq_
origin_ announced_ close - 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_ ⚠consume_ announced - Consume a broadcast from an origin by path, waiting until it is announced.
- moq_
origin_ consume_ announced_ close - Abort a wait started by moq_origin_consume_announced.
- moq_
origin_ create - Create an origin for publishing broadcasts.
- moq_
origin_ ⚠publish - Create a broadcast at
pathon an origin, for publishing media tracks. - moq_
origin_ ⚠request - Request a broadcast from an origin by path, resolving as soon as it can be served.
- moq_
origin_ request_ close - Abort a request started by moq_origin_request.
- moq_
publish_ ⚠audio_ config - Add or replace an audio rendition in a broadcast’s catalog.
- moq_
publish_ ⚠audio_ raw - Open an audio track on a broadcast.
- moq_
publish_ audio_ raw_ finish - Flush any pending samples and finalize an audio producer.
- moq_
publish_ ⚠audio_ raw_ frame - Push one audio frame.
- 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_ 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 - Create a new media track for a broadcast
- 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_ set_ announce - Set whether a broadcast created by moq_origin_publish is live: announced by its origin.
- 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_ 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_ ⚠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_ raw - Open a video track on a broadcast, encoding the raw frames you publish to it.
- moq_
publish_ video_ raw_ 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_
publish_ video_ raw_ cut - Cut a new group at the next published frame.
- moq_
publish_ video_ raw_ finish - Flush any frames the codec is still holding and finalize the video track.
- moq_
publish_ ⚠video_ raw_ frame - Encode and publish one raw frame.
- 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_
session_ close - Request that a session shut down.
- moq_
session_ ⚠connect - Start establishing a connection to a MoQ server.
- moq_
session_ ⚠stats - Snapshot the current connection statistics for a session.
- moq_
versions ⚠ - List the protocol versions offered during the handshake by default.
Type Aliases§
- Status
- Status code returned by FFI functions.