Commit 554a3994 by andrewlewis Committed by Oliver Woodman

Switch to non-deprecated player constants

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162605429
parent 8d56f904
Showing with 224 additions and 228 deletions
...@@ -20,9 +20,9 @@ import android.util.Log; ...@@ -20,9 +20,9 @@ import android.util.Log;
import android.view.Surface; import android.view.Surface;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.RendererCapabilities; import com.google.android.exoplayer2.RendererCapabilities;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.audio.AudioRendererEventListener; import com.google.android.exoplayer2.audio.AudioRendererEventListener;
...@@ -55,8 +55,8 @@ import java.util.Locale; ...@@ -55,8 +55,8 @@ import java.util.Locale;
/** /**
* Logs player events using {@link Log}. * Logs player events using {@link Log}.
*/ */
/* package */ final class EventLogger implements ExoPlayer.EventListener, /* package */ final class EventLogger implements Player.EventListener, AudioRendererEventListener,
AudioRendererEventListener, VideoRendererEventListener, AdaptiveMediaSourceEventListener, VideoRendererEventListener, AdaptiveMediaSourceEventListener,
ExtractorMediaSource.EventListener, DefaultDrmSessionManager.EventListener, ExtractorMediaSource.EventListener, DefaultDrmSessionManager.EventListener,
MetadataRenderer.Output { MetadataRenderer.Output {
...@@ -82,7 +82,7 @@ import java.util.Locale; ...@@ -82,7 +82,7 @@ import java.util.Locale;
startTimeMs = SystemClock.elapsedRealtime(); startTimeMs = SystemClock.elapsedRealtime();
} }
// ExoPlayer.EventListener // Player.EventListener
@Override @Override
public void onLoadingChanged(boolean isLoading) { public void onLoadingChanged(boolean isLoading) {
...@@ -96,7 +96,7 @@ import java.util.Locale; ...@@ -96,7 +96,7 @@ import java.util.Locale;
} }
@Override @Override
public void onRepeatModeChanged(@ExoPlayer.RepeatMode int repeatMode) { public void onRepeatModeChanged(@Player.RepeatMode int repeatMode) {
Log.d(TAG, "repeatMode [" + getRepeatModeString(repeatMode) + "]"); Log.d(TAG, "repeatMode [" + getRepeatModeString(repeatMode) + "]");
} }
...@@ -412,13 +412,13 @@ import java.util.Locale; ...@@ -412,13 +412,13 @@ import java.util.Locale;
private static String getStateString(int state) { private static String getStateString(int state) {
switch (state) { switch (state) {
case ExoPlayer.STATE_BUFFERING: case Player.STATE_BUFFERING:
return "B"; return "B";
case ExoPlayer.STATE_ENDED: case Player.STATE_ENDED:
return "E"; return "E";
case ExoPlayer.STATE_IDLE: case Player.STATE_IDLE:
return "I"; return "I";
case ExoPlayer.STATE_READY: case Player.STATE_READY:
return "R"; return "R";
default: default:
return "?"; return "?";
...@@ -466,13 +466,13 @@ import java.util.Locale; ...@@ -466,13 +466,13 @@ import java.util.Locale;
return enabled ? "[X]" : "[ ]"; return enabled ? "[X]" : "[ ]";
} }
private static String getRepeatModeString(@ExoPlayer.RepeatMode int repeatMode) { private static String getRepeatModeString(@Player.RepeatMode int repeatMode) {
switch (repeatMode) { switch (repeatMode) {
case ExoPlayer.REPEAT_MODE_OFF: case Player.REPEAT_MODE_OFF:
return "OFF"; return "OFF";
case ExoPlayer.REPEAT_MODE_ONE: case Player.REPEAT_MODE_ONE:
return "ONE"; return "ONE";
case ExoPlayer.REPEAT_MODE_ALL: case Player.REPEAT_MODE_ALL:
return "ALL"; return "ALL";
default: default:
return "?"; return "?";
......
...@@ -36,9 +36,9 @@ import android.widget.Toast; ...@@ -36,9 +36,9 @@ import android.widget.Toast;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultRenderersFactory; import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.EventListener; import com.google.android.exoplayer2.Player.EventListener;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
...@@ -480,7 +480,7 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi ...@@ -480,7 +480,7 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
} }
} }
// ExoPlayer.EventListener implementation // Player.EventListener implementation
@Override @Override
public void onLoadingChanged(boolean isLoading) { public void onLoadingChanged(boolean isLoading) {
...@@ -489,7 +489,7 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi ...@@ -489,7 +489,7 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
@Override @Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playbackState == ExoPlayer.STATE_ENDED) { if (playbackState == Player.STATE_ENDED) {
showControls(); showControls();
} }
updateButtonVisibilities(); updateButtonVisibilities();
......
...@@ -23,6 +23,7 @@ import com.google.android.exoplayer2.ExoPlaybackException; ...@@ -23,6 +23,7 @@ import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer; import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor; import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
...@@ -57,7 +58,7 @@ public class FlacPlaybackTest extends InstrumentationTestCase { ...@@ -57,7 +58,7 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
} }
} }
private static class TestPlaybackThread extends Thread implements ExoPlayer.EventListener { private static class TestPlaybackThread extends Thread implements Player.EventListener {
private final Context context; private final Context context;
private final Uri uri; private final Uri uri;
...@@ -120,8 +121,8 @@ public class FlacPlaybackTest extends InstrumentationTestCase { ...@@ -120,8 +121,8 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
@Override @Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playbackState == ExoPlayer.STATE_ENDED if (playbackState == Player.STATE_ENDED
|| (playbackState == ExoPlayer.STATE_IDLE && playbackException != null)) { || (playbackState == Player.STATE_IDLE && playbackException != null)) {
releasePlayerAndQuitLooper(); releasePlayerAndQuitLooper();
} }
} }
......
...@@ -43,6 +43,7 @@ import com.google.android.exoplayer2.ExoPlaybackException; ...@@ -43,6 +43,7 @@ import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo; import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
...@@ -54,7 +55,7 @@ import java.util.List; ...@@ -54,7 +55,7 @@ import java.util.List;
/** /**
* Loads ads using the IMA SDK. All methods are called on the main thread. * Loads ads using the IMA SDK. All methods are called on the main thread.
*/ */
public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlayer, public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
ContentProgressProvider, AdErrorListener, AdsLoadedListener, AdEventListener { ContentProgressProvider, AdErrorListener, AdsLoadedListener, AdEventListener {
/** /**
...@@ -107,7 +108,7 @@ public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlaye ...@@ -107,7 +108,7 @@ public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlaye
private final AdsLoader adsLoader; private final AdsLoader adsLoader;
private EventListener eventListener; private EventListener eventListener;
private ExoPlayer player; private Player player;
private VideoProgressUpdate lastContentProgress; private VideoProgressUpdate lastContentProgress;
private VideoProgressUpdate lastAdProgress; private VideoProgressUpdate lastAdProgress;
...@@ -485,7 +486,7 @@ public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlaye ...@@ -485,7 +486,7 @@ public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlaye
throw new IllegalStateException(); throw new IllegalStateException();
} }
// ExoPlayer.EventListener implementation. // Player.EventListener implementation.
@Override @Override
public void onTimelineChanged(Timeline timeline, Object manifest) { public void onTimelineChanged(Timeline timeline, Object manifest) {
...@@ -516,9 +517,9 @@ public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlaye ...@@ -516,9 +517,9 @@ public final class ImaAdsLoader implements ExoPlayer.EventListener, VideoAdPlaye
return; return;
} }
if (!imaPlayingAd && playbackState == ExoPlayer.STATE_BUFFERING && playWhenReady) { if (!imaPlayingAd && playbackState == Player.STATE_BUFFERING && playWhenReady) {
checkForContentComplete(); checkForContentComplete();
} else if (imaPlayingAd && playbackState == ExoPlayer.STATE_ENDED) { } else if (imaPlayingAd && playbackState == Player.STATE_ENDED) {
// IMA is waiting for the ad playback to finish so invoke the callback now. // IMA is waiting for the ad playback to finish so invoke the callback now.
// Either CONTENT_RESUME_REQUESTED will be passed next, or playAd will be called again. // Either CONTENT_RESUME_REQUESTED will be passed next, or playAd will be called again.
for (VideoAdPlayerCallback callback : adCallbacks) { for (VideoAdPlayerCallback callback : adCallbacks) {
......
...@@ -23,6 +23,7 @@ import com.google.android.exoplayer2.ExoPlaybackException; ...@@ -23,6 +23,7 @@ import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer; import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor; import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
...@@ -57,7 +58,7 @@ public class OpusPlaybackTest extends InstrumentationTestCase { ...@@ -57,7 +58,7 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
} }
} }
private static class TestPlaybackThread extends Thread implements ExoPlayer.EventListener { private static class TestPlaybackThread extends Thread implements Player.EventListener {
private final Context context; private final Context context;
private final Uri uri; private final Uri uri;
...@@ -120,8 +121,8 @@ public class OpusPlaybackTest extends InstrumentationTestCase { ...@@ -120,8 +121,8 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
@Override @Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playbackState == ExoPlayer.STATE_ENDED if (playbackState == Player.STATE_ENDED
|| (playbackState == ExoPlayer.STATE_IDLE && playbackException != null)) { || (playbackState == Player.STATE_IDLE && playbackException != null)) {
releasePlayerAndQuitLooper(); releasePlayerAndQuitLooper();
} }
} }
......
...@@ -24,6 +24,7 @@ import com.google.android.exoplayer2.ExoPlaybackException; ...@@ -24,6 +24,7 @@ import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer; import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor; import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
...@@ -86,7 +87,7 @@ public class VpxPlaybackTest extends InstrumentationTestCase { ...@@ -86,7 +87,7 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
} }
} }
private static class TestPlaybackThread extends Thread implements ExoPlayer.EventListener { private static class TestPlaybackThread extends Thread implements Player.EventListener {
private final Context context; private final Context context;
private final Uri uri; private final Uri uri;
...@@ -152,8 +153,8 @@ public class VpxPlaybackTest extends InstrumentationTestCase { ...@@ -152,8 +153,8 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
@Override @Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playbackState == ExoPlayer.STATE_ENDED if (playbackState == Player.STATE_ENDED
|| (playbackState == ExoPlayer.STATE_IDLE && playbackException != null)) { || (playbackState == Player.STATE_IDLE && playbackException != null)) {
releasePlayerAndQuitLooper(); releasePlayerAndQuitLooper();
} }
} }
......
...@@ -216,13 +216,13 @@ public final class ExoPlayerTest extends TestCase { ...@@ -216,13 +216,13 @@ public final class ExoPlayerTest extends TestCase {
new TimelineWindowDefinition(true, false, 100000), new TimelineWindowDefinition(true, false, 100000),
new TimelineWindowDefinition(true, false, 100000)); new TimelineWindowDefinition(true, false, 100000));
final int[] actionSchedule = { // 0 -> 1 final int[] actionSchedule = { // 0 -> 1
ExoPlayer.REPEAT_MODE_ONE, // 1 -> 1 Player.REPEAT_MODE_ONE, // 1 -> 1
ExoPlayer.REPEAT_MODE_OFF, // 1 -> 2 Player.REPEAT_MODE_OFF, // 1 -> 2
ExoPlayer.REPEAT_MODE_ONE, // 2 -> 2 Player.REPEAT_MODE_ONE, // 2 -> 2
ExoPlayer.REPEAT_MODE_ALL, // 2 -> 0 Player.REPEAT_MODE_ALL, // 2 -> 0
ExoPlayer.REPEAT_MODE_ONE, // 0 -> 0 Player.REPEAT_MODE_ONE, // 0 -> 0
-1, // 0 -> 0 -1, // 0 -> 0
ExoPlayer.REPEAT_MODE_OFF, // 0 -> 1 Player.REPEAT_MODE_OFF, // 0 -> 1
-1, // 1 -> 2 -1, // 1 -> 2
-1 // 2 -> ended -1 // 2 -> ended
}; };
......
...@@ -33,23 +33,23 @@ public class TimelineTest extends TestCase { ...@@ -33,23 +33,23 @@ public class TimelineTest extends TestCase {
Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(1, 111)); Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(1, 111));
TimelineAsserts.assertWindowIds(timeline, 111); TimelineAsserts.assertWindowIds(timeline, 111);
TimelineAsserts.assertPeriodCounts(timeline, 1); TimelineAsserts.assertPeriodCounts(timeline, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
} }
public void testMultiPeriodTimeline() { public void testMultiPeriodTimeline() {
Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(5, 111)); Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(5, 111));
TimelineAsserts.assertWindowIds(timeline, 111); TimelineAsserts.assertWindowIds(timeline, 111);
TimelineAsserts.assertPeriodCounts(timeline, 5); TimelineAsserts.assertPeriodCounts(timeline, 5);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
} }
} }
...@@ -17,7 +17,7 @@ package com.google.android.exoplayer2.source; ...@@ -17,7 +17,7 @@ package com.google.android.exoplayer2.source;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Timeline.Period; import com.google.android.exoplayer2.Timeline.Period;
import com.google.android.exoplayer2.Timeline.Window; import com.google.android.exoplayer2.Timeline.Window;
...@@ -109,14 +109,13 @@ public final class ClippingMediaSourceTest extends InstrumentationTestCase { ...@@ -109,14 +109,13 @@ public final class ClippingMediaSourceTest extends InstrumentationTestCase {
TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US); TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US);
TimelineAsserts.assertWindowIds(clippedTimeline, 111); TimelineAsserts.assertWindowIds(clippedTimeline, 111);
TimelineAsserts.assertPeriodCounts(clippedTimeline, 1); TimelineAsserts.assertPeriodCounts(clippedTimeline, 1);
TimelineAsserts.assertPreviousWindowIndices(clippedTimeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertPreviousWindowIndices(
C.INDEX_UNSET); clippedTimeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertPreviousWindowIndices(clippedTimeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertPreviousWindowIndices(clippedTimeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertPreviousWindowIndices(clippedTimeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertPreviousWindowIndices(clippedTimeline, Player.REPEAT_MODE_ALL, 0);
TimelineAsserts.assertNextWindowIndices(clippedTimeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertNextWindowIndices(clippedTimeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(clippedTimeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertNextWindowIndices(clippedTimeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertNextWindowIndices(clippedTimeline, Player.REPEAT_MODE_ALL, 0);
TimelineAsserts.assertNextWindowIndices(clippedTimeline, ExoPlayer.REPEAT_MODE_ALL, 0);
} }
/** /**
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.google.android.exoplayer2.source; package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.testutil.FakeMediaSource; import com.google.android.exoplayer2.testutil.FakeMediaSource;
import com.google.android.exoplayer2.testutil.FakeTimeline; import com.google.android.exoplayer2.testutil.FakeTimeline;
...@@ -34,22 +34,22 @@ public final class ConcatenatingMediaSourceTest extends TestCase { ...@@ -34,22 +34,22 @@ public final class ConcatenatingMediaSourceTest extends TestCase {
Timeline timeline = getConcatenatedTimeline(false, createFakeTimeline(3, 111)); Timeline timeline = getConcatenatedTimeline(false, createFakeTimeline(3, 111));
TimelineAsserts.assertWindowIds(timeline, 111); TimelineAsserts.assertWindowIds(timeline, 111);
TimelineAsserts.assertPeriodCounts(timeline, 3); TimelineAsserts.assertPeriodCounts(timeline, 3);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
timeline = getConcatenatedTimeline(true, createFakeTimeline(3, 111)); timeline = getConcatenatedTimeline(true, createFakeTimeline(3, 111));
TimelineAsserts.assertWindowIds(timeline, 111); TimelineAsserts.assertWindowIds(timeline, 111);
TimelineAsserts.assertPeriodCounts(timeline, 3); TimelineAsserts.assertPeriodCounts(timeline, 3);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 0);
} }
public void testMultipleMediaSources() { public void testMultipleMediaSources() {
...@@ -58,26 +58,24 @@ public final class ConcatenatingMediaSourceTest extends TestCase { ...@@ -58,26 +58,24 @@ public final class ConcatenatingMediaSourceTest extends TestCase {
Timeline timeline = getConcatenatedTimeline(false, timelines); Timeline timeline = getConcatenatedTimeline(false, timelines);
TimelineAsserts.assertWindowIds(timeline, 111, 222, 333); TimelineAsserts.assertWindowIds(timeline, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 3, 1, 3); TimelineAsserts.assertPeriodCounts(timeline, 3, 1, 3);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, C.INDEX_UNSET, TimelineAsserts.assertPreviousWindowIndices(
0, 1); timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 2, 0, 1); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 2, 0, 1);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, 1, 2, C.INDEX_UNSET);
1, 2, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 1, 2, 0);
timeline = getConcatenatedTimeline(true, timelines); timeline = getConcatenatedTimeline(true, timelines);
TimelineAsserts.assertWindowIds(timeline, 111, 222, 333); TimelineAsserts.assertWindowIds(timeline, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 3, 1, 3); TimelineAsserts.assertPeriodCounts(timeline, 3, 1, 3);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertPreviousWindowIndices(
C.INDEX_UNSET, 0, 1); timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 2, 0, 1); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 2, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 2, 0, 1); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 2, 0, 1);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, 1, 2, C.INDEX_UNSET);
1, 2, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 1, 2, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 1, 2, 0);
} }
public void testNestedMediaSources() { public void testNestedMediaSources() {
...@@ -86,14 +84,14 @@ public final class ConcatenatingMediaSourceTest extends TestCase { ...@@ -86,14 +84,14 @@ public final class ConcatenatingMediaSourceTest extends TestCase {
getConcatenatedTimeline(true, createFakeTimeline(1, 333), createFakeTimeline(1, 444))); getConcatenatedTimeline(true, createFakeTimeline(1, 333), createFakeTimeline(1, 444)));
TimelineAsserts.assertWindowIds(timeline, 111, 222, 333, 444); TimelineAsserts.assertWindowIds(timeline, 111, 222, 333, 444);
TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1, 1); TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertPreviousWindowIndices(
C.INDEX_UNSET, 0, 1, 2); timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET, 0, 1, 2);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 3, 2); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 3, 2);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 3, 0, 1, 2); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 3, 0, 1, 2);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertNextWindowIndices(
1, 2, 3, C.INDEX_UNSET); timeline, Player.REPEAT_MODE_OFF, 1, 2, 3, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 3, 2); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 3, 2);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 1, 2, 3, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 1, 2, 3, 0);
} }
/** /**
......
...@@ -120,14 +120,13 @@ public final class DynamicConcatenatingMediaSourceTest extends TestCase { ...@@ -120,14 +120,13 @@ public final class DynamicConcatenatingMediaSourceTest extends TestCase {
} }
// Assert correct next and previous indices behavior after some insertions and removals. // Assert correct next and previous indices behavior after some insertions and removals.
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, 1, 2, C.INDEX_UNSET);
1, 2, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 1, 2, 0); TimelineAsserts.assertPreviousWindowIndices(
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET, 0, 1);
C.INDEX_UNSET, 0, 1); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 2, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 2, 0, 1);
// Remove at front of queue. // Remove at front of queue.
mediaSource.removeMediaSource(0); mediaSource.removeMediaSource(0);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.google.android.exoplayer2.source; package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.testutil.FakeMediaSource; import com.google.android.exoplayer2.testutil.FakeMediaSource;
import com.google.android.exoplayer2.testutil.FakeTimeline; import com.google.android.exoplayer2.testutil.FakeTimeline;
...@@ -42,31 +42,30 @@ public class LoopingMediaSourceTest extends TestCase { ...@@ -42,31 +42,30 @@ public class LoopingMediaSourceTest extends TestCase {
Timeline timeline = getLoopingTimeline(multiWindowTimeline, 1); Timeline timeline = getLoopingTimeline(multiWindowTimeline, 1);
TimelineAsserts.assertWindowIds(timeline, 111, 222, 333); TimelineAsserts.assertWindowIds(timeline, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1); TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertPreviousWindowIndices(
C.INDEX_UNSET, 0, 1); timeline, Player.REPEAT_MODE_OFF, C.INDEX_UNSET, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 2, 0, 1); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 2, 0, 1);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, 1, 2, C.INDEX_UNSET);
1, 2, C.INDEX_UNSET); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 1, 2, 0);
} }
public void testMultiLoop() { public void testMultiLoop() {
Timeline timeline = getLoopingTimeline(multiWindowTimeline, 3); Timeline timeline = getLoopingTimeline(multiWindowTimeline, 3);
TimelineAsserts.assertWindowIds(timeline, 111, 222, 333, 111, 222, 333, 111, 222, 333); TimelineAsserts.assertWindowIds(timeline, 111, 222, 333, 111, 222, 333, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1, 1, 1, 1, 1, 1, 1); TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1, 1, 1, 1, 1, 1, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF,
C.INDEX_UNSET, 0, 1, 2, 3, 4, 5, 6, 7, 8); C.INDEX_UNSET, 0, 1, 2, 3, 4, 5, 6, 7, 8);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE,
0, 1, 2, 3, 4, 5, 6, 7, 8); 0, 1, 2, 3, 4, 5, 6, 7, 8);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL,
8, 0, 1, 2, 3, 4, 5, 6, 7); 8, 0, 1, 2, 3, 4, 5, 6, 7);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF,
1, 2, 3, 4, 5, 6, 7, 8, C.INDEX_UNSET); 1, 2, 3, 4, 5, 6, 7, 8, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE,
0, 1, 2, 3, 4, 5, 6, 7, 8); 0, 1, 2, 3, 4, 5, 6, 7, 8);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL,
1, 2, 3, 4, 5, 6, 7, 8, 0); 1, 2, 3, 4, 5, 6, 7, 8, 0);
} }
...@@ -74,12 +73,12 @@ public class LoopingMediaSourceTest extends TestCase { ...@@ -74,12 +73,12 @@ public class LoopingMediaSourceTest extends TestCase {
Timeline timeline = getLoopingTimeline(multiWindowTimeline, Integer.MAX_VALUE); Timeline timeline = getLoopingTimeline(multiWindowTimeline, Integer.MAX_VALUE);
TimelineAsserts.assertWindowIds(timeline, 111, 222, 333); TimelineAsserts.assertWindowIds(timeline, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1); TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, 2, 0, 1); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF, 2, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertPreviousWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 2, 0, 1); TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, 2, 0, 1);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_OFF, 1, 2, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ONE, 0, 1, 2); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, 0, 1, 2);
TimelineAsserts.assertNextWindowIndices(timeline, ExoPlayer.REPEAT_MODE_ALL, 1, 2, 0); TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, 1, 2, 0);
} }
/** /**
......
...@@ -86,8 +86,8 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -86,8 +86,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
this.renderers = Assertions.checkNotNull(renderers); this.renderers = Assertions.checkNotNull(renderers);
this.trackSelector = Assertions.checkNotNull(trackSelector); this.trackSelector = Assertions.checkNotNull(trackSelector);
this.playWhenReady = false; this.playWhenReady = false;
this.repeatMode = REPEAT_MODE_OFF; this.repeatMode = Player.REPEAT_MODE_OFF;
this.playbackState = STATE_IDLE; this.playbackState = Player.STATE_IDLE;
this.listeners = new CopyOnWriteArraySet<>(); this.listeners = new CopyOnWriteArraySet<>();
emptyTrackSelections = new TrackSelectionArray(new TrackSelection[renderers.length]); emptyTrackSelections = new TrackSelectionArray(new TrackSelection[renderers.length]);
timeline = Timeline.EMPTY; timeline = Timeline.EMPTY;
......
...@@ -172,7 +172,7 @@ import java.io.IOException; ...@@ -172,7 +172,7 @@ import java.io.IOException;
private boolean rebuffering; private boolean rebuffering;
private boolean isLoading; private boolean isLoading;
private int state; private int state;
private @ExoPlayer.RepeatMode int repeatMode; private @Player.RepeatMode int repeatMode;
private int customMessagesSent; private int customMessagesSent;
private int customMessagesProcessed; private int customMessagesProcessed;
private long elapsedRealtimeUs; private long elapsedRealtimeUs;
...@@ -188,7 +188,7 @@ import java.io.IOException; ...@@ -188,7 +188,7 @@ import java.io.IOException;
private Timeline timeline; private Timeline timeline;
public ExoPlayerImplInternal(Renderer[] renderers, TrackSelector trackSelector, public ExoPlayerImplInternal(Renderer[] renderers, TrackSelector trackSelector,
LoadControl loadControl, boolean playWhenReady, @ExoPlayer.RepeatMode int repeatMode, LoadControl loadControl, boolean playWhenReady, @Player.RepeatMode int repeatMode,
Handler eventHandler, PlaybackInfo playbackInfo, ExoPlayer player) { Handler eventHandler, PlaybackInfo playbackInfo, ExoPlayer player) {
this.renderers = renderers; this.renderers = renderers;
this.trackSelector = trackSelector; this.trackSelector = trackSelector;
...@@ -196,7 +196,7 @@ import java.io.IOException; ...@@ -196,7 +196,7 @@ import java.io.IOException;
this.playWhenReady = playWhenReady; this.playWhenReady = playWhenReady;
this.repeatMode = repeatMode; this.repeatMode = repeatMode;
this.eventHandler = eventHandler; this.eventHandler = eventHandler;
this.state = ExoPlayer.STATE_IDLE; this.state = Player.STATE_IDLE;
this.playbackInfo = playbackInfo; this.playbackInfo = playbackInfo;
this.player = player; this.player = player;
...@@ -230,7 +230,7 @@ import java.io.IOException; ...@@ -230,7 +230,7 @@ import java.io.IOException;
handler.obtainMessage(MSG_SET_PLAY_WHEN_READY, playWhenReady ? 1 : 0, 0).sendToTarget(); handler.obtainMessage(MSG_SET_PLAY_WHEN_READY, playWhenReady ? 1 : 0, 0).sendToTarget();
} }
public void setRepeatMode(@ExoPlayer.RepeatMode int repeatMode) { public void setRepeatMode(@Player.RepeatMode int repeatMode) {
handler.obtainMessage(MSG_SET_REPEAT_MODE, repeatMode, 0).sendToTarget(); handler.obtainMessage(MSG_SET_REPEAT_MODE, repeatMode, 0).sendToTarget();
} }
...@@ -423,7 +423,7 @@ import java.io.IOException; ...@@ -423,7 +423,7 @@ import java.io.IOException;
} }
this.mediaSource = mediaSource; this.mediaSource = mediaSource;
mediaSource.prepareSource(player, true, this); mediaSource.prepareSource(player, true, this);
setState(ExoPlayer.STATE_BUFFERING); setState(Player.STATE_BUFFERING);
handler.sendEmptyMessage(MSG_DO_SOME_WORK); handler.sendEmptyMessage(MSG_DO_SOME_WORK);
} }
...@@ -434,16 +434,16 @@ import java.io.IOException; ...@@ -434,16 +434,16 @@ import java.io.IOException;
stopRenderers(); stopRenderers();
updatePlaybackPositions(); updatePlaybackPositions();
} else { } else {
if (state == ExoPlayer.STATE_READY) { if (state == Player.STATE_READY) {
startRenderers(); startRenderers();
handler.sendEmptyMessage(MSG_DO_SOME_WORK); handler.sendEmptyMessage(MSG_DO_SOME_WORK);
} else if (state == ExoPlayer.STATE_BUFFERING) { } else if (state == Player.STATE_BUFFERING) {
handler.sendEmptyMessage(MSG_DO_SOME_WORK); handler.sendEmptyMessage(MSG_DO_SOME_WORK);
} }
} }
} }
private void setRepeatModeInternal(@ExoPlayer.RepeatMode int repeatMode) private void setRepeatModeInternal(@Player.RepeatMode int repeatMode)
throws ExoPlaybackException { throws ExoPlaybackException {
this.repeatMode = repeatMode; this.repeatMode = repeatMode;
mediaPeriodInfoSequence.setRepeatMode(repeatMode); mediaPeriodInfoSequence.setRepeatMode(repeatMode);
...@@ -594,38 +594,38 @@ import java.io.IOException; ...@@ -594,38 +594,38 @@ import java.io.IOException;
&& (playingPeriodDurationUs == C.TIME_UNSET && (playingPeriodDurationUs == C.TIME_UNSET
|| playingPeriodDurationUs <= playbackInfo.positionUs) || playingPeriodDurationUs <= playbackInfo.positionUs)
&& playingPeriodHolder.info.isFinal) { && playingPeriodHolder.info.isFinal) {
setState(ExoPlayer.STATE_ENDED); setState(Player.STATE_ENDED);
stopRenderers(); stopRenderers();
} else if (state == ExoPlayer.STATE_BUFFERING) { } else if (state == Player.STATE_BUFFERING) {
boolean isNewlyReady = enabledRenderers.length > 0 boolean isNewlyReady = enabledRenderers.length > 0
? (allRenderersReadyOrEnded ? (allRenderersReadyOrEnded
&& loadingPeriodHolder.haveSufficientBuffer(rebuffering, rendererPositionUs)) && loadingPeriodHolder.haveSufficientBuffer(rebuffering, rendererPositionUs))
: isTimelineReady(playingPeriodDurationUs); : isTimelineReady(playingPeriodDurationUs);
if (isNewlyReady) { if (isNewlyReady) {
setState(ExoPlayer.STATE_READY); setState(Player.STATE_READY);
if (playWhenReady) { if (playWhenReady) {
startRenderers(); startRenderers();
} }
} }
} else if (state == ExoPlayer.STATE_READY) { } else if (state == Player.STATE_READY) {
boolean isStillReady = enabledRenderers.length > 0 ? allRenderersReadyOrEnded boolean isStillReady = enabledRenderers.length > 0 ? allRenderersReadyOrEnded
: isTimelineReady(playingPeriodDurationUs); : isTimelineReady(playingPeriodDurationUs);
if (!isStillReady) { if (!isStillReady) {
rebuffering = playWhenReady; rebuffering = playWhenReady;
setState(ExoPlayer.STATE_BUFFERING); setState(Player.STATE_BUFFERING);
stopRenderers(); stopRenderers();
} }
} }
if (state == ExoPlayer.STATE_BUFFERING) { if (state == Player.STATE_BUFFERING) {
for (Renderer renderer : enabledRenderers) { for (Renderer renderer : enabledRenderers) {
renderer.maybeThrowStreamError(); renderer.maybeThrowStreamError();
} }
} }
if ((playWhenReady && state == ExoPlayer.STATE_READY) || state == ExoPlayer.STATE_BUFFERING) { if ((playWhenReady && state == Player.STATE_READY) || state == Player.STATE_BUFFERING) {
scheduleNextWork(operationStartTimeMs, RENDERING_INTERVAL_MS); scheduleNextWork(operationStartTimeMs, RENDERING_INTERVAL_MS);
} else if (enabledRenderers.length != 0 && state != ExoPlayer.STATE_ENDED) { } else if (enabledRenderers.length != 0 && state != Player.STATE_ENDED) {
scheduleNextWork(operationStartTimeMs, IDLE_INTERVAL_MS); scheduleNextWork(operationStartTimeMs, IDLE_INTERVAL_MS);
} else { } else {
handler.removeMessages(MSG_DO_SOME_WORK); handler.removeMessages(MSG_DO_SOME_WORK);
...@@ -661,7 +661,7 @@ import java.io.IOException; ...@@ -661,7 +661,7 @@ import java.io.IOException;
// Set the internal position to (0,TIME_UNSET) so that a subsequent seek to (0,0) isn't // Set the internal position to (0,TIME_UNSET) so that a subsequent seek to (0,0) isn't
// ignored. // ignored.
playbackInfo = new PlaybackInfo(0, C.TIME_UNSET); playbackInfo = new PlaybackInfo(0, C.TIME_UNSET);
setState(ExoPlayer.STATE_ENDED); setState(Player.STATE_ENDED);
// Reset, but retain the source so that it can still be used should a seek occur. // Reset, but retain the source so that it can still be used should a seek occur.
resetInternal(false); resetInternal(false);
return; return;
...@@ -697,7 +697,7 @@ import java.io.IOException; ...@@ -697,7 +697,7 @@ import java.io.IOException;
throws ExoPlaybackException { throws ExoPlaybackException {
stopRenderers(); stopRenderers();
rebuffering = false; rebuffering = false;
setState(ExoPlayer.STATE_BUFFERING); setState(Player.STATE_BUFFERING);
MediaPeriodHolder newPlayingPeriodHolder = null; MediaPeriodHolder newPlayingPeriodHolder = null;
if (playingPeriodHolder == null) { if (playingPeriodHolder == null) {
...@@ -787,13 +787,13 @@ import java.io.IOException; ...@@ -787,13 +787,13 @@ import java.io.IOException;
private void stopInternal() { private void stopInternal() {
resetInternal(true); resetInternal(true);
loadControl.onStopped(); loadControl.onStopped();
setState(ExoPlayer.STATE_IDLE); setState(Player.STATE_IDLE);
} }
private void releaseInternal() { private void releaseInternal() {
resetInternal(true); resetInternal(true);
loadControl.onReleased(); loadControl.onReleased();
setState(ExoPlayer.STATE_IDLE); setState(Player.STATE_IDLE);
synchronized (this) { synchronized (this) {
released = true; released = true;
notifyAll(); notifyAll();
...@@ -838,7 +838,7 @@ import java.io.IOException; ...@@ -838,7 +838,7 @@ import java.io.IOException;
for (ExoPlayerMessage message : messages) { for (ExoPlayerMessage message : messages) {
message.target.handleMessage(message.messageType, message.message); message.target.handleMessage(message.messageType, message.message);
} }
if (state == ExoPlayer.STATE_READY || state == ExoPlayer.STATE_BUFFERING) { if (state == Player.STATE_READY || state == Player.STATE_BUFFERING) {
// The message may have caused something to change that now requires us to do work. // The message may have caused something to change that now requires us to do work.
handler.sendEmptyMessage(MSG_DO_SOME_WORK); handler.sendEmptyMessage(MSG_DO_SOME_WORK);
} }
...@@ -1114,7 +1114,7 @@ import java.io.IOException; ...@@ -1114,7 +1114,7 @@ import java.io.IOException;
notifySourceInfoRefresh(manifest, processedInitialSeekCount); notifySourceInfoRefresh(manifest, processedInitialSeekCount);
// Set the internal position to (0,TIME_UNSET) so that a subsequent seek to (0,0) isn't ignored. // Set the internal position to (0,TIME_UNSET) so that a subsequent seek to (0,0) isn't ignored.
playbackInfo = new PlaybackInfo(0, C.TIME_UNSET); playbackInfo = new PlaybackInfo(0, C.TIME_UNSET);
setState(ExoPlayer.STATE_ENDED); setState(Player.STATE_ENDED);
// Reset, but retain the source so that it can still be used should a seek occur. // Reset, but retain the source so that it can still be used should a seek occur.
resetInternal(false); resetInternal(false);
} }
...@@ -1427,7 +1427,7 @@ import java.io.IOException; ...@@ -1427,7 +1427,7 @@ import java.io.IOException;
RendererConfiguration rendererConfiguration = RendererConfiguration rendererConfiguration =
playingPeriodHolder.trackSelectorResult.rendererConfigurations[i]; playingPeriodHolder.trackSelectorResult.rendererConfigurations[i];
// The renderer needs enabling with its new track selection. // The renderer needs enabling with its new track selection.
boolean playing = playWhenReady && state == ExoPlayer.STATE_READY; boolean playing = playWhenReady && state == Player.STATE_READY;
// Consider as joining only if the renderer was previously disabled. // Consider as joining only if the renderer was previously disabled.
boolean joining = !rendererWasEnabledFlags[i] && playing; boolean joining = !rendererWasEnabledFlags[i] && playing;
// Build an array of formats contained by the selection. // Build an array of formats contained by the selection.
......
...@@ -559,13 +559,13 @@ public abstract class Timeline { ...@@ -559,13 +559,13 @@ public abstract class Timeline {
* @param repeatMode A repeat mode. * @param repeatMode A repeat mode.
* @return The index of the next window, or {@link C#INDEX_UNSET} if this is the last window. * @return The index of the next window, or {@link C#INDEX_UNSET} if this is the last window.
*/ */
public int getNextWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getNextWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
switch (repeatMode) { switch (repeatMode) {
case ExoPlayer.REPEAT_MODE_OFF: case Player.REPEAT_MODE_OFF:
return windowIndex == getWindowCount() - 1 ? C.INDEX_UNSET : windowIndex + 1; return windowIndex == getWindowCount() - 1 ? C.INDEX_UNSET : windowIndex + 1;
case ExoPlayer.REPEAT_MODE_ONE: case Player.REPEAT_MODE_ONE:
return windowIndex; return windowIndex;
case ExoPlayer.REPEAT_MODE_ALL: case Player.REPEAT_MODE_ALL:
return windowIndex == getWindowCount() - 1 ? 0 : windowIndex + 1; return windowIndex == getWindowCount() - 1 ? 0 : windowIndex + 1;
default: default:
throw new IllegalStateException(); throw new IllegalStateException();
...@@ -580,13 +580,13 @@ public abstract class Timeline { ...@@ -580,13 +580,13 @@ public abstract class Timeline {
* @param repeatMode A repeat mode. * @param repeatMode A repeat mode.
* @return The index of the previous window, or {@link C#INDEX_UNSET} if this is the first window. * @return The index of the previous window, or {@link C#INDEX_UNSET} if this is the first window.
*/ */
public int getPreviousWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getPreviousWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
switch (repeatMode) { switch (repeatMode) {
case ExoPlayer.REPEAT_MODE_OFF: case Player.REPEAT_MODE_OFF:
return windowIndex == 0 ? C.INDEX_UNSET : windowIndex - 1; return windowIndex == 0 ? C.INDEX_UNSET : windowIndex - 1;
case ExoPlayer.REPEAT_MODE_ONE: case Player.REPEAT_MODE_ONE:
return windowIndex; return windowIndex;
case ExoPlayer.REPEAT_MODE_ALL: case Player.REPEAT_MODE_ALL:
return windowIndex == 0 ? getWindowCount() - 1 : windowIndex - 1; return windowIndex == 0 ? getWindowCount() - 1 : windowIndex - 1;
default: default:
throw new IllegalStateException(); throw new IllegalStateException();
...@@ -601,7 +601,7 @@ public abstract class Timeline { ...@@ -601,7 +601,7 @@ public abstract class Timeline {
* @param repeatMode A repeat mode. * @param repeatMode A repeat mode.
* @return Whether the window of the given index is the last window of the timeline. * @return Whether the window of the given index is the last window of the timeline.
*/ */
public final boolean isLastWindow(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public final boolean isLastWindow(int windowIndex, @Player.RepeatMode int repeatMode) {
return getNextWindowIndex(windowIndex, repeatMode) == C.INDEX_UNSET; return getNextWindowIndex(windowIndex, repeatMode) == C.INDEX_UNSET;
} }
...@@ -613,7 +613,7 @@ public abstract class Timeline { ...@@ -613,7 +613,7 @@ public abstract class Timeline {
* @param repeatMode A repeat mode. * @param repeatMode A repeat mode.
* @return Whether the window of the given index is the first window of the timeline. * @return Whether the window of the given index is the first window of the timeline.
*/ */
public final boolean isFirstWindow(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public final boolean isFirstWindow(int windowIndex, @Player.RepeatMode int repeatMode) {
return getPreviousWindowIndex(windowIndex, repeatMode) == C.INDEX_UNSET; return getPreviousWindowIndex(windowIndex, repeatMode) == C.INDEX_UNSET;
} }
...@@ -672,7 +672,7 @@ public abstract class Timeline { ...@@ -672,7 +672,7 @@ public abstract class Timeline {
* @return The index of the next period, or {@link C#INDEX_UNSET} if this is the last period. * @return The index of the next period, or {@link C#INDEX_UNSET} if this is the last period.
*/ */
public final int getNextPeriodIndex(int periodIndex, Period period, Window window, public final int getNextPeriodIndex(int periodIndex, Period period, Window window,
@ExoPlayer.RepeatMode int repeatMode) { @Player.RepeatMode int repeatMode) {
int windowIndex = getPeriod(periodIndex, period).windowIndex; int windowIndex = getPeriod(periodIndex, period).windowIndex;
if (getWindow(windowIndex, window).lastPeriodIndex == periodIndex) { if (getWindow(windowIndex, window).lastPeriodIndex == periodIndex) {
int nextWindowIndex = getNextWindowIndex(windowIndex, repeatMode); int nextWindowIndex = getNextWindowIndex(windowIndex, repeatMode);
...@@ -695,7 +695,7 @@ public abstract class Timeline { ...@@ -695,7 +695,7 @@ public abstract class Timeline {
* @return Whether the period of the given index is the last period of the timeline. * @return Whether the period of the given index is the last period of the timeline.
*/ */
public final boolean isLastPeriod(int periodIndex, Period period, Window window, public final boolean isLastPeriod(int periodIndex, Period period, Window window,
@ExoPlayer.RepeatMode int repeatMode) { @Player.RepeatMode int repeatMode) {
return getNextPeriodIndex(periodIndex, period, window, repeatMode) == C.INDEX_UNSET; return getNextPeriodIndex(periodIndex, period, window, repeatMode) == C.INDEX_UNSET;
} }
......
...@@ -17,7 +17,7 @@ package com.google.android.exoplayer2.source; ...@@ -17,7 +17,7 @@ package com.google.android.exoplayer2.source;
import android.util.Pair; import android.util.Pair;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
/** /**
...@@ -75,19 +75,19 @@ import com.google.android.exoplayer2.Timeline; ...@@ -75,19 +75,19 @@ import com.google.android.exoplayer2.Timeline;
} }
@Override @Override
public int getNextWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getNextWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
getChildDataByWindowIndex(windowIndex, childDataHolder); getChildDataByWindowIndex(windowIndex, childDataHolder);
int firstWindowIndexInChild = childDataHolder.firstWindowIndexInChild; int firstWindowIndexInChild = childDataHolder.firstWindowIndexInChild;
int nextWindowIndexInChild = childDataHolder.timeline.getNextWindowIndex( int nextWindowIndexInChild = childDataHolder.timeline.getNextWindowIndex(
windowIndex - firstWindowIndexInChild, windowIndex - firstWindowIndexInChild,
repeatMode == ExoPlayer.REPEAT_MODE_ALL ? ExoPlayer.REPEAT_MODE_OFF : repeatMode); repeatMode == Player.REPEAT_MODE_ALL ? Player.REPEAT_MODE_OFF : repeatMode);
if (nextWindowIndexInChild != C.INDEX_UNSET) { if (nextWindowIndexInChild != C.INDEX_UNSET) {
return firstWindowIndexInChild + nextWindowIndexInChild; return firstWindowIndexInChild + nextWindowIndexInChild;
} else { } else {
firstWindowIndexInChild += childDataHolder.timeline.getWindowCount(); firstWindowIndexInChild += childDataHolder.timeline.getWindowCount();
if (firstWindowIndexInChild < getWindowCount()) { if (firstWindowIndexInChild < getWindowCount()) {
return firstWindowIndexInChild; return firstWindowIndexInChild;
} else if (repeatMode == ExoPlayer.REPEAT_MODE_ALL) { } else if (repeatMode == Player.REPEAT_MODE_ALL) {
return 0; return 0;
} else { } else {
return C.INDEX_UNSET; return C.INDEX_UNSET;
...@@ -96,18 +96,18 @@ import com.google.android.exoplayer2.Timeline; ...@@ -96,18 +96,18 @@ import com.google.android.exoplayer2.Timeline;
} }
@Override @Override
public int getPreviousWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getPreviousWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
getChildDataByWindowIndex(windowIndex, childDataHolder); getChildDataByWindowIndex(windowIndex, childDataHolder);
int firstWindowIndexInChild = childDataHolder.firstWindowIndexInChild; int firstWindowIndexInChild = childDataHolder.firstWindowIndexInChild;
int previousWindowIndexInChild = childDataHolder.timeline.getPreviousWindowIndex( int previousWindowIndexInChild = childDataHolder.timeline.getPreviousWindowIndex(
windowIndex - firstWindowIndexInChild, windowIndex - firstWindowIndexInChild,
repeatMode == ExoPlayer.REPEAT_MODE_ALL ? ExoPlayer.REPEAT_MODE_OFF : repeatMode); repeatMode == Player.REPEAT_MODE_ALL ? Player.REPEAT_MODE_OFF : repeatMode);
if (previousWindowIndexInChild != C.INDEX_UNSET) { if (previousWindowIndexInChild != C.INDEX_UNSET) {
return firstWindowIndexInChild + previousWindowIndexInChild; return firstWindowIndexInChild + previousWindowIndexInChild;
} else { } else {
if (firstWindowIndexInChild > 0) { if (firstWindowIndexInChild > 0) {
return firstWindowIndexInChild - 1; return firstWindowIndexInChild - 1;
} else if (repeatMode == ExoPlayer.REPEAT_MODE_ALL) { } else if (repeatMode == Player.REPEAT_MODE_ALL) {
return getWindowCount() - 1; return getWindowCount() - 1;
} else { } else {
return C.INDEX_UNSET; return C.INDEX_UNSET;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package com.google.android.exoplayer2.source; package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.upstream.Allocator; import com.google.android.exoplayer2.upstream.Allocator;
import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.Assertions;
...@@ -51,8 +52,7 @@ public final class ConcatenatingMediaSource implements MediaSource { ...@@ -51,8 +52,7 @@ public final class ConcatenatingMediaSource implements MediaSource {
/** /**
* @param isRepeatOneAtomic Whether the concatenated media source shall be treated as atomic * @param isRepeatOneAtomic Whether the concatenated media source shall be treated as atomic
* (i.e., repeated in its entirety) when repeat mode is set to * (i.e., repeated in its entirety) when repeat mode is set to {@code Player.REPEAT_MODE_ONE}.
* {@code ExoPlayer.REPEAT_MODE_ONE}.
* @param mediaSources The {@link MediaSource}s to concatenate. It is valid for the same * @param mediaSources The {@link MediaSource}s to concatenate. It is valid for the same
* {@link MediaSource} instance to be present more than once in the array. * {@link MediaSource} instance to be present more than once in the array.
*/ */
...@@ -193,17 +193,17 @@ public final class ConcatenatingMediaSource implements MediaSource { ...@@ -193,17 +193,17 @@ public final class ConcatenatingMediaSource implements MediaSource {
} }
@Override @Override
public int getNextWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getNextWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
if (isRepeatOneAtomic && repeatMode == ExoPlayer.REPEAT_MODE_ONE) { if (isRepeatOneAtomic && repeatMode == Player.REPEAT_MODE_ONE) {
repeatMode = ExoPlayer.REPEAT_MODE_ALL; repeatMode = Player.REPEAT_MODE_ALL;
} }
return super.getNextWindowIndex(windowIndex, repeatMode); return super.getNextWindowIndex(windowIndex, repeatMode);
} }
@Override @Override
public int getPreviousWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getPreviousWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
if (isRepeatOneAtomic && repeatMode == ExoPlayer.REPEAT_MODE_ONE) { if (isRepeatOneAtomic && repeatMode == Player.REPEAT_MODE_ONE) {
repeatMode = ExoPlayer.REPEAT_MODE_ALL; repeatMode = Player.REPEAT_MODE_ALL;
} }
return super.getPreviousWindowIndex(windowIndex, repeatMode); return super.getPreviousWindowIndex(windowIndex, repeatMode);
} }
......
...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source; ...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.upstream.Allocator; import com.google.android.exoplayer2.upstream.Allocator;
import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.Assertions;
...@@ -161,13 +162,13 @@ public final class LoopingMediaSource implements MediaSource { ...@@ -161,13 +162,13 @@ public final class LoopingMediaSource implements MediaSource {
} }
@Override @Override
public int getNextWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getNextWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
int childNextWindowIndex = childTimeline.getNextWindowIndex(windowIndex, repeatMode); int childNextWindowIndex = childTimeline.getNextWindowIndex(windowIndex, repeatMode);
return childNextWindowIndex == C.INDEX_UNSET ? 0 : childNextWindowIndex; return childNextWindowIndex == C.INDEX_UNSET ? 0 : childNextWindowIndex;
} }
@Override @Override
public int getPreviousWindowIndex(int windowIndex, @ExoPlayer.RepeatMode int repeatMode) { public int getPreviousWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode) {
int childPreviousWindowIndex = childTimeline.getPreviousWindowIndex(windowIndex, repeatMode); int childPreviousWindowIndex = childTimeline.getPreviousWindowIndex(windowIndex, repeatMode);
return childPreviousWindowIndex == C.INDEX_UNSET ? getWindowCount() - 1 return childPreviousWindowIndex == C.INDEX_UNSET ? getWindowCount() - 1
: childPreviousWindowIndex; : childPreviousWindowIndex;
......
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
package com.google.android.exoplayer2.util; package com.google.android.exoplayer2.util;
import android.support.annotation.IntDef; import android.support.annotation.IntDef;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.ExoPlayer;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -58,10 +56,10 @@ public final class RepeatModeUtil { ...@@ -58,10 +56,10 @@ public final class RepeatModeUtil {
* @param enabledModes Bitmask of enabled modes. * @param enabledModes Bitmask of enabled modes.
* @return The next repeat mode. * @return The next repeat mode.
*/ */
public static @ExoPlayer.RepeatMode int getNextRepeatMode( public static @Player.RepeatMode int getNextRepeatMode(@Player.RepeatMode int currentMode,
@ExoPlayer.RepeatMode int currentMode, int enabledModes) { int enabledModes) {
for (int offset = 1; offset <= 2; offset++) { for (int offset = 1; offset <= 2; offset++) {
@ExoPlayer.RepeatMode int proposedMode = (currentMode + offset) % 3; @Player.RepeatMode int proposedMode = (currentMode + offset) % 3;
if (isRepeatModeEnabled(proposedMode, enabledModes)) { if (isRepeatModeEnabled(proposedMode, enabledModes)) {
return proposedMode; return proposedMode;
} }
...@@ -76,14 +74,13 @@ public final class RepeatModeUtil { ...@@ -76,14 +74,13 @@ public final class RepeatModeUtil {
* @param enabledModes The bitmask representing the enabled modes. * @param enabledModes The bitmask representing the enabled modes.
* @return {@code true} if enabled. * @return {@code true} if enabled.
*/ */
public static boolean isRepeatModeEnabled(@ExoPlayer.RepeatMode int repeatMode, public static boolean isRepeatModeEnabled(@Player.RepeatMode int repeatMode, int enabledModes) {
int enabledModes) {
switch (repeatMode) { switch (repeatMode) {
case ExoPlayer.REPEAT_MODE_OFF: case Player.REPEAT_MODE_OFF:
return true; return true;
case ExoPlayer.REPEAT_MODE_ONE: case Player.REPEAT_MODE_ONE:
return (enabledModes & REPEAT_TOGGLE_MODE_ONE) != 0; return (enabledModes & REPEAT_TOGGLE_MODE_ONE) != 0;
case ExoPlayer.REPEAT_MODE_ALL: case Player.REPEAT_MODE_ALL:
return (enabledModes & REPEAT_TOGGLE_MODE_ALL) != 0; return (enabledModes & REPEAT_TOGGLE_MODE_ALL) != 0;
default: default:
return false; return false;
......
...@@ -17,9 +17,9 @@ package com.google.android.exoplayer2.ui; ...@@ -17,9 +17,9 @@ package com.google.android.exoplayer2.ui;
import android.widget.TextView; import android.widget.TextView;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.decoder.DecoderCounters; import com.google.android.exoplayer2.decoder.DecoderCounters;
...@@ -30,7 +30,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray; ...@@ -30,7 +30,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
* A helper class for periodically updating a {@link TextView} with debug information obtained from * A helper class for periodically updating a {@link TextView} with debug information obtained from
* a {@link SimpleExoPlayer}. * a {@link SimpleExoPlayer}.
*/ */
public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListener { public final class DebugTextViewHelper implements Runnable, Player.EventListener {
private static final int REFRESH_INTERVAL_MS = 1000; private static final int REFRESH_INTERVAL_MS = 1000;
...@@ -74,7 +74,7 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe ...@@ -74,7 +74,7 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
textView.removeCallbacks(this); textView.removeCallbacks(this);
} }
// ExoPlayer.EventListener implementation. // Player.EventListener implementation.
@Override @Override
public void onLoadingChanged(boolean isLoading) { public void onLoadingChanged(boolean isLoading) {
...@@ -135,16 +135,16 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe ...@@ -135,16 +135,16 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
private String getPlayerStateString() { private String getPlayerStateString() {
String text = "playWhenReady:" + player.getPlayWhenReady() + " playbackState:"; String text = "playWhenReady:" + player.getPlayWhenReady() + " playbackState:";
switch (player.getPlaybackState()) { switch (player.getPlaybackState()) {
case ExoPlayer.STATE_BUFFERING: case Player.STATE_BUFFERING:
text += "buffering"; text += "buffering";
break; break;
case ExoPlayer.STATE_ENDED: case Player.STATE_ENDED:
text += "ended"; text += "ended";
break; break;
case ExoPlayer.STATE_IDLE: case Player.STATE_IDLE:
text += "idle"; text += "idle";
break; break;
case ExoPlayer.STATE_READY: case Player.STATE_READY:
text += "ready"; text += "ready";
break; break;
default: default:
......
...@@ -35,8 +35,8 @@ import android.widget.FrameLayout; ...@@ -35,8 +35,8 @@ import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.metadata.Metadata;
...@@ -726,8 +726,8 @@ public final class SimpleExoPlayerView extends FrameLayout { ...@@ -726,8 +726,8 @@ public final class SimpleExoPlayerView extends FrameLayout {
return true; return true;
} }
int playbackState = player.getPlaybackState(); int playbackState = player.getPlaybackState();
return controllerAutoShow && (playbackState == ExoPlayer.STATE_IDLE return controllerAutoShow && (playbackState == Player.STATE_IDLE
|| playbackState == ExoPlayer.STATE_ENDED || !player.getPlayWhenReady()); || playbackState == Player.STATE_ENDED || !player.getPlayWhenReady());
} }
private void showController(boolean showIndefinitely) { private void showController(boolean showIndefinitely) {
...@@ -830,7 +830,7 @@ public final class SimpleExoPlayerView extends FrameLayout { ...@@ -830,7 +830,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
} }
private final class ComponentListener implements SimpleExoPlayer.VideoListener, private final class ComponentListener implements SimpleExoPlayer.VideoListener,
TextRenderer.Output, ExoPlayer.EventListener { TextRenderer.Output, Player.EventListener {
// TextRenderer.Output implementation // TextRenderer.Output implementation
...@@ -864,7 +864,7 @@ public final class SimpleExoPlayerView extends FrameLayout { ...@@ -864,7 +864,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
updateForCurrentTrackSelections(); updateForCurrentTrackSelections();
} }
// ExoPlayer.EventListener implementation // Player.EventListener implementation
@Override @Override
public void onLoadingChanged(boolean isLoading) { public void onLoadingChanged(boolean isLoading) {
......
...@@ -25,6 +25,7 @@ import com.google.android.exoplayer2.ExoPlayer; ...@@ -25,6 +25,7 @@ import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.RenderersFactory; import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
...@@ -51,7 +52,7 @@ import junit.framework.Assert; ...@@ -51,7 +52,7 @@ import junit.framework.Assert;
/** /**
* A {@link HostedTest} for {@link ExoPlayer} playback tests. * A {@link HostedTest} for {@link ExoPlayer} playback tests.
*/ */
public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListener, public abstract class ExoHostedTest implements HostedTest, Player.EventListener,
AudioRendererEventListener, VideoRendererEventListener { AudioRendererEventListener, VideoRendererEventListener {
static { static {
...@@ -78,7 +79,7 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen ...@@ -78,7 +79,7 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
private SimpleExoPlayer player; private SimpleExoPlayer player;
private Surface surface; private Surface surface;
private ExoPlaybackException playerError; private ExoPlaybackException playerError;
private ExoPlayer.EventListener playerEventListener; private Player.EventListener playerEventListener;
private boolean playerWasPrepared; private boolean playerWasPrepared;
private boolean playerFinished; private boolean playerFinished;
private boolean playing; private boolean playing;
...@@ -131,9 +132,9 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen ...@@ -131,9 +132,9 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
} }
/** /**
* Sets an {@link ExoPlayer.EventListener} to listen for ExoPlayer events during the test. * Sets an {@link Player.EventListener} to listen for ExoPlayer events during the test.
*/ */
public final void setEventListener(ExoPlayer.EventListener eventListener) { public final void setEventListener(Player.EventListener eventListener) {
this.playerEventListener = eventListener; this.playerEventListener = eventListener;
if (player != null) { if (player != null) {
player.addListener(eventListener); player.addListener(eventListener);
...@@ -200,7 +201,7 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen ...@@ -200,7 +201,7 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
assertPassed(audioDecoderCounters, videoDecoderCounters); assertPassed(audioDecoderCounters, videoDecoderCounters);
} }
// ExoPlayer.EventListener // Player.EventListener
@Override @Override
public void onLoadingChanged(boolean isLoading) { public void onLoadingChanged(boolean isLoading) {
...@@ -215,12 +216,12 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen ...@@ -215,12 +216,12 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
@Override @Override
public final void onPlayerStateChanged(boolean playWhenReady, int playbackState) { public final void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
Log.d(tag, "state [" + playWhenReady + ", " + playbackState + "]"); Log.d(tag, "state [" + playWhenReady + ", " + playbackState + "]");
playerWasPrepared |= playbackState != ExoPlayer.STATE_IDLE; playerWasPrepared |= playbackState != Player.STATE_IDLE;
if (playbackState == ExoPlayer.STATE_ENDED if (playbackState == Player.STATE_ENDED
|| (playbackState == ExoPlayer.STATE_IDLE && playerWasPrepared)) { || (playbackState == Player.STATE_IDLE && playerWasPrepared)) {
playerFinished = true; playerFinished = true;
} }
boolean playing = playWhenReady && playbackState == ExoPlayer.STATE_READY; boolean playing = playWhenReady && playbackState == Player.STATE_READY;
if (!this.playing && playing) { if (!this.playing && playing) {
lastPlayingStartTimeMs = SystemClock.elapsedRealtime(); lastPlayingStartTimeMs = SystemClock.elapsedRealtime();
} else if (this.playing && !playing) { } else if (this.playing && !playing) {
......
...@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.ExoPlaybackException; ...@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer; import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.MediaSource;
...@@ -37,7 +38,7 @@ import junit.framework.Assert; ...@@ -37,7 +38,7 @@ import junit.framework.Assert;
/** /**
* Wraps a player with its own handler thread. * Wraps a player with its own handler thread.
*/ */
public class ExoPlayerWrapper implements ExoPlayer.EventListener { public class ExoPlayerWrapper implements Player.EventListener {
private final CountDownLatch sourceInfoCountDownLatch; private final CountDownLatch sourceInfoCountDownLatch;
private final CountDownLatch endedCountDownLatch; private final CountDownLatch endedCountDownLatch;
...@@ -142,7 +143,7 @@ public class ExoPlayerWrapper implements ExoPlayer.EventListener { ...@@ -142,7 +143,7 @@ public class ExoPlayerWrapper implements ExoPlayer.EventListener {
} }
} }
// ExoPlayer.EventListener implementation. // Player.EventListener implementation.
@Override @Override
public void onLoadingChanged(boolean isLoading) { public void onLoadingChanged(boolean isLoading) {
...@@ -151,7 +152,7 @@ public class ExoPlayerWrapper implements ExoPlayer.EventListener { ...@@ -151,7 +152,7 @@ public class ExoPlayerWrapper implements ExoPlayer.EventListener {
@Override @Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playbackState == ExoPlayer.STATE_ENDED) { if (playbackState == Player.STATE_ENDED) {
endedCountDownLatch.countDown(); endedCountDownLatch.countDown();
} }
} }
......
...@@ -18,7 +18,7 @@ package com.google.android.exoplayer2.testutil; ...@@ -18,7 +18,7 @@ package com.google.android.exoplayer2.testutil;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Timeline.Period; import com.google.android.exoplayer2.Timeline.Period;
import com.google.android.exoplayer2.Timeline.Window; import com.google.android.exoplayer2.Timeline.Window;
...@@ -71,7 +71,7 @@ public final class TimelineAsserts { ...@@ -71,7 +71,7 @@ public final class TimelineAsserts {
* mode. * mode.
*/ */
public static void assertPreviousWindowIndices(Timeline timeline, public static void assertPreviousWindowIndices(Timeline timeline,
@ExoPlayer.RepeatMode int repeatMode, int... expectedPreviousWindowIndices) { @Player.RepeatMode int repeatMode, int... expectedPreviousWindowIndices) {
for (int i = 0; i < timeline.getWindowCount(); i++) { for (int i = 0; i < timeline.getWindowCount(); i++) {
assertEquals(expectedPreviousWindowIndices[i], assertEquals(expectedPreviousWindowIndices[i],
timeline.getPreviousWindowIndex(i, repeatMode)); timeline.getPreviousWindowIndex(i, repeatMode));
...@@ -82,8 +82,8 @@ public final class TimelineAsserts { ...@@ -82,8 +82,8 @@ public final class TimelineAsserts {
* Asserts that next window indices for each window are set correctly depending on the repeat * Asserts that next window indices for each window are set correctly depending on the repeat
* mode. * mode.
*/ */
public static void assertNextWindowIndices(Timeline timeline, public static void assertNextWindowIndices(Timeline timeline, @Player.RepeatMode int repeatMode,
@ExoPlayer.RepeatMode int repeatMode, int... expectedNextWindowIndices) { int... expectedNextWindowIndices) {
for (int i = 0; i < timeline.getWindowCount(); i++) { for (int i = 0; i < timeline.getWindowCount(); i++) {
assertEquals(expectedNextWindowIndices[i], assertEquals(expectedNextWindowIndices[i],
timeline.getNextWindowIndex(i, repeatMode)); timeline.getNextWindowIndex(i, repeatMode));
...@@ -119,19 +119,16 @@ public final class TimelineAsserts { ...@@ -119,19 +119,16 @@ public final class TimelineAsserts {
} }
assertEquals(expectedWindowIndex, period.windowIndex); assertEquals(expectedWindowIndex, period.windowIndex);
if (i < accumulatedPeriodCounts[expectedWindowIndex + 1] - 1) { if (i < accumulatedPeriodCounts[expectedWindowIndex + 1] - 1) {
assertEquals(i + 1, timeline.getNextPeriodIndex(i, period, window, assertEquals(i + 1, timeline.getNextPeriodIndex(i, period, window, Player.REPEAT_MODE_OFF));
ExoPlayer.REPEAT_MODE_OFF)); assertEquals(i + 1, timeline.getNextPeriodIndex(i, period, window, Player.REPEAT_MODE_ONE));
assertEquals(i + 1, timeline.getNextPeriodIndex(i, period, window, assertEquals(i + 1, timeline.getNextPeriodIndex(i, period, window, Player.REPEAT_MODE_ALL));
ExoPlayer.REPEAT_MODE_ONE));
assertEquals(i + 1, timeline.getNextPeriodIndex(i, period, window,
ExoPlayer.REPEAT_MODE_ALL));
} else { } else {
int nextWindowOff = timeline.getNextWindowIndex(expectedWindowIndex, int nextWindowOff = timeline.getNextWindowIndex(expectedWindowIndex,
ExoPlayer.REPEAT_MODE_OFF); Player.REPEAT_MODE_OFF);
int nextWindowOne = timeline.getNextWindowIndex(expectedWindowIndex, int nextWindowOne = timeline.getNextWindowIndex(expectedWindowIndex,
ExoPlayer.REPEAT_MODE_ONE); Player.REPEAT_MODE_ONE);
int nextWindowAll = timeline.getNextWindowIndex(expectedWindowIndex, int nextWindowAll = timeline.getNextWindowIndex(expectedWindowIndex,
ExoPlayer.REPEAT_MODE_ALL); Player.REPEAT_MODE_ALL);
int nextPeriodOff = nextWindowOff == C.INDEX_UNSET ? C.INDEX_UNSET int nextPeriodOff = nextWindowOff == C.INDEX_UNSET ? C.INDEX_UNSET
: accumulatedPeriodCounts[nextWindowOff]; : accumulatedPeriodCounts[nextWindowOff];
int nextPeriodOne = nextWindowOne == C.INDEX_UNSET ? C.INDEX_UNSET int nextPeriodOne = nextWindowOne == C.INDEX_UNSET ? C.INDEX_UNSET
...@@ -139,11 +136,11 @@ public final class TimelineAsserts { ...@@ -139,11 +136,11 @@ public final class TimelineAsserts {
int nextPeriodAll = nextWindowAll == C.INDEX_UNSET ? C.INDEX_UNSET int nextPeriodAll = nextWindowAll == C.INDEX_UNSET ? C.INDEX_UNSET
: accumulatedPeriodCounts[nextWindowAll]; : accumulatedPeriodCounts[nextWindowAll];
assertEquals(nextPeriodOff, timeline.getNextPeriodIndex(i, period, window, assertEquals(nextPeriodOff, timeline.getNextPeriodIndex(i, period, window,
ExoPlayer.REPEAT_MODE_OFF)); Player.REPEAT_MODE_OFF));
assertEquals(nextPeriodOne, timeline.getNextPeriodIndex(i, period, window, assertEquals(nextPeriodOne, timeline.getNextPeriodIndex(i, period, window,
ExoPlayer.REPEAT_MODE_ONE)); Player.REPEAT_MODE_ONE));
assertEquals(nextPeriodAll, timeline.getNextPeriodIndex(i, period, window, assertEquals(nextPeriodAll, timeline.getNextPeriodIndex(i, period, window,
ExoPlayer.REPEAT_MODE_ALL)); Player.REPEAT_MODE_ALL));
} }
} }
} }
......
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