Class Representation.MultiSegmentRepresentation
- java.lang.Object
-
- com.google.android.exoplayer2.source.dash.manifest.Representation
-
- com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation
-
- All Implemented Interfaces:
DashSegmentIndex
- Enclosing class:
- Representation
public static class Representation.MultiSegmentRepresentation extends Representation implements DashSegmentIndex
A DASH representation consisting of multiple segments.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.android.exoplayer2.source.dash.manifest.Representation
Representation.MultiSegmentRepresentation, Representation.SingleSegmentRepresentation
-
-
Field Summary
-
Fields inherited from class com.google.android.exoplayer2.source.dash.manifest.Representation
baseUrls, essentialProperties, format, inbandEventStreams, presentationTimeOffsetUs, REVISION_ID_DEFAULT, revisionId, supplementalProperties
-
Fields inherited from interface com.google.android.exoplayer2.source.dash.DashSegmentIndex
INDEX_UNBOUNDED
-
-
Constructor Summary
Constructors Constructor Description MultiSegmentRepresentation(long revisionId, Format format, List<BaseUrl> baseUrls, SegmentBase.MultiSegmentBase segmentBase, List<Descriptor> inbandEventStreams, List<Descriptor> essentialProperties, List<Descriptor> supplementalProperties)Creates the multi-segment Representation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAvailableSegmentCount(long periodDurationUs, long nowUnixTimeUs)Returns the number of available segments in the index.StringgetCacheKey()Returns a cache key for the representation if set, or null.longgetDurationUs(long segmentNum, long periodDurationUs)Returns the duration of a segment.longgetFirstAvailableSegmentNum(long periodDurationUs, long nowUnixTimeUs)Returns the segment number of the first available segment in the index.longgetFirstSegmentNum()Returns the segment number of the first defined segment in the index.DashSegmentIndexgetIndex()Returns an index if the representation provides one directly, or null otherwise.RangedUrigetIndexUri()Returns aRangedUridefining the location of the representation's segment index, or null if the representation provides an index directly.longgetNextSegmentAvailableTimeUs(long periodDurationUs, long nowUnixTimeUs)Returns the time, in microseconds, at which a new segment becomes available, orC.TIME_UNSETif not applicable.longgetSegmentCount(long periodDurationUs)Returns the number of segments defined in the index, orDashSegmentIndex.INDEX_UNBOUNDED.longgetSegmentNum(long timeUs, long periodDurationUs)ReturnsgetFirstSegmentNum()if the index has no segments or if the given media time is earlier than the start of the first segment.RangedUrigetSegmentUrl(long segmentNum)Returns aRangedUridefining the location of a segment.longgetTimeUs(long segmentNum)Returns the start time of a segment.booleanisExplicit()Returns true if segments are defined explicitly by the index.-
Methods inherited from class com.google.android.exoplayer2.source.dash.manifest.Representation
getInitializationUri, newInstance, newInstance
-
-
-
-
Constructor Detail
-
MultiSegmentRepresentation
public MultiSegmentRepresentation(long revisionId, Format format, List<BaseUrl> baseUrls, SegmentBase.MultiSegmentBase segmentBase, @Nullable List<Descriptor> inbandEventStreams, List<Descriptor> essentialProperties, List<Descriptor> supplementalProperties)Creates the multi-segment Representation.- Parameters:
revisionId- Identifies the revision of the content.format- The format of the representation.baseUrls- The base URLs of the representation.segmentBase- The segment base underlying the representation.inbandEventStreams- The in-band event streams in the representation. May be null.essentialProperties- Essential properties in the representation. May be empty.supplementalProperties- Supplemental properties in the representation. May be empty.
-
-
Method Detail
-
getIndexUri
@Nullable public RangedUri getIndexUri()
Description copied from class:RepresentationReturns aRangedUridefining the location of the representation's segment index, or null if the representation provides an index directly.- Specified by:
getIndexUriin classRepresentation
-
getIndex
public DashSegmentIndex getIndex()
Description copied from class:RepresentationReturns an index if the representation provides one directly, or null otherwise.- Specified by:
getIndexin classRepresentation
-
getCacheKey
@Nullable public String getCacheKey()
Description copied from class:RepresentationReturns a cache key for the representation if set, or null.- Specified by:
getCacheKeyin classRepresentation
-
getSegmentUrl
public RangedUri getSegmentUrl(long segmentNum)
Description copied from interface:DashSegmentIndexReturns aRangedUridefining the location of a segment.- Specified by:
getSegmentUrlin interfaceDashSegmentIndex- Parameters:
segmentNum- The segment number.- Returns:
- The
RangedUridefining the location of the data.
-
getSegmentNum
public long getSegmentNum(long timeUs, long periodDurationUs)Description copied from interface:DashSegmentIndexReturnsgetFirstSegmentNum()if the index has no segments or if the given media time is earlier than the start of the first segment. ReturnsgetFirstSegmentNum() + getSegmentCount() - 1if 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.- Specified by:
getSegmentNumin interfaceDashSegmentIndex- Parameters:
timeUs- The time in microseconds.periodDurationUs- The duration of the enclosing period in microseconds, orC.TIME_UNSETif the period's duration is not yet known.- Returns:
- The segment number of the corresponding segment.
-
getTimeUs
public long getTimeUs(long segmentNum)
Description copied from interface:DashSegmentIndexReturns the start time of a segment.- Specified by:
getTimeUsin interfaceDashSegmentIndex- Parameters:
segmentNum- The segment number.- Returns:
- The corresponding start time in microseconds.
-
getDurationUs
public long getDurationUs(long segmentNum, long periodDurationUs)Description copied from interface:DashSegmentIndexReturns the duration of a segment.- Specified by:
getDurationUsin interfaceDashSegmentIndex- Parameters:
segmentNum- The segment number.periodDurationUs- The duration of the enclosing period in microseconds, orC.TIME_UNSETif the period's duration is not yet known.- Returns:
- The duration of the segment, in microseconds.
-
getFirstSegmentNum
public long getFirstSegmentNum()
Description copied from interface:DashSegmentIndexReturns the segment number of the first defined segment in the index.- Specified by:
getFirstSegmentNumin interfaceDashSegmentIndex
-
getFirstAvailableSegmentNum
public long getFirstAvailableSegmentNum(long periodDurationUs, long nowUnixTimeUs)Description copied from interface:DashSegmentIndexReturns the segment number of the first available segment in the index.- Specified by:
getFirstAvailableSegmentNumin interfaceDashSegmentIndex- Parameters:
periodDurationUs- The duration of the enclosing period in microseconds, orC.TIME_UNSETif the period's duration is not yet known.nowUnixTimeUs- The current time in milliseconds since the Unix epoch.- Returns:
- The number of the first available segment.
-
getSegmentCount
public long getSegmentCount(long periodDurationUs)
Description copied from interface:DashSegmentIndexReturns the number of segments defined in the index, orDashSegmentIndex.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 can query the available segment using
DashSegmentIndex.getFirstAvailableSegmentNum(long, long)andDashSegmentIndex.getAvailableSegmentCount(long, long).- Specified by:
getSegmentCountin interfaceDashSegmentIndex- Parameters:
periodDurationUs- The duration of the enclosing period in microseconds, orC.TIME_UNSETif the period's duration is not yet known.- Returns:
- The number of segments in the index, or
DashSegmentIndex.INDEX_UNBOUNDED.
-
getAvailableSegmentCount
public long getAvailableSegmentCount(long periodDurationUs, long nowUnixTimeUs)Description copied from interface:DashSegmentIndexReturns the number of available segments in the index.- Specified by:
getAvailableSegmentCountin interfaceDashSegmentIndex- Parameters:
periodDurationUs- The duration of the enclosing period in microseconds, orC.TIME_UNSETif the period's duration is not yet known.nowUnixTimeUs- The current time in milliseconds since the Unix epoch.- Returns:
- The number of available segments in the index.
-
getNextSegmentAvailableTimeUs
public long getNextSegmentAvailableTimeUs(long periodDurationUs, long nowUnixTimeUs)Description copied from interface:DashSegmentIndexReturns the time, in microseconds, at which a new segment becomes available, orC.TIME_UNSETif not applicable.- Specified by:
getNextSegmentAvailableTimeUsin interfaceDashSegmentIndex- Parameters:
periodDurationUs- The duration of the enclosing period in microseconds, orC.TIME_UNSETif the period's duration is not yet known.nowUnixTimeUs- The current time in milliseconds since the Unix epoch.- Returns:
- The time, in microseconds, at which a new segment becomes available, or
C.TIME_UNSETif not applicable.
-
isExplicit
public boolean isExplicit()
Description copied from interface:DashSegmentIndexReturns true if segments are defined explicitly by the index.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.
- Specified by:
isExplicitin interfaceDashSegmentIndex- Returns:
- Whether segments are defined explicitly by the index.
-
-