Class DashWrappingSegmentIndex
- java.lang.Object
-
- com.google.android.exoplayer2.source.dash.DashWrappingSegmentIndex
-
- All Implemented Interfaces:
DashSegmentIndex
@Deprecated public final class DashWrappingSegmentIndex extends Object implements DashSegmentIndex
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.An implementation ofDashSegmentIndex
that wraps aChunkIndex
parsed from a media stream.
-
-
Field Summary
-
Fields inherited from interface com.google.android.exoplayer2.source.dash.DashSegmentIndex
INDEX_UNBOUNDED
-
-
Constructor Summary
Constructors Constructor Description DashWrappingSegmentIndex(ChunkIndex chunkIndex, long timeOffsetUs)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description long
getAvailableSegmentCount(long periodDurationUs, long nowUnixTimeUs)
Deprecated.Returns the number of available segments in the index.long
getDurationUs(long segmentNum, long periodDurationUs)
Deprecated.Returns the duration of a segment.long
getFirstAvailableSegmentNum(long periodDurationUs, long nowUnixTimeUs)
Deprecated.Returns the segment number of the first available segment in the index.long
getFirstSegmentNum()
Deprecated.Returns the segment number of the first defined segment in the index.long
getNextSegmentAvailableTimeUs(long periodDurationUs, long nowUnixTimeUs)
Deprecated.Returns the time, in microseconds, at which a new segment becomes available, orC.TIME_UNSET
if not applicable.long
getSegmentCount(long periodDurationUs)
Deprecated.Returns the number of segments defined in the index, orDashSegmentIndex.INDEX_UNBOUNDED
.long
getSegmentNum(long timeUs, long periodDurationUs)
Deprecated.ReturnsgetFirstSegmentNum()
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)
Deprecated.Returns aRangedUri
defining the location of a segment.long
getTimeUs(long segmentNum)
Deprecated.Returns the start time of a segment.boolean
isExplicit()
Deprecated.Returns true if segments are defined explicitly by the index.
-
-
-
Constructor Detail
-
DashWrappingSegmentIndex
public DashWrappingSegmentIndex(ChunkIndex chunkIndex, long timeOffsetUs)
Deprecated.- Parameters:
chunkIndex
- TheChunkIndex
to wrap.timeOffsetUs
- An offset to subtract from the times in the wrapped index, in microseconds.
-
-
Method Detail
-
getFirstSegmentNum
public long getFirstSegmentNum()
Deprecated.Description copied from interface:DashSegmentIndex
Returns the segment number of the first defined segment in the index.- Specified by:
getFirstSegmentNum
in interfaceDashSegmentIndex
-
getFirstAvailableSegmentNum
public long getFirstAvailableSegmentNum(long periodDurationUs, long nowUnixTimeUs)
Deprecated.Description copied from interface:DashSegmentIndex
Returns the segment number of the first available segment in the index.- Specified by:
getFirstAvailableSegmentNum
in interfaceDashSegmentIndex
- Parameters:
periodDurationUs
- The duration of the enclosing period in microseconds, orC.TIME_UNSET
if 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)
Deprecated.Description copied from interface:DashSegmentIndex
Returns 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:
getSegmentCount
in interfaceDashSegmentIndex
- Parameters:
periodDurationUs
- The duration of the enclosing period in microseconds, orC.TIME_UNSET
if 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)
Deprecated.Description copied from interface:DashSegmentIndex
Returns the number of available segments in the index.- Specified by:
getAvailableSegmentCount
in interfaceDashSegmentIndex
- Parameters:
periodDurationUs
- The duration of the enclosing period in microseconds, orC.TIME_UNSET
if 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)
Deprecated.Description copied from interface:DashSegmentIndex
Returns the time, in microseconds, at which a new segment becomes available, orC.TIME_UNSET
if not applicable.- Specified by:
getNextSegmentAvailableTimeUs
in interfaceDashSegmentIndex
- Parameters:
periodDurationUs
- The duration of the enclosing period in microseconds, orC.TIME_UNSET
if 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_UNSET
if not applicable.
-
getTimeUs
public long getTimeUs(long segmentNum)
Deprecated.Description copied from interface:DashSegmentIndex
Returns the start time of a segment.- Specified by:
getTimeUs
in interfaceDashSegmentIndex
- Parameters:
segmentNum
- The segment number.- Returns:
- The corresponding start time in microseconds.
-
getDurationUs
public long getDurationUs(long segmentNum, long periodDurationUs)
Deprecated.Description copied from interface:DashSegmentIndex
Returns the duration of a segment.- Specified by:
getDurationUs
in interfaceDashSegmentIndex
- Parameters:
segmentNum
- The segment number.periodDurationUs
- The duration of the enclosing period in microseconds, orC.TIME_UNSET
if the period's duration is not yet known.- Returns:
- The duration of the segment, in microseconds.
-
getSegmentUrl
public RangedUri getSegmentUrl(long segmentNum)
Deprecated.Description copied from interface:DashSegmentIndex
Returns aRangedUri
defining the location of a segment.- Specified by:
getSegmentUrl
in interfaceDashSegmentIndex
- Parameters:
segmentNum
- The segment number.- Returns:
- The
RangedUri
defining the location of the data.
-
getSegmentNum
public long getSegmentNum(long timeUs, long periodDurationUs)
Deprecated.Description copied from interface:DashSegmentIndex
ReturnsgetFirstSegmentNum()
if the index has no segments or if the given media time is earlier than the start of the first segment. ReturnsgetFirstSegmentNum() + 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.- Specified by:
getSegmentNum
in interfaceDashSegmentIndex
- Parameters:
timeUs
- The time in microseconds.periodDurationUs
- The duration of the enclosing period in microseconds, orC.TIME_UNSET
if the period's duration is not yet known.- Returns:
- The segment number of the corresponding segment.
-
isExplicit
public boolean isExplicit()
Deprecated.Description copied from interface:DashSegmentIndex
Returns 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:
isExplicit
in interfaceDashSegmentIndex
- Returns:
- Whether segments are defined explicitly by the index.
-
-