Skip to main content

Crate moq

Crate moq 

Source
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_container
The container of a video or audio rendition, plus whatever that container needs to describe itself.
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 match width x height; 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_container_kind
How a media track’s frames are wrapped, independent of the codec.
moq_video_codec
Output video codec for moq_publish_video_raw.
moq_video_encoder_kind
Which encoder implementation moq_publish_video_raw should 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_resolution_delay
Read the Resolution Delay, in milliseconds. See moq_client_set_resolution_delay and moq_client_get_connect_timeout for what an unset knob reports.
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_resolution_delay
Delay before dialing an IPv4 address while the full DNS answer is outstanding, in milliseconds.
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_announce callback.
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 path on 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. value is 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. value is 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 bitrate bits 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.