Skip to main content

hang/catalog/
include.rs

1use serde::{Deserialize, Serialize};
2
3/// A whole broadcast whose own catalog describes its renditions, listed without opening it.
4///
5/// It shares the listing catalog's PTS timeline and root settings, including `sync.clock` and
6/// `sync.interval`; its own catalog's settings are ignored.
7///
8/// Listing one subscribes to nothing: a consumer opens the include's catalog only when it
9/// selects it, including an HLS master listing its renditions. An on-demand publisher answers
10/// the catalog without starting media. Its rendition IDs belong to that broadcast, never the
11/// listing catalog.
12///
13/// Marked `#[non_exhaustive]` so optional fields can be added later. External callers build one
14/// with [`Include::new`].
15#[serde_with::serde_as]
16#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
17#[non_exhaustive]
18pub struct Include {
19	/// The include's broadcast, relative to the broadcast serving this catalog.
20	///
21	/// Resolve it with [`Path::try_resolve`](moq_net::Path::try_resolve): a reference that walks
22	/// above the root names no broadcast, so the catalog is rejected.
23	pub broadcast: moq_net::path::Relative,
24}
25
26impl crate::catalog::Entry for Include {}
27
28impl Include {
29	/// An include at `broadcast`, accepting whichever stream resolves.
30	pub fn new(broadcast: impl Into<moq_net::path::Relative>) -> Self {
31		Self {
32			broadcast: broadcast.into(),
33		}
34	}
35}