public static class Representation.MultiSegmentRepresentation extends Representation implements DashSegmentIndex
Representation.MultiSegmentRepresentation, Representation.SingleSegmentRepresentation
contentId, format, presentationTimeOffsetUs, revisionId
INDEX_UNBOUNDED
Constructor and Description |
---|
MultiSegmentRepresentation(String contentId,
long revisionId,
Format format,
SegmentBase.MultiSegmentBase segmentBase,
String customCacheKey) |
Modifier and Type | Method and Description |
---|---|
long |
getDurationUs(int segmentIndex,
long periodDurationUs)
Returns the duration of a segment.
|
int |
getFirstSegmentNum()
Returns the segment number of the first segment.
|
DashSegmentIndex |
getIndex()
Gets a segment index, if the representation is able to provide one directly.
|
RangedUri |
getIndexUri()
Gets a
RangedUri defining the location of the representation's segment index. |
int |
getLastSegmentNum(long periodDurationUs)
Returns the segment number of the last segment, or
DashSegmentIndex.INDEX_UNBOUNDED . |
int |
getSegmentNum(long timeUs,
long periodDurationUs)
Returns the segment number of the segment containing a given media time.
|
RangedUri |
getSegmentUrl(int segmentIndex)
Returns a
RangedUri defining the location of a segment. |
long |
getTimeUs(int segmentIndex)
Returns the start time of a segment.
|
boolean |
isExplicit()
Returns true if segments are defined explicitly by the index.
|
getCacheKey, getFormat, getInitializationUri, newInstance, newInstance
public MultiSegmentRepresentation(String contentId, long revisionId, Format format, SegmentBase.MultiSegmentBase segmentBase, String customCacheKey)
contentId
- Identifies the piece of content to which this representation belongs.revisionId
- Identifies the revision of the content.format
- The format of the representation.segmentBase
- The segment base underlying the representation.customCacheKey
- A custom value to be returned from Representation.getCacheKey()
, or null.public RangedUri getIndexUri()
Representation
RangedUri
defining the location of the representation's segment index. Null if
the representation provides an index directly.getIndexUri
in class Representation
public DashSegmentIndex getIndex()
Representation
getIndex
in class Representation
public RangedUri getSegmentUrl(int segmentIndex)
DashSegmentIndex
RangedUri
defining the location of a segment.getSegmentUrl
in interface DashSegmentIndex
segmentIndex
- The segment number.RangedUri
defining the location of the data.public int getSegmentNum(long timeUs, long periodDurationUs)
DashSegmentIndex
If the given media time is outside the range of the index, then the returned segment number is
clamped to DashSegmentIndex.getFirstSegmentNum()
(if the given media time is earlier the start of the
first segment) or DashSegmentIndex.getLastSegmentNum(long)
(if the given media time is later then the
end of the last segment).
getSegmentNum
in interface DashSegmentIndex
timeUs
- The time in microseconds.periodDurationUs
- The duration of the enclosing period in microseconds, or
C.UNKNOWN_TIME_US
if the period's duration is not yet known.public long getTimeUs(int segmentIndex)
DashSegmentIndex
getTimeUs
in interface DashSegmentIndex
segmentIndex
- The segment number.public long getDurationUs(int segmentIndex, long periodDurationUs)
DashSegmentIndex
getDurationUs
in interface DashSegmentIndex
segmentIndex
- The segment number.periodDurationUs
- The duration of the enclosing period in microseconds, or
C.UNKNOWN_TIME_US
if the period's duration is not yet known.public int getFirstSegmentNum()
DashSegmentIndex
getFirstSegmentNum
in interface DashSegmentIndex
public int getLastSegmentNum(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.
getLastSegmentNum
in interface DashSegmentIndex
periodDurationUs
- The duration of the enclosing period in microseconds, or
C.UNKNOWN_TIME_US
if the period's duration is not yet known.DashSegmentIndex.INDEX_UNBOUNDED
.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