public static class Representation.MultiSegmentRepresentation extends Representation implements DashSegmentIndex
Representation.MultiSegmentRepresentation, Representation.SingleSegmentRepresentationbaseUrl, contentId, format, inbandEventStreams, presentationTimeOffsetUs, REVISION_ID_DEFAULT, revisionIdINDEX_UNBOUNDED| Constructor and Description |
|---|
MultiSegmentRepresentation(java.lang.String contentId,
long revisionId,
com.google.android.exoplayer2.Format format,
java.lang.String baseUrl,
SegmentBase.MultiSegmentBase segmentBase,
java.util.List<Descriptor> inbandEventStreams) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCacheKey()
Returns a cache key for the representation if a custom cache key or content id has been
provided and there is only single segment.
|
long |
getDurationUs(long segmentIndex,
long periodDurationUs)
Returns the duration of a segment.
|
long |
getFirstSegmentNum()
Returns the segment number of the first segment.
|
DashSegmentIndex |
getIndex()
Returns an index if the representation provides one directly, or null otherwise.
|
RangedUri |
getIndexUri()
Returns a
RangedUri defining the location of the representation's segment index, or
null if the representation provides an index directly. |
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 segmentIndex)
Returns a
RangedUri defining the location of a segment. |
long |
getTimeUs(long segmentIndex)
Returns the start time of a segment.
|
boolean |
isExplicit()
Returns true if segments are defined explicitly by the index.
|
getInitializationUri, newInstance, newInstance, newInstancepublic MultiSegmentRepresentation(java.lang.String contentId,
long revisionId,
com.google.android.exoplayer2.Format format,
java.lang.String baseUrl,
SegmentBase.MultiSegmentBase segmentBase,
java.util.List<Descriptor> inbandEventStreams)
contentId - Identifies the piece of content to which this representation belongs.revisionId - Identifies the revision of the content.format - The format of the representation.baseUrl - The base URL of the representation.segmentBase - The segment base underlying the representation.inbandEventStreams - The in-band event streams in the representation. May be null.public RangedUri getIndexUri()
RepresentationRangedUri defining the location of the representation's segment index, or
null if the representation provides an index directly.getIndexUri in class Representationpublic DashSegmentIndex getIndex()
RepresentationgetIndex in class Representationpublic java.lang.String getCacheKey()
RepresentationgetCacheKey in class Representationpublic RangedUri getSegmentUrl(long segmentIndex)
DashSegmentIndexRangedUri defining the location of a segment.getSegmentUrl in interface DashSegmentIndexsegmentIndex - 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 long getTimeUs(long segmentIndex)
DashSegmentIndexgetTimeUs in interface DashSegmentIndexsegmentIndex - The segment number.public long getDurationUs(long segmentIndex,
long periodDurationUs)
DashSegmentIndexgetDurationUs in interface DashSegmentIndexsegmentIndex - 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 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 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