DashSegmentIndex
@UnstableApi
interface DashSegmentIndex
DashWrappingSegmentIndex |
An implementation of |
Representation.MultiSegmentRepresentation |
A DASH representation consisting of multiple segments. |
Indexes the segments within a media stream.
Summary
Constants |
|
|---|---|
const Int |
INDEX_UNBOUNDED = -1 |
Public functions |
|
|---|---|
Long |
getAvailableSegmentCount(periodDurationUs: Long, nowUnixTimeUs: Long)Returns the number of available segments in the index. |
Long |
getDurationUs(segmentNum: Long, periodDurationUs: Long)Returns the duration of a segment. |
Long |
getFirstAvailableSegmentNum(periodDurationUs: Long, nowUnixTimeUs: Long)Returns the segment number of the first available segment in the index. |
Long |
Returns the segment number of the first defined segment in the index. |
Long |
getNextSegmentAvailableTimeUs(Returns the time, in microseconds, at which a new segment becomes available, or |
Long |
getSegmentCount(periodDurationUs: Long)Returns the number of segments defined in the index, or |
Long |
getSegmentNum(timeUs: Long, periodDurationUs: Long)Returns |
RangedUri! |
getSegmentUrl(segmentNum: Long)Returns a |
Long |
Returns the start time of a segment. |
Boolean |
Returns true if segments are defined explicitly by the index. |
Constants
Public functions
getAvailableSegmentCount
fun getAvailableSegmentCount(periodDurationUs: Long, nowUnixTimeUs: Long): Long
Returns the number of available segments in the index.
| Parameters | |
|---|---|
periodDurationUs: Long |
The duration of the enclosing period in microseconds, or |
nowUnixTimeUs: Long |
The current time in milliseconds since the Unix epoch. |
| Returns | |
|---|---|
Long |
The number of available segments in the index. |
getDurationUs
fun getDurationUs(segmentNum: Long, periodDurationUs: Long): Long
Returns the duration of a segment.
| Parameters | |
|---|---|
segmentNum: Long |
The segment number. |
periodDurationUs: Long |
The duration of the enclosing period in microseconds, or |
| Returns | |
|---|---|
Long |
The duration of the segment, in microseconds. |
getFirstAvailableSegmentNum
fun getFirstAvailableSegmentNum(periodDurationUs: Long, nowUnixTimeUs: Long): Long
Returns the segment number of the first available segment in the index.
| Parameters | |
|---|---|
periodDurationUs: Long |
The duration of the enclosing period in microseconds, or |
nowUnixTimeUs: Long |
The current time in milliseconds since the Unix epoch. |
| Returns | |
|---|---|
Long |
The number of the first available segment. |
getFirstSegmentNum
fun getFirstSegmentNum(): Long
Returns the segment number of the first defined segment in the index.
getNextSegmentAvailableTimeUs
fun getNextSegmentAvailableTimeUs(
periodDurationUs: Long,
nowUnixTimeUs: Long
): Long
Returns the time, in microseconds, at which a new segment becomes available, or TIME_UNSET if not applicable.
| Parameters | |
|---|---|
periodDurationUs: Long |
The duration of the enclosing period in microseconds, or |
nowUnixTimeUs: Long |
The current time in milliseconds since the Unix epoch. |
| Returns | |
|---|---|
Long |
The time, in microseconds, at which a new segment becomes available, or |
getSegmentCount
fun getSegmentCount(periodDurationUs: Long): Long
Returns the number of segments defined in the index, or 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 getFirstAvailableSegmentNum and getAvailableSegmentCount.
| Parameters | |
|---|---|
periodDurationUs: Long |
The duration of the enclosing period in microseconds, or |
| Returns | |
|---|---|
Long |
The number of segments in the index, or |
getSegmentNum
fun getSegmentNum(timeUs: Long, periodDurationUs: Long): Long
Returns getFirstSegmentNum() 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.
| Parameters | |
|---|---|
timeUs: Long |
The time in microseconds. |
periodDurationUs: Long |
The duration of the enclosing period in microseconds, or |
| Returns | |
|---|---|
Long |
The segment number of the corresponding segment. |
getSegmentUrl
fun getSegmentUrl(segmentNum: Long): RangedUri!
Returns a RangedUri defining the location of a segment.
| Parameters | |
|---|---|
segmentNum: Long |
The segment number. |
getTimeUs
fun getTimeUs(segmentNum: Long): Long
Returns the start time of a segment.
| Parameters | |
|---|---|
segmentNum: Long |
The segment number. |
| Returns | |
|---|---|
Long |
The corresponding start time in microseconds. |
isExplicit
fun isExplicit(): Boolean
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.
| Returns | |
|---|---|
Boolean |
Whether segments are defined explicitly by the index. |