SegmentBase.SegmentTemplate


public final class SegmentBase.SegmentTemplate extends SegmentBase.MultiSegmentBase


A MultiSegmentBase that uses a SegmentTemplate to define its segments.

Summary

Public constructors

SegmentTemplate(
    RangedUri initialization,
    long timescale,
    long presentationTimeOffset,
    long startNumber,
    long endNumber,
    long duration,
    @Nullable List<SegmentBase.SegmentTimelineElement> segmentTimeline,
    long availabilityTimeOffsetUs,
    @Nullable UrlTemplate initializationTemplate,
    @Nullable UrlTemplate mediaTemplate,
    long timeShiftBufferDepthUs,
    long periodStartUnixTimeUs
)

Public methods

@Nullable RangedUri

Returns the RangedUri defining the location of initialization data for a given representation, or null if no initialization data exists.

long
getSegmentCount(long periodDurationUs)

See getSegmentCount.

RangedUri
getSegmentUrl(Representation representation, long sequenceNumber)

Returns a RangedUri defining the location of a segment for the given index in the given representation.

Inherited methods

From androidx.media3.exoplayer.dash.manifest.SegmentBase
long

Returns the presentation time offset, in microseconds.

From androidx.media3.exoplayer.dash.manifest.SegmentBase.MultiSegmentBase
long
getAvailableSegmentCount(long periodDurationUs, long nowUnixTimeUs)

See getAvailableSegmentCount.

long
getFirstAvailableSegmentNum(long periodDurationUs, long nowUnixTimeUs)

See getFirstAvailableSegmentNum.

long

See getFirstSegmentNum.

long
getNextSegmentAvailableTimeUs(
    long periodDurationUs,
    long nowUnixTimeUs
)

See getNextSegmentAvailableTimeUs.

final long
getSegmentDurationUs(long sequenceNumber, long periodDurationUs)

See getDurationUs.

long
getSegmentNum(long timeUs, long periodDurationUs)

See getSegmentNum.

final long
getSegmentTimeUs(long sequenceNumber)

See getTimeUs.

boolean

See isExplicit

Public constructors

SegmentTemplate

public SegmentTemplate(
    RangedUri initialization,
    long timescale,
    long presentationTimeOffset,
    long startNumber,
    long endNumber,
    long duration,
    @Nullable List<SegmentBase.SegmentTimelineElement> segmentTimeline,
    long availabilityTimeOffsetUs,
    @Nullable UrlTemplate initializationTemplate,
    @Nullable UrlTemplate mediaTemplate,
    long timeShiftBufferDepthUs,
    long periodStartUnixTimeUs
)
Parameters
RangedUri initialization

A RangedUri corresponding to initialization data, if such data exists. The value of this parameter is ignored if initializationTemplate is non-null.

long timescale

The timescale in units per second.

long presentationTimeOffset

The presentation time offset. The value in seconds is the division of this value and timescale.

long startNumber

The sequence number of the first segment.

long endNumber

The sequence number of the last segment as specified by the SupplementalProperty with schemeIdUri="http://dashif.org/guidelines/last-segment-number", or INDEX_UNSET.

long duration

The duration of each segment in the case of fixed duration segments. The value in seconds is the division of this value and timescale. If segmentTimeline is non-null then this parameter is ignored.

@Nullable List<SegmentBase.SegmentTimelineElement> segmentTimeline

A segment timeline corresponding to the segments. If null, then segments are assumed to be of fixed duration as specified by the duration parameter.

long availabilityTimeOffsetUs

The offset to the current realtime at which segments become available in microseconds, or TIME_UNSET if not applicable.

@Nullable UrlTemplate initializationTemplate

A template defining the location of initialization data, if such data exists. If non-null then the initialization parameter is ignored. If null then initialization will be used.

@Nullable UrlTemplate mediaTemplate

A template defining the location of each media segment.

long timeShiftBufferDepthUs

The time shift buffer depth in microseconds.

long periodStartUnixTimeUs

The start of the enclosing period in microseconds since the Unix epoch.

Public methods

getInitialization

public @Nullable RangedUri getInitialization(Representation representation)

Returns the RangedUri defining the location of initialization data for a given representation, or null if no initialization data exists.

Parameters
Representation representation

The Representation for which initialization data is required.

Returns
@Nullable RangedUri

A RangedUri defining the location of the initialization data, or null.

getSegmentCount

public long getSegmentCount(long periodDurationUs)

See getSegmentCount.

getSegmentUrl

public RangedUri getSegmentUrl(Representation representation, long sequenceNumber)

Returns a RangedUri defining the location of a segment for the given index in the given representation.

See getSegmentUrl.