public static class Representation.MultiSegmentRepresentation extends Representation implements DashSegmentIndex
Representation.MultiSegmentRepresentation, Representation.SingleSegmentRepresentationbaseUrl, contentId, format, presentationTimeOffsetUs, revisionIdINDEX_UNBOUNDED| Constructor and Description |
|---|
MultiSegmentRepresentation(String contentId,
long revisionId,
Format format,
SegmentBase.MultiSegmentBase segmentBase,
String customCacheKey,
String baseUrl) |
| 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, newInstancepublic MultiSegmentRepresentation(String contentId, long revisionId, Format format, SegmentBase.MultiSegmentBase segmentBase, String customCacheKey, String baseUrl)
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()
RepresentationRangedUri defining the location of the representation's segment index. Null if
the representation provides an index directly.getIndexUri in class Representationpublic DashSegmentIndex getIndex()
RepresentationgetIndex in class Representationpublic RangedUri getSegmentUrl(int segmentIndex)
DashSegmentIndexRangedUri defining the location of a segment.getSegmentUrl in interface DashSegmentIndexsegmentIndex - 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 DashSegmentIndextimeUs - 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)
DashSegmentIndexgetTimeUs in interface DashSegmentIndexsegmentIndex - The segment number.public long getDurationUs(int segmentIndex,
long periodDurationUs)
DashSegmentIndexgetDurationUs in interface DashSegmentIndexsegmentIndex - 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()
DashSegmentIndexgetFirstSegmentNum in interface DashSegmentIndexpublic int getLastSegmentNum(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.
getLastSegmentNum in interface DashSegmentIndexperiodDurationUs - 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()
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