public final class DashWrappingSegmentIndex extends Object implements DashSegmentIndex
DashSegmentIndex
that wraps a ChunkIndex
parsed from a
media stream.INDEX_UNBOUNDED
Constructor and Description |
---|
DashWrappingSegmentIndex(ChunkIndex chunkIndex) |
Modifier and Type | Method and Description |
---|---|
long |
getDurationUs(int segmentNum,
long periodDurationUs)
Returns the duration of a segment.
|
int |
getFirstSegmentNum()
Returns the segment number of the first segment.
|
int |
getSegmentCount(long periodDurationUs)
Returns the number of segments in the index, or
DashSegmentIndex.INDEX_UNBOUNDED . |
int |
getSegmentNum(long timeUs,
long periodDurationUs)
Returns
getFirstSegmentNum() if the index has no segments or if the given media time is
earlier than the start of the first segment. |
RangedUri |
getSegmentUrl(int segmentNum)
Returns a
RangedUri defining the location of a segment. |
long |
getTimeUs(int segmentNum)
Returns the start time of a segment.
|
boolean |
isExplicit()
Returns true if segments are defined explicitly by the index.
|
public DashWrappingSegmentIndex(ChunkIndex chunkIndex)
chunkIndex
- The ChunkIndex
to wrap.public int getFirstSegmentNum()
DashSegmentIndex
getFirstSegmentNum
in interface DashSegmentIndex
public int getSegmentCount(long periodDurationUs)
DashSegmentIndex
DashSegmentIndex.INDEX_UNBOUNDED
.
An unbounded index occurs if a dynamic manifest uses SegmentTemplate elements without a SegmentTimeline element, and if the period duration is not yet known. In this case the caller must manually determine the window of currently available segments.
getSegmentCount
in interface DashSegmentIndex
periodDurationUs
- The duration of the enclosing period in microseconds, or
C.TIME_UNSET
if the period's duration is not yet known.DashSegmentIndex.INDEX_UNBOUNDED
.public long getTimeUs(int segmentNum)
DashSegmentIndex
getTimeUs
in interface DashSegmentIndex
segmentNum
- The segment number.public long getDurationUs(int segmentNum, long periodDurationUs)
DashSegmentIndex
getDurationUs
in interface DashSegmentIndex
segmentNum
- The segment number.periodDurationUs
- The duration of the enclosing period in microseconds, or
C.TIME_UNSET
if the period's duration is not yet known.public RangedUri getSegmentUrl(int segmentNum)
DashSegmentIndex
RangedUri
defining the location of a segment.getSegmentUrl
in interface DashSegmentIndex
segmentNum
- The segment number.RangedUri
defining the location of the data.public int getSegmentNum(long timeUs, long periodDurationUs)
DashSegmentIndex
getFirstSegmentNum()
if the index has no segments or if the given media time is
earlier than the start of the first segment. Returns getFirstSegmentNum() +
getSegmentCount() - 1
if the given media time is later than the end of the last segment.
Otherwise, returns the segment number of the segment containing the given media time.getSegmentNum
in interface DashSegmentIndex
timeUs
- The time in microseconds.periodDurationUs
- The duration of the enclosing period in microseconds, or
C.TIME_UNSET
if the period's duration is not yet known.public boolean isExplicit()
DashSegmentIndex
If true is returned, each segment is defined explicitly by the index data, and all of the listed segments are guaranteed to be available at the time when the index was obtained.
If false is returned then segment information was derived from properties such as a fixed segment duration. If the presentation is dynamic, it's possible that only a subset of the segments are available.
isExplicit
in interface DashSegmentIndex