pub struct SegmentPlan { /* private fields */ }Expand description
The ordered Media Segments of one Representation in one Period.
Implementations§
Source§impl SegmentPlan
impl SegmentPlan
Sourcepub fn build(input: &PlanInput<'_>) -> Result<Self, AddressError>
pub fn build(input: &PlanInput<'_>) -> Result<Self, AddressError>
Build the plan.
§Errors
AddressError: the Representation is to be dropped (or, for
AddressError::IndexRequired, planned again once the sidx is
fetched).
Sourcepub fn presentation_time_offset(&self) -> u64
pub fn presentation_time_offset(&self) -> u64
@presentationTimeOffset in ticks.
Sourcepub fn period_start_us(&self) -> i128
pub fn period_start_us(&self) -> i128
PeriodStart in microseconds.
Sourcepub fn is_dynamic(&self) -> bool
pub fn is_dynamic(&self) -> bool
Whether availability data is attached (dynamic MPD).
Sourcepub fn len(&self) -> Option<u64>
pub fn len(&self) -> Option<u64>
Number of segments; None when the plan is open-ended (a duration
template of a Period with no known end).
Sourcepub fn get(&self, index: u64) -> Result<Option<SegmentRef>, AddressError>
pub fn get(&self, index: u64) -> Result<Option<SegmentRef>, AddressError>
The segment at zero-based index; Ok(None) past the end.
§Errors
AddressError when a media template cannot be rendered (a template
naming a value the plan has none for, which SegmentPlan::build
already refuses) or the index arithmetic overflows.
Sourcepub fn iter(&self) -> impl Iterator<Item = SegmentRef> + '_
pub fn iter(&self) -> impl Iterator<Item = SegmentRef> + '_
The segments in order. For an open-ended plan this never ends; bound it
with take.
Sourcepub fn init(&self) -> Option<ResourceRef>
pub fn init(&self) -> Option<ResourceRef>
The Initialization Segment address, with its availability window.
Sourcepub fn index(&self) -> Option<ResourceRef>
pub fn index(&self) -> Option<ResourceRef>
The Index Segment address (the sidx of a SegmentBase Representation,
or a RepresentationIndex).
Sourcepub fn index_at_or_before(
&self,
period_time_us: i128,
) -> Result<Option<u64>, AddressError>
pub fn index_at_or_before( &self, period_time_us: i128, ) -> Result<Option<u64>, AddressError>
Index of the last segment whose Period-relative start is at or before
period_time_us; None before the first segment.
Sourcepub fn available_from_us(
&self,
index: u64,
) -> Result<Option<i128>, AddressError>
pub fn available_from_us( &self, index: u64, ) -> Result<Option<i128>, AddressError>
Availability start of the segment at index.
Sourcepub fn available_until_us(
&self,
index: u64,
) -> Result<Option<i128>, AddressError>
pub fn available_until_us( &self, index: u64, ) -> Result<Option<i128>, AddressError>
Availability end of the segment at index.