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: moq_status_callback, 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, where moq_origin_announced_broadcast waits indefinitely: it returns an announced broadcast at once, and fails when none is reachable, including a broadcast created but not announced. It does NOT wait for a later announcement. Serve on-demand paths with moq_origin_dynamic.

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_cancel) 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.