@Test public void setTag_isUsedForWindowTag() { Object tag = new Object(); SinglePeriodTimeline timeline = new SinglePeriodTimeline( C.TIME_UNSET, false, false, tag); assertThat(timeline.getWindow( 0, window, false).tag).isNull(); assertThat(timeline.getWindow( 0, window, true).tag) .isEqualTo(tag); }
@Override public Window getWindow( int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) { Assertions.checkIndex(windowIndex, 0, 1); Object tag = setTag ? this.tag : null; long windowDefaultStartPositionUs = this.windowDefaultStartPositionUs; if (isDynamic && defaultPositionProjectionUs != 0) { if (windowDurationUs == C.TIME_UNSET) { windowDefaultStartPositionUs = C.TIME_UNSET; } else { windowDefaultStartPositionUs += defaultPositionProjectionUs; if (windowDefaultStartPositionUs > windowDurationUs) { windowDefaultStartPositionUs = C.TIME_UNSET; } } } return window.set( tag, presentationStartTimeMs, windowStartTimeMs, isSeekable, isDynamic, windowDefaultStartPositionUs, windowDurationUs, 0, 0, windowPositionInPeriodUs); }
SinglePeriodTimeline extends Timeline { @Override public Window getWindow( int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) { Assertions.checkIndex(windowIndex, 0, 1); Object tag = setTag ? this.tag : null; long windowDefaultStartPositionUs = this.windowDefaultStartPositionUs; if (isDynamic && defaultPositionProjectionUs != 0) { if (windowDurationUs == C.TIME_UNSET) { windowDefaultStartPositionUs = C.TIME_UNSET; } else { windowDefaultStartPositionUs += defaultPositionProjectionUs; if (windowDefaultStartPositionUs > windowDurationUs) { windowDefaultStartPositionUs = C.TIME_UNSET; } } } return window.set( tag, presentationStartTimeMs, windowStartTimeMs, isSeekable, isDynamic, windowDefaultStartPositionUs, windowDurationUs, 0, 0, windowPositionInPeriodUs); } }
SinglePeriodTimeline extends Timeline { @Override public Window getWindow( int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) { Assertions.checkIndex(windowIndex, 0, 1); Object tag = setTag ? this.tag : null; long windowDefaultStartPositionUs = this.windowDefaultStartPositionUs; if (isDynamic && defaultPositionProjectionUs != 0) { if (windowDurationUs == C.TIME_UNSET) { windowDefaultStartPositionUs = C.TIME_UNSET; } else { windowDefaultStartPositionUs += defaultPositionProjectionUs; if (windowDefaultStartPositionUs > windowDurationUs) { windowDefaultStartPositionUs = C.TIME_UNSET; } } } return window.set( tag, presentationStartTimeMs, windowStartTimeMs, isSeekable, isDynamic, windowDefaultStartPositionUs, windowDurationUs, 0, 0, windowPositionInPeriodUs); } SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic);  SinglePeriodTimeline(
      long durationUs, boolean isSeekable, boolean isDynamic, @Nullable Object tag);  SinglePeriodTimeline(
      long periodDurationUs,
      long windowDurationUs,
      long windowPositionInPeriodUs,
      long windowDefaultStartPositionUs,
      boolean isSeekable,
      boolean isDynamic,
      @Nullable Object tag);  SinglePeriodTimeline(
      long presentationStartTimeMs,
      long windowStartTimeMs,
      long periodDurationUs,
      long windowDurationUs,
      long windowPositionInPeriodUs,
      long windowDefaultStartPositionUs,
      boolean isSeekable,
      boolean isDynamic,
      @Nullable Object tag); }
SinglePeriodTimeline extends Timeline { @Override public Window getWindow( int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) { Assertions.checkIndex(windowIndex, 0, 1); Object tag = setTag ? this.tag : null; long windowDefaultStartPositionUs = this.windowDefaultStartPositionUs; if (isDynamic && defaultPositionProjectionUs != 0) { if (windowDurationUs == C.TIME_UNSET) { windowDefaultStartPositionUs = C.TIME_UNSET; } else { windowDefaultStartPositionUs += defaultPositionProjectionUs; if (windowDefaultStartPositionUs > windowDurationUs) { windowDefaultStartPositionUs = C.TIME_UNSET; } } } return window.set( tag, presentationStartTimeMs, windowStartTimeMs, isSeekable, isDynamic, windowDefaultStartPositionUs, windowDurationUs, 0, 0, windowPositionInPeriodUs); } SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic);  SinglePeriodTimeline(
      long durationUs, boolean isSeekable, boolean isDynamic, @Nullable Object tag);  SinglePeriodTimeline(
      long periodDurationUs,
      long windowDurationUs,
      long windowPositionInPeriodUs,
      long windowDefaultStartPositionUs,
      boolean isSeekable,
      boolean isDynamic,
      @Nullable Object tag);  SinglePeriodTimeline(
      long presentationStartTimeMs,
      long windowStartTimeMs,
      long periodDurationUs,
      long windowDurationUs,
      long windowPositionInPeriodUs,
      long windowDefaultStartPositionUs,
      boolean isSeekable,
      boolean isDynamic,
      @Nullable Object tag); @Override int getWindowCount(); @Override Window getWindow(
      int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs); @Override int getPeriodCount(); @Override Period getPeriod(int periodIndex, Period period, boolean setIds); @Override int getIndexOfPeriod(Object uid); @Override Object getUidOfPeriod(int periodIndex); }
SinglePeriodTimeline extends Timeline { @Override public Window getWindow( int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) { Assertions.checkIndex(windowIndex, 0, 1); Object tag = setTag ? this.tag : null; long windowDefaultStartPositionUs = this.windowDefaultStartPositionUs; if (isDynamic && defaultPositionProjectionUs != 0) { if (windowDurationUs == C.TIME_UNSET) { windowDefaultStartPositionUs = C.TIME_UNSET; } else { windowDefaultStartPositionUs += defaultPositionProjectionUs; if (windowDefaultStartPositionUs > windowDurationUs) { windowDefaultStartPositionUs = C.TIME_UNSET; } } } return window.set( tag, presentationStartTimeMs, windowStartTimeMs, isSeekable, isDynamic, windowDefaultStartPositionUs, windowDurationUs, 0, 0, windowPositionInPeriodUs); } SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic);  SinglePeriodTimeline(
      long durationUs, boolean isSeekable, boolean isDynamic, @Nullable Object tag);  SinglePeriodTimeline(
      long periodDurationUs,
      long windowDurationUs,
      long windowPositionInPeriodUs,
      long windowDefaultStartPositionUs,
      boolean isSeekable,
      boolean isDynamic,
      @Nullable Object tag);  SinglePeriodTimeline(
      long presentationStartTimeMs,
      long windowStartTimeMs,
      long periodDurationUs,
      long windowDurationUs,
      long windowPositionInPeriodUs,
      long windowDefaultStartPositionUs,
      boolean isSeekable,
      boolean isDynamic,
      @Nullable Object tag); @Override int getWindowCount(); @Override Window getWindow(
      int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs); @Override int getPeriodCount(); @Override Period getPeriod(int periodIndex, Period period, boolean setIds); @Override int getIndexOfPeriod(Object uid); @Override Object getUidOfPeriod(int periodIndex);  }