pub struct InterstitialDateRange {
pub id: String,
pub start_date: String,
pub duration: Option<f64>,
pub asset: AssetSource,
pub resume_offset: Option<f64>,
pub playout_limit: Option<f64>,
pub snap: Vec<SnapMode>,
pub restrict: Vec<RestrictMode>,
}Expand description
A rendered Interstitial EXT-X-DATERANGE tag: an AdBreakDecision
plus the base-tag scheduling fields (START-DATE, DURATION, RFC 8216bis
§4.4.5.1) the decision itself does not carry.
Fields§
§id: StringID (quoted).
start_date: StringSTART-DATE (quoted, ISO-8601/RFC3339) — caller-supplied; this
module does no wall-clock math.
duration: Option<f64>DURATION in seconds, if known.
asset: AssetSourceX-ASSET-URI or X-ASSET-LIST.
resume_offset: Option<f64>X-RESUME-OFFSET in seconds.
playout_limit: Option<f64>X-PLAYOUT-LIMIT in seconds.
snap: Vec<SnapMode>X-SNAP identifiers.
restrict: Vec<RestrictMode>X-RESTRICT identifiers.
Implementations§
Source§impl InterstitialDateRange
impl InterstitialDateRange
Sourcepub fn from_decision(
decision: &AdBreakDecision,
start_date: impl Into<String>,
duration: Option<f64>,
) -> Self
pub fn from_decision( decision: &AdBreakDecision, start_date: impl Into<String>, duration: Option<f64>, ) -> Self
Build from an AdBreakDecision plus the two base-tag fields it
doesn’t carry.
Sourcepub fn to_tag_line(&self) -> Result<String>
pub fn to_tag_line(&self) -> Result<String>
Render one #EXT-X-DATERANGE: line. Attribute order is fixed (ID,
CLASS, START-DATE, DURATION, X-ASSET-URI/X-ASSET-LIST,
X-RESUME-OFFSET, X-PLAYOUT-LIMIT, X-SNAP, X-RESTRICT) so
Self::parse_tag_line round-trips. Built solely from the typed
fields above — no stored source span is echoed.
Every attribute value goes through AttrValue::quoted/bare
(issue #1140 / audit r14-SSAI-W1) before
broadcast_hls::render_attribute_list renders it: id,
start_date and the asset URI/list are frequently supplied (directly
or indirectly) by an crate::decision::AdDecisionProvider — a
third-party ad-decision service — so a ", CR or LF in any of them
is rejected here rather than terminating the attribute list and
injecting arbitrary tag lines into the session playlist. duration/
resume_offset/playout_limit must also be finite and non-negative
(audit r14-SSAI-W4) — Error::InvalidDuration otherwise.
Sourcepub fn parse_tag_line(s: &str) -> Result<Self>
pub fn parse_tag_line(s: &str) -> Result<Self>
Parse one #EXT-X-DATERANGE: line with
CLASS="com.apple.hls.interstitial". Errors with
Error::TagParse if the CLASS doesn’t match (or is missing) or a
required attribute is absent, and Error::InvalidAssetSource if
neither or both of X-ASSET-URI/X-ASSET-LIST are present.