Commit 733e71b4 by bachinger Committed by Oliver Woodman

Remove overloaded set method

PiperOrigin-RevId: 316900193
parent b6f5a263
...@@ -15,10 +15,12 @@ ...@@ -15,10 +15,12 @@
*/ */
package com.google.android.exoplayer2.ext.cast; package com.google.android.exoplayer2.ext.cast;
import android.net.Uri;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import java.util.Arrays; import java.util.Arrays;
...@@ -126,7 +128,7 @@ import java.util.Arrays; ...@@ -126,7 +128,7 @@ import java.util.Arrays;
boolean isDynamic = durationUs == C.TIME_UNSET; boolean isDynamic = durationUs == C.TIME_UNSET;
return window.set( return window.set(
/* uid= */ ids[windowIndex], /* uid= */ ids[windowIndex],
/* tag= */ ids[windowIndex], /* mediaItem= */ new MediaItem.Builder().setUri(Uri.EMPTY).setTag(ids[windowIndex]).build(),
/* manifest= */ null, /* manifest= */ null,
/* presentationStartTimeMs= */ C.TIME_UNSET, /* presentationStartTimeMs= */ C.TIME_UNSET,
/* windowStartTimeMs= */ C.TIME_UNSET, /* windowStartTimeMs= */ C.TIME_UNSET,
......
...@@ -225,44 +225,6 @@ public abstract class Timeline { ...@@ -225,44 +225,6 @@ public abstract class Timeline {
mediaItem = DUMMY_MEDIA_ITEM; mediaItem = DUMMY_MEDIA_ITEM;
} }
/**
* @deprecated Use {@link #set(Object, MediaItem, Object, long, long, long, boolean, boolean,
* boolean, long, long, int, int, long)} instead.
*/
@Deprecated
public Window set(
Object uid,
@Nullable Object tag,
@Nullable Object manifest,
long presentationStartTimeMs,
long windowStartTimeMs,
long elapsedRealtimeEpochOffsetMs,
boolean isSeekable,
boolean isDynamic,
boolean isLive,
long defaultPositionUs,
long durationUs,
int firstPeriodIndex,
int lastPeriodIndex,
long positionInFirstPeriodUs) {
set(
uid,
DUMMY_MEDIA_ITEM.buildUpon().setTag(tag).build(),
manifest,
presentationStartTimeMs,
windowStartTimeMs,
elapsedRealtimeEpochOffsetMs,
isSeekable,
isDynamic,
isLive,
defaultPositionUs,
durationUs,
firstPeriodIndex,
lastPeriodIndex,
positionInFirstPeriodUs);
return this;
}
/** Sets the data held by this window. */ /** Sets the data held by this window. */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public Window set( public Window set(
......
...@@ -46,7 +46,6 @@ public final class SinglePeriodTimeline extends Timeline { ...@@ -46,7 +46,6 @@ public final class SinglePeriodTimeline extends Timeline {
private final boolean isSeekable; private final boolean isSeekable;
private final boolean isDynamic; private final boolean isDynamic;
private final boolean isLive; private final boolean isLive;
@Nullable private final Object tag;
@Nullable private final Object manifest; @Nullable private final Object manifest;
@Nullable private final MediaItem mediaItem; @Nullable private final MediaItem mediaItem;
...@@ -208,8 +207,7 @@ public final class SinglePeriodTimeline extends Timeline { ...@@ -208,8 +207,7 @@ public final class SinglePeriodTimeline extends Timeline {
isDynamic, isDynamic,
isLive, isLive,
manifest, manifest,
MEDIA_ITEM.buildUpon().setTag(tag).build(), MEDIA_ITEM.buildUpon().setTag(tag).build());
tag);
} }
/** /**
...@@ -248,36 +246,6 @@ public final class SinglePeriodTimeline extends Timeline { ...@@ -248,36 +246,6 @@ public final class SinglePeriodTimeline extends Timeline {
boolean isLive, boolean isLive,
@Nullable Object manifest, @Nullable Object manifest,
MediaItem mediaItem) { MediaItem mediaItem) {
this(
presentationStartTimeMs,
windowStartTimeMs,
elapsedRealtimeEpochOffsetMs,
periodDurationUs,
windowDurationUs,
windowPositionInPeriodUs,
windowDefaultStartPositionUs,
isSeekable,
isDynamic,
isLive,
manifest,
mediaItem,
/* tag= */ null);
}
private SinglePeriodTimeline(
long presentationStartTimeMs,
long windowStartTimeMs,
long elapsedRealtimeEpochOffsetMs,
long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
boolean isLive,
@Nullable Object manifest,
MediaItem mediaItem,
@Nullable Object tag) {
this.presentationStartTimeMs = presentationStartTimeMs; this.presentationStartTimeMs = presentationStartTimeMs;
this.windowStartTimeMs = windowStartTimeMs; this.windowStartTimeMs = windowStartTimeMs;
this.elapsedRealtimeEpochOffsetMs = elapsedRealtimeEpochOffsetMs; this.elapsedRealtimeEpochOffsetMs = elapsedRealtimeEpochOffsetMs;
...@@ -290,7 +258,6 @@ public final class SinglePeriodTimeline extends Timeline { ...@@ -290,7 +258,6 @@ public final class SinglePeriodTimeline extends Timeline {
this.isLive = isLive; this.isLive = isLive;
this.manifest = manifest; this.manifest = manifest;
this.mediaItem = checkNotNull(mediaItem); this.mediaItem = checkNotNull(mediaItem);
this.tag = tag;
} }
@Override @Override
...@@ -316,24 +283,6 @@ public final class SinglePeriodTimeline extends Timeline { ...@@ -316,24 +283,6 @@ public final class SinglePeriodTimeline extends Timeline {
} }
} }
} }
if (tag != null) {
// Support deprecated constructors.
return window.set(
Window.SINGLE_WINDOW_UID,
tag,
manifest,
presentationStartTimeMs,
windowStartTimeMs,
elapsedRealtimeEpochOffsetMs,
isSeekable,
isDynamic,
isLive,
windowDefaultStartPositionUs,
windowDurationUs,
/* firstPeriodIndex= */ 0,
/* lastPeriodIndex= */ 0,
windowPositionInPeriodUs);
}
return window.set( return window.set(
Window.SINGLE_WINDOW_UID, Window.SINGLE_WINDOW_UID,
mediaItem, mediaItem,
......
...@@ -17,7 +17,6 @@ package com.google.android.exoplayer2; ...@@ -17,7 +17,6 @@ package com.google.android.exoplayer2;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import android.net.Uri;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.testutil.FakeTimeline; import com.google.android.exoplayer2.testutil.FakeTimeline;
...@@ -141,38 +140,6 @@ public class TimelineTest { ...@@ -141,38 +140,6 @@ public class TimelineTest {
assertThat(window).isEqualTo(otherWindow); assertThat(window).isEqualTo(otherWindow);
} }
@SuppressWarnings("deprecation")
@Test
public void windowSet_withTag() {
Object tag = new Object();
Timeline.Window window =
populateWindow(
new MediaItem.Builder()
.setMediaId("com.google.android.exoplayer2.Timeline")
.setUri(Uri.EMPTY)
.setTag(tag)
.build(),
tag);
Timeline.Window otherWindow = new Timeline.Window();
otherWindow =
otherWindow.set(
window.uid,
window.tag,
window.manifest,
window.presentationStartTimeMs,
window.windowStartTimeMs,
window.elapsedRealtimeEpochOffsetMs,
window.isSeekable,
window.isDynamic,
window.isLive,
window.defaultPositionUs,
window.durationUs,
window.firstPeriodIndex,
window.lastPeriodIndex,
window.positionInFirstPeriodUs);
assertThat(window).isEqualTo(otherWindow);
}
@Test @Test
public void windowHashCode() { public void windowHashCode() {
Timeline.Window window = new Timeline.Window(); Timeline.Window window = new Timeline.Window();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment