Skip to main content

moq_origin_announced_broadcast

Function moq_origin_announced_broadcast 

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

Consume a broadcast from an origin by path, waiting until something can serve it.

Resolves against future announcements: it waits for the announcement to arrive (e.g. over the network) and then delivers the broadcast handle via on_broadcast. Use it right after moq_session_connect to avoid racing announcement gossip. To resolve against only what is reachable now, use moq_origin_request instead. A broadcast created on this origin resolves once it is announced, like a remote one.

on_broadcast is invoked with a positive broadcast handle once announced, then exactly once more with a terminal code: 0 (the wait finished, including after moq_origin_announced_broadcast_cancel) or a negative error. After the terminal (<= 0) callback, on_broadcast is never called again and user_data is never touched again, so release user_data 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 wait 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.