public final class DashWrappingSegmentIndex extends java.lang.Object implements DashSegmentIndex
DashSegmentIndex that wraps a ChunkIndex parsed from a
media stream.INDEX_UNBOUNDED| Constructor and Description |
|---|
DashWrappingSegmentIndex(com.google.android.exoplayer2.extractor.ChunkIndex chunkIndex,
long timeOffsetUs) |
| Modifier and Type | Method and Description |
|---|---|
long |
getDurationUs(long segmentNum,
long periodDurationUs)
Returns the duration of a segment.
|
long |
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. |
long |
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(long segmentNum)
Returns a
RangedUri defining the location of a segment. |
long |
getTimeUs(long segmentNum)
Returns the start time of a segment.
|
boolean |
isExplicit()
Returns true if segments are defined explicitly by the index.
|
public DashWrappingSegmentIndex(com.google.android.exoplayer2.extractor.ChunkIndex chunkIndex,
long timeOffsetUs)
chunkIndex - The ChunkIndex to wrap.timeOffsetUs - An offset to subtract from the times in the wrapped index, in microseconds.public long getFirstSegmentNum()
DashSegmentIndexgetFirstSegmentNum in interface DashSegmentIndexpublic int getSegmentCount(long periodDurationUs)
DashSegmentIndexDashSegmentIndex.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 DashSegmentIndexperiodDurationUs - 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(long segmentNum)
DashSegmentIndexgetTimeUs in interface DashSegmentIndexsegmentNum - The segment number.public long getDurationUs(long segmentNum,
long periodDurationUs)
DashSegmentIndexgetDurationUs in interface DashSegmentIndexsegmentNum - 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(long segmentNum)
DashSegmentIndexRangedUri defining the location of a segment.getSegmentUrl in interface DashSegmentIndexsegmentNum - The segment number.RangedUri defining the location of the data.public long getSegmentNum(long timeUs,
long periodDurationUs)
DashSegmentIndexgetFirstSegmentNum() 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 DashSegmentIndextimeUs - 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()
DashSegmentIndexIf 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