pub struct MasterPlaylist {
pub version: u8,
pub variants: Vec<Variant>,
pub iframe_variants: Vec<IFrameVariant>,
pub extra_tags: Vec<String>,
pub independent_segments: bool,
pub start: Option<StartPoint>,
pub defines: Vec<Define>,
pub session_data: Vec<SessionData>,
pub session_keys: Vec<SessionKey>,
pub content_steering: Option<ContentSteering>,
}Expand description
A master playlist (#EXTM3U / #EXT-X-STREAM-INF / …).
Fields§
§version: u8#EXT-X-VERSION — an explicit floor, not the rendered value. 0
means “no explicit floor”: Self::to_m3u8 renders exactly
Self::computed_version, or no tag at all when nothing triggers
one. A nonzero value is raised — never lowered — to the computed
minimum. See the module’s “Protocol version derivation” docs
(issue #871).
variants: Vec<Variant>Ordered list of variant streams.
iframe_variants: Vec<IFrameVariant>Ordered list of I-frame-only renditions (RFC 8216 §4.3.4.2).
Each entry is rendered as an #EXT-X-I-FRAME-STREAM-INF line with the
URI as an attribute (not a following line). An empty Vec (the
default) produces no such lines.
Extra tag lines emitted verbatim after the variant/I-frame-variant
entries (e.g. #EXT-X-MEDIA:...) — the Multivariant-Playlist
counterpart of MediaPlaylist::extra_tags. Self::parse
preserves any unrecognized #EXT-... tag here (forward-compat)
instead of dropping it; Self::computed_version scans these lines
for the §8 rows this crate does not model as typed struct fields
(rows 7/12/13 — docs/version-compatibility.md). Rows 8 and 11 were
also scanned here until issue #872 gave EXT-X-DEFINE a typed
representation; they now read Self::defines instead.
independent_segments: bool#EXT-X-INDEPENDENT-SEGMENTS (RFC 8216bis §4.4.2.1, issue #872).
start: Option<StartPoint>#EXT-X-START (RFC 8216bis §4.4.2.2, issue #872).
defines: Vec<Define>#EXT-X-DEFINE entries (RFC 8216bis §4.4.2.3, issue #872), in wire
order. Feeds §8 row 11 via Self::computed_version.
session_data: Vec<SessionData>#EXT-X-SESSION-DATA entries (RFC 8216bis §4.4.6.4, issue #872), in
wire order.
session_keys: Vec<SessionKey>#EXT-X-SESSION-KEY entries (RFC 8216bis §4.4.6.5, issue #872), in
wire order.
content_steering: Option<ContentSteering>#EXT-X-CONTENT-STEERING (RFC 8216bis §4.4.6.6, issue #872) — at most
one per Playlist.
Implementations§
Source§impl MasterPlaylist
impl MasterPlaylist
Sourcepub fn to_m3u8(&self) -> String
pub fn to_m3u8(&self) -> String
Render this master playlist as an RFC 8216 #EXTM3U string.
After the regular #EXT-X-STREAM-INF variant lines, emits one
#EXT-X-I-FRAME-STREAM-INF line per entry in
Self::iframe_variants (RFC 8216 §4.3.4.2). The URI is rendered
as an attribute on the tag line itself — not on a following line.
Sourcepub fn parse(input: &str) -> Result<Self>
pub fn parse(input: &str) -> Result<Self>
Parse an RFC 8216 #EXTM3U Multivariant (Master) Playlist — the
symmetric inverse of Self::to_m3u8.
Recognizes #EXT-X-VERSION, #EXT-X-STREAM-INF + its following URI
line, and #EXT-X-I-FRAME-STREAM-INF. #EXT-X-MEDIA (alternate
audio/subtitle renditions), #EXT-X-DEFINE, and any other
unrecognized #EXT-... tag are not modeled with typed fields, but
are preserved verbatim into Self::extra_tags (forward-compat),
mirroring MediaPlaylist::parse. A malformed
#EXT-X-STREAM-INF/#EXT-X-I-FRAME-STREAM-INF (missing required
attribute, unparsable value) or a variant URI with no preceding
#EXT-X-STREAM-INF returns crate::Error::HlsParse.
Sourcepub fn computed_version(&self) -> Option<u8>
pub fn computed_version(&self) -> Option<u8>
Compute the minimum #EXT-X-VERSION this Multivariant Playlist’s
actual content requires, per RFC 8216bis §8
(docs/version-compatibility.md). None means fully compatible
with version 1 (no tag required). See
MediaPlaylist::computed_version for the Media-Playlist-only rows
(2–6, 9–10) that do not apply to a Multivariant Playlist.
Trait Implementations§
Source§impl Clone for MasterPlaylist
impl Clone for MasterPlaylist
Source§fn clone(&self) -> MasterPlaylist
fn clone(&self) -> MasterPlaylist
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more