Skip to main content

moq_origin_request

Function moq_origin_request 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn moq_origin_request( origin: u32, path: *const c_char, path_len: usize, on_broadcast: Option<extern "C" fn(user_data: *mut c_void, broadcast: i32)>, user_data: *mut c_void, ) -> i32
Expand description

Request a broadcast from an origin by path, resolving as soon as it can be served.

Resolves against what is announced now plus any dynamic fallback, where moq_origin_consume_announced waits indefinitely for a future announcement: it returns an already-announced broadcast at once, otherwise falls back to a dynamic handler on the origin (if any), and fails when neither can serve the path. It does NOT wait for a later announcement.

on_broadcast is invoked with a positive broadcast handle once served, then exactly once more with a terminal code: 0 (finished, including after moq_origin_request_close) or a negative error. After the terminal (<= 0) callback, user_data is never touched again, so release it there. The broadcast handle is usable with moq_consume_catalog / moq_consume_track and must be freed separately with moq_consume_close.

Returns a non-zero handle to the request on success, or a negative code on (immediate) failure.

ยงSafety

  • The caller must ensure that path is a valid pointer to path_len bytes of data.
  • The caller must keep user_data valid until the terminal (<= 0) on_broadcast callback.