Timeline.Period, Timeline.Window
Constructor and Description |
---|
SinglePeriodTimeline(long durationUs,
boolean isSeekable,
boolean isDynamic)
Creates a timeline containing a single period and a window that spans it.
|
SinglePeriodTimeline(long durationUs,
boolean isSeekable,
boolean isDynamic,
java.lang.Object tag)
Creates a timeline containing a single period and a window that spans it.
|
SinglePeriodTimeline(long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
java.lang.Object tag)
Creates a timeline with one period, and a window of known duration starting at a specified
position in the period.
|
SinglePeriodTimeline(long presentationStartTimeMs,
long windowStartTimeMs,
long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
java.lang.Object tag)
Creates a timeline with one period, and a window of known duration starting at a specified
position in the period.
|
Modifier and Type | Method and Description |
---|---|
int |
getIndexOfPeriod(java.lang.Object uid)
Returns the index of the period identified by its unique
id , or C.INDEX_UNSET
if the period is not in the timeline. |
Timeline.Period |
getPeriod(int periodIndex,
Timeline.Period period,
boolean setIds)
Populates a
Timeline.Period with data for the period at the specified index. |
int |
getPeriodCount()
Returns the number of periods in the timeline.
|
java.lang.Object |
getUidOfPeriod(int periodIndex)
Returns the unique id of the period identified by its index in the timeline.
|
Timeline.Window |
getWindow(int windowIndex,
Timeline.Window window,
boolean setTag,
long defaultPositionProjectionUs)
Populates a
Timeline.Window with data for the window at the specified index. |
int |
getWindowCount()
Returns the number of windows in the timeline.
|
getFirstWindowIndex, getLastWindowIndex, getNextPeriodIndex, getNextWindowIndex, getPeriod, getPeriodByUid, getPeriodPosition, getPeriodPosition, getPreviousWindowIndex, getWindow, getWindow, isEmpty, isLastPeriod
public SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic)
durationUs
- The duration of the period, in microseconds.isSeekable
- Whether seeking is supported within the period.isDynamic
- Whether the window may change when the timeline is updated.public SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic, @Nullable java.lang.Object tag)
durationUs
- The duration of the period, in microseconds.isSeekable
- Whether seeking is supported within the period.isDynamic
- Whether the window may change when the timeline is updated.tag
- A tag used for Timeline.Window#tag
.public SinglePeriodTimeline(long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, @Nullable java.lang.Object tag)
periodDurationUs
- The duration of the period in microseconds.windowDurationUs
- The duration of the window in microseconds.windowPositionInPeriodUs
- The position of the start of the window in the period, in
microseconds.windowDefaultStartPositionUs
- The default position relative to the start of the window at
which to begin playback, in microseconds.isSeekable
- Whether seeking is supported within the window.isDynamic
- Whether the window may change when the timeline is updated.tag
- A tag used for Timeline.Window#tag
.public SinglePeriodTimeline(long presentationStartTimeMs, long windowStartTimeMs, long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, @Nullable java.lang.Object tag)
presentationStartTimeMs
- The start time of the presentation in milliseconds since the
epoch.windowStartTimeMs
- The window's start time in milliseconds since the epoch.periodDurationUs
- The duration of the period in microseconds.windowDurationUs
- The duration of the window in microseconds.windowPositionInPeriodUs
- The position of the start of the window in the period, in
microseconds.windowDefaultStartPositionUs
- The default position relative to the start of the window at
which to begin playback, in microseconds.isSeekable
- Whether seeking is supported within the window.isDynamic
- Whether the window may change when the timeline is updated.tag
- A tag used for Timeline.Window#tag
.public int getWindowCount()
Timeline
getWindowCount
in class Timeline
public Timeline.Window getWindow(int windowIndex, Timeline.Window window, boolean setTag, long defaultPositionProjectionUs)
Timeline
Timeline.Window
with data for the window at the specified index.getWindow
in class Timeline
windowIndex
- The index of the window.window
- The Timeline.Window
to populate. Must not be null.setTag
- Whether Timeline.Window.tag
should be populated. If false, the field will be set
to null. The caller should pass false for efficiency reasons unless the field is required.defaultPositionProjectionUs
- A duration into the future that the populated window's
default start position should be projected.Timeline.Window
, for convenience.public int getPeriodCount()
Timeline
getPeriodCount
in class Timeline
public Timeline.Period getPeriod(int periodIndex, Timeline.Period period, boolean setIds)
Timeline
Timeline.Period
with data for the period at the specified index.getPeriod
in class Timeline
periodIndex
- The index of the period.period
- The Timeline.Period
to populate. Must not be null.setIds
- Whether Timeline.Period.id
and Timeline.Period.uid
should be populated. If false,
the fields will be set to null. The caller should pass false for efficiency reasons unless
the fields are required.Timeline.Period
, for convenience.public int getIndexOfPeriod(java.lang.Object uid)
Timeline
id
, or C.INDEX_UNSET
if the period is not in the timeline.getIndexOfPeriod
in class Timeline
uid
- A unique identifier for a period.C.INDEX_UNSET
if the period was not found.public java.lang.Object getUidOfPeriod(int periodIndex)
Timeline
getUidOfPeriod
in class Timeline
periodIndex
- The index of the period.