pub struct Source { /* private fields */ }Expand description
The subscription side of an export: an origin and the path of the broadcast whose catalog drives it.
The catalog broadcast and every rendition (including ones whose catalog
broadcast field references a sibling broadcast) resolve against origin,
so a source can always follow a cross-broadcast reference. Build one with
Source::new.
Implementations§
Source§impl Source
impl Source
Sourcepub fn new(origin: Consumer, path: impl AsPath) -> Self
pub fn new(origin: Consumer, path: impl AsPath) -> Self
A source rooted at origin, driven by the catalog of the broadcast at path.
path names the broadcast whose catalog is exported; a rendition’s relative
broadcast reference is resolved against it. Both the catalog broadcast and any
referenced broadcast are fetched via
origin.request_broadcast, so they
must be reachable through origin (announced, or served by a dynamic handler).
Sourcepub async fn broadcast(&self) -> Result<Consumer>
pub async fn broadcast(&self) -> Result<Consumer>
Resolve and subscribe to the catalog broadcast (the one at this source’s path).
Sourcepub async fn resolve(&self, rel: Option<&PathRelative<'_>>) -> Result<Consumer>
pub async fn resolve(&self, rel: Option<&PathRelative<'_>>) -> Result<Consumer>
Resolve an optional cross-broadcast reference to its broadcast.
rel is a rendition’s catalog broadcast field: None (or an empty / self
reference) resolves the catalog broadcast itself; anything else fetches the
referenced sibling broadcast from the origin. Use it when you need the broadcast
handle itself (e.g. to FETCH individual groups) rather than a subscription.
Sourcepub async fn subscribe_track(
&self,
rel: Option<&PathRelative<'_>>,
name: &str,
) -> Result<Subscriber>
pub async fn subscribe_track( &self, rel: Option<&PathRelative<'_>>, name: &str, ) -> Result<Subscriber>
Resolve an optional cross-broadcast reference and subscribe to track name,
awaiting SUBSCRIBE_OK.
rel is a rendition’s catalog broadcast field: None (or an empty / self
reference) subscribes on the catalog broadcast; anything else fetches the
referenced broadcast from the origin first.
This is the async counterpart to the poll-driven container exporters: consumers
that wrap a raw moq_net::track::Subscriber themselves (e.g. the WebRTC egress)
use it to honor cross-broadcast renditions without reimplementing the path math.