Rename Window->MediaWindow, Timline->MediaTimeline

Window is potentially confusing with Android's Window class.
Once Window is renamed, it makes sense to rename Timeline too.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130938392
This commit is contained in:
olly 2016-08-22 07:51:23 -07:00 committed by Oliver Woodman
parent fb55254f90
commit 94c908e89c
26 changed files with 122 additions and 122 deletions

View File

@ -22,8 +22,8 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.RendererCapabilities;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.audio.AudioRendererEventListener;
import com.google.android.exoplayer2.decoder.DecoderCounters;
import com.google.android.exoplayer2.drm.StreamingDrmSessionManager;
@ -89,7 +89,7 @@ import java.util.Locale;
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
int periodCount = timeline.getPeriodCount();
int windowCount = timeline.getWindowCount();
Log.d(TAG, "sourceInfo[startTime=" + timeline.getAbsoluteStartTime() + ", periodCount="

View File

@ -40,9 +40,9 @@ import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.MediaWindow;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Window;
import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.drm.HttpMediaDrmCallback;
import com.google.android.exoplayer2.drm.StreamingDrmSessionManager;
@ -376,9 +376,9 @@ public class PlayerActivity extends Activity implements OnKeyListener, OnTouchLi
debugViewHelper.stop();
debugViewHelper = null;
shouldRestorePosition = false;
Timeline playerTimeline = player.getCurrentTimeline();
MediaTimeline playerTimeline = player.getCurrentTimeline();
if (playerTimeline != null) {
Window window = playerTimeline.getWindow(player.getCurrentWindowIndex());
MediaWindow window = playerTimeline.getWindow(player.getCurrentWindowIndex());
if (!window.isDynamic) {
shouldRestorePosition = true;
playerPeriod = player.getCurrentPeriodIndex();
@ -417,7 +417,7 @@ public class PlayerActivity extends Activity implements OnKeyListener, OnTouchLi
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
// Do nothing.
}

View File

@ -22,8 +22,8 @@ import android.test.InstrumentationTestCase;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
@ -96,7 +96,7 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
// Do nothing.
}

View File

@ -22,8 +22,8 @@ import android.test.InstrumentationTestCase;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
@ -96,7 +96,7 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
// Do nothing.
}

View File

@ -22,8 +22,8 @@ import android.test.InstrumentationTestCase;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
@ -115,7 +115,7 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
// Do nothing.
}

View File

@ -133,7 +133,7 @@ public interface ExoPlayer {
* @param timeline The source's timeline.
* @param manifest The loaded manifest.
*/
void onSourceInfoRefreshed(Timeline timeline, Object manifest);
void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest);
/**
* Called when an error occurs. The playback state will transition to {@link #STATE_IDLE}
@ -376,9 +376,9 @@ public interface ExoPlayer {
void blockingSendMessages(ExoPlayerMessage... messages);
/**
* Returns the current {@link Timeline}, or {@code null} if there is no timeline.
* Returns the current {@link MediaTimeline}, or {@code null} if there is no timeline.
*/
Timeline getCurrentTimeline();
MediaTimeline getCurrentTimeline();
/**
* Returns the current manifest. The type depends on the {@link MediaSource} passed to
@ -421,7 +421,7 @@ public interface ExoPlayer {
@Deprecated
int getBufferedPercentageInPeriod();
// Window based.
// MediaWindow based.
/**
* Returns the index of the seek window associated with the current period, or

View File

@ -42,7 +42,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
private int playbackState;
private int pendingSeekAcks;
private boolean isLoading;
private Timeline timeline;
private MediaTimeline timeline;
private Object manifest;
// Playback information when there is no pending seek/set source operation.
@ -166,7 +166,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Override
public void seekTo(long positionMs) {
Timeline timeline = getCurrentTimeline();
MediaTimeline timeline = getCurrentTimeline();
if (timeline == null) {
throw new IllegalArgumentException("Windows are not yet known");
}
@ -297,7 +297,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
int periodIndex = getCurrentPeriodIndex();
int windowIndex = timeline.getPeriodWindowIndex(periodIndex);
Window window = timeline.getWindow(windowIndex);
MediaWindow window = timeline.getWindow(windowIndex);
int firstPeriodIndex = timeline.getWindowFirstPeriodIndex(windowIndex);
int lastPeriodIndex = timeline.getWindowLastPeriodIndex(windowIndex);
if (firstPeriodIndex == periodIndex && lastPeriodIndex == periodIndex
@ -320,7 +320,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
@Override
public Timeline getCurrentTimeline() {
public MediaTimeline getCurrentTimeline() {
return timeline;
}
@ -370,7 +370,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
case ExoPlayerImplInternal.MSG_SOURCE_INFO_REFRESHED: {
@SuppressWarnings("unchecked")
Pair<Timeline, Object> timelineAndManifest = (Pair<Timeline, Object>) msg.obj;
Pair<MediaTimeline, Object> timelineAndManifest = (Pair<MediaTimeline, Object>) msg.obj;
timeline = timelineAndManifest.first;
manifest = timelineAndManifest.second;
for (EventListener listener : listeners) {

View File

@ -131,7 +131,7 @@ import java.io.IOException;
private Period loadingPeriod;
private long playingPeriodEndPositionUs;
private Timeline timeline;
private MediaTimeline timeline;
public ExoPlayerImplInternal(Renderer[] renderers, TrackSelector trackSelector,
LoadControl loadControl, boolean playWhenReady, Handler eventHandler,
@ -224,7 +224,7 @@ import java.io.IOException;
// MediaSource.Listener implementation.
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
handler.obtainMessage(MSG_REFRESH_SOURCE_INFO, Pair.create(timeline, manifest)).sendToTarget();
}
@ -282,7 +282,7 @@ import java.io.IOException;
return true;
}
case MSG_REFRESH_SOURCE_INFO: {
handleSourceInfoRefreshed((Pair<Timeline, Object>) msg.obj);
handleSourceInfoRefreshed((Pair<MediaTimeline, Object>) msg.obj);
return true;
}
case MSG_SOURCE_CONTINUE_LOADING_REQUESTED: {
@ -785,10 +785,10 @@ import java.io.IOException;
}
}
private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifest)
private void handleSourceInfoRefreshed(Pair<MediaTimeline, Object> timelineAndManifest)
throws ExoPlaybackException, IOException {
eventHandler.obtainMessage(MSG_SOURCE_INFO_REFRESHED, timelineAndManifest).sendToTarget();
Timeline oldTimeline = this.timeline;
MediaTimeline oldTimeline = this.timeline;
this.timeline = timelineAndManifest.first;
// Update the loaded periods to take into account the new timeline.
@ -866,8 +866,8 @@ import java.io.IOException;
}
}
private void attemptRestart(Timeline newTimeline, Timeline oldTimeline, int oldPeriodIndex)
throws ExoPlaybackException {
private void attemptRestart(MediaTimeline newTimeline, MediaTimeline oldTimeline,
int oldPeriodIndex) throws ExoPlaybackException {
int newPeriodIndex = C.INDEX_UNSET;
while (newPeriodIndex == C.INDEX_UNSET
&& oldPeriodIndex < oldTimeline.getPeriodCount() - 1) {
@ -1196,7 +1196,7 @@ import java.io.IOException;
this.nextPeriod = nextPeriod;
}
public void setIndex(Timeline timeline, int index) {
public void setIndex(MediaTimeline timeline, int index) {
this.index = index;
isLast = index == timeline.getPeriodCount() - 1 && !timeline.getPeriodWindow(index).isDynamic;
}

View File

@ -18,7 +18,7 @@ package com.google.android.exoplayer2;
/**
* The player's timeline consisting of one or more periods. Instances are immutable.
*/
public interface Timeline {
public interface MediaTimeline {
/**
* Returns the number of periods in the timeline.
@ -50,8 +50,7 @@ public interface Timeline {
/**
* Returns a unique identifier for the period at {@code periodIndex}, or {@code null} if the
* period at {@code periodIndex} is not known. The identifier is stable across {@link Timeline}
* changes.
* period at {@code periodIndex} is not known. The identifier is stable across timeline changes.
*
* @param periodIndex A period index.
* @return An identifier for the period, or {@code null} if the period is not known.
@ -59,12 +58,12 @@ public interface Timeline {
Object getPeriodId(int periodIndex);
/**
* Returns the {@link Window} to which the period with the specified index belongs.
* Returns the {@link MediaWindow} to which the period with the specified index belongs.
*
* @param periodIndex The period index.
* @return The corresponding window.
*/
Window getPeriodWindow(int periodIndex);
MediaWindow getPeriodWindow(int periodIndex);
/**
* Returns the index of the window to which the period with the specified index belongs.
@ -89,14 +88,14 @@ public interface Timeline {
int getWindowCount();
/**
* Returns the {@link Window} at the specified index.
* Returns the {@link MediaWindow} at the specified index.
*
* @param windowIndex The window index.
*/
Window getWindow(int windowIndex);
MediaWindow getWindow(int windowIndex);
/**
* Returns the index of the first period belonging to the {@link Window} at the specified index.
* Returns the index of the first period belonging to the window at the specified index.
*
* @param windowIndex The window index.
* @return The index of the first period in the window.
@ -104,7 +103,7 @@ public interface Timeline {
int getWindowFirstPeriodIndex(int windowIndex);
/**
* Returns the index of the last period belonging to the {@link Window} at the specified index.
* Returns the index of the last period belonging to the window at the specified index.
*
* @param windowIndex The window index.
* @return The index of the last period in the window.

View File

@ -18,19 +18,19 @@ package com.google.android.exoplayer2;
/**
* A window of available media. Instances are immutable.
*/
public final class Window {
public final class MediaWindow {
/**
* Creates a new {@link Window} consisting of a single period with the specified duration. The
* default start position is zero.
* Creates a new window consisting of a single period with the specified duration. The default
* start position is zero.
*
* @param durationUs The duration of the window, in microseconds.
* @param isSeekable Whether seeking is supported within the window.
* @param isDynamic Whether this seek window may change when the timeline is updated.
*/
public static Window createWindowFromZero(long durationUs, boolean isSeekable,
public static MediaWindow createWindowFromZero(long durationUs, boolean isSeekable,
boolean isDynamic) {
return new Window(durationUs, isSeekable, isDynamic, 0);
return new MediaWindow(durationUs, isSeekable, isDynamic, 0);
}
/**
@ -59,7 +59,7 @@ public final class Window {
* @param defaultStartPositionUs The default position relative to the start of the window at which
* to start playback, in microseconds.
*/
public Window(long durationUs, boolean isSeekable, boolean isDynamic,
public MediaWindow(long durationUs, boolean isSeekable, boolean isDynamic,
long defaultStartPositionUs) {
this.durationUs = durationUs;
this.isSeekable = isSeekable;
@ -85,7 +85,7 @@ public final class Window {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Window other = (Window) obj;
MediaWindow other = (MediaWindow) obj;
return other.durationUs == durationUs
&& other.isSeekable == isSeekable
&& other.isDynamic == isDynamic
@ -94,7 +94,7 @@ public final class Window {
@Override
public String toString() {
return "Window[" + durationUs + ", " + defaultStartPositionUs + ", " + isSeekable + ", "
return "MediaWindow[" + durationUs + ", " + defaultStartPositionUs + ", " + isSeekable + ", "
+ isDynamic + "]";
}

View File

@ -505,7 +505,7 @@ public final class SimpleExoPlayer implements ExoPlayer {
}
@Override
public Timeline getCurrentTimeline() {
public MediaTimeline getCurrentTimeline() {
return player.getCurrentTimeline();
}

View File

@ -17,8 +17,8 @@ package com.google.android.exoplayer2.source;
import android.util.Pair;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Window;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.MediaWindow;
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
import com.google.android.exoplayer2.upstream.Allocator;
import com.google.android.exoplayer2.util.Util;
@ -32,18 +32,18 @@ import java.util.Map;
public final class ConcatenatingMediaSource implements MediaSource {
private final MediaSource[] mediaSources;
private final Timeline[] timelines;
private final MediaTimeline[] timelines;
private final Object[] manifests;
private final Map<MediaPeriod, Integer> sourceIndexByMediaPeriod;
private ConcatenatedTimeline timeline;
private ConcatenatedMediaTimeline timeline;
/**
* @param mediaSources The {@link MediaSource}s to concatenate.
*/
public ConcatenatingMediaSource(MediaSource... mediaSources) {
this.mediaSources = mediaSources;
timelines = new Timeline[mediaSources.length];
timelines = new MediaTimeline[mediaSources.length];
manifests = new Object[mediaSources.length];
sourceIndexByMediaPeriod = new HashMap<>();
}
@ -55,16 +55,16 @@ public final class ConcatenatingMediaSource implements MediaSource {
mediaSources[i].prepareSource(new Listener() {
@Override
public void onSourceInfoRefreshed(Timeline sourceTimeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline sourceTimeline, Object manifest) {
timelines[index] = sourceTimeline;
manifests[index] = manifest;
for (Timeline timeline : timelines) {
for (MediaTimeline timeline : timelines) {
if (timeline == null) {
// Don't invoke the listener until all sources have timelines.
return;
}
}
timeline = new ConcatenatedTimeline(timelines.clone());
timeline = new ConcatenatedMediaTimeline(timelines.clone());
listener.onSourceInfoRefreshed(timeline, manifests.clone());
}
@ -105,21 +105,21 @@ public final class ConcatenatingMediaSource implements MediaSource {
}
/**
* A {@link Timeline} that is the concatenation of one or more {@link Timeline}s.
* A {@link MediaTimeline} that is the concatenation of one or more {@link MediaTimeline}s.
*/
private static final class ConcatenatedTimeline implements Timeline {
private static final class ConcatenatedMediaTimeline implements MediaTimeline {
private final Timeline[] timelines;
private final MediaTimeline[] timelines;
private final int[] sourcePeriodOffsets;
private final int[] sourceWindowOffsets;
public ConcatenatedTimeline(Timeline[] timelines) {
public ConcatenatedMediaTimeline(MediaTimeline[] timelines) {
int[] sourcePeriodOffsets = new int[timelines.length];
int[] sourceWindowOffsets = new int[timelines.length];
int periodCount = 0;
int windowCount = 0;
for (int i = 0; i < timelines.length; i++) {
Timeline timeline = timelines[i];
MediaTimeline timeline = timelines[i];
periodCount += timeline.getPeriodCount();
sourcePeriodOffsets[i] = periodCount;
windowCount += timeline.getWindowCount();
@ -163,7 +163,7 @@ public final class ConcatenatingMediaSource implements MediaSource {
}
@Override
public Window getPeriodWindow(int periodIndex) {
public MediaWindow getPeriodWindow(int periodIndex) {
return getWindow(getPeriodWindowIndex(periodIndex));
}
@ -200,7 +200,7 @@ public final class ConcatenatingMediaSource implements MediaSource {
}
@Override
public Window getWindow(int windowIndex) {
public MediaWindow getWindow(int windowIndex) {
int sourceIndex = getSourceIndexForWindow(windowIndex);
int firstWindowIndexInSource = getFirstWindowIndexInSource(sourceIndex);
return timelines[sourceIndex].getWindow(windowIndex - firstWindowIndexInSource);

View File

@ -299,7 +299,7 @@ import java.util.Arrays;
durationUs = largestQueuedTimestampUs == Long.MIN_VALUE ? 0
: largestQueuedTimestampUs + DEFAULT_LAST_SAMPLE_DURATION_US;
sourceListener.onSourceInfoRefreshed(
new SinglePeriodTimeline(durationUs, seekMap.isSeekable()), null);
new SinglePeriodMediaTimeline(durationUs, seekMap.isSeekable()), null);
}
}
@ -382,7 +382,7 @@ import java.util.Arrays;
tracks = new TrackGroupArray(trackArray);
prepared = true;
sourceListener.onSourceInfoRefreshed(
new SinglePeriodTimeline(durationUs, seekMap.isSeekable()), null);
new SinglePeriodMediaTimeline(durationUs, seekMap.isSeekable()), null);
callback.onPrepared(this);
}

View File

@ -18,8 +18,8 @@ package com.google.android.exoplayer2.source;
import android.net.Uri;
import android.os.Handler;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.extractor.Extractor;
import com.google.android.exoplayer2.extractor.ExtractorsFactory;
@ -94,7 +94,7 @@ public final class ExtractorMediaSource implements MediaSource, MediaSource.List
private final EventListener eventListener;
private MediaSource.Listener sourceListener;
private Timeline timeline;
private MediaTimeline timeline;
/**
* @param uri The {@link Uri} of the media stream.
@ -135,7 +135,7 @@ public final class ExtractorMediaSource implements MediaSource, MediaSource.List
@Override
public void prepareSource(MediaSource.Listener listener) {
sourceListener = listener;
timeline = new SinglePeriodTimeline(C.TIME_UNSET, false);
timeline = new SinglePeriodMediaTimeline(C.TIME_UNSET, false);
listener.onSourceInfoRefreshed(timeline, null);
}
@ -166,7 +166,7 @@ public final class ExtractorMediaSource implements MediaSource, MediaSource.List
// MediaSource.Listener implementation.
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
if (this.timeline.getPeriodDurationUs(0) != C.TIME_UNSET
&& timeline.getPeriodDurationUs(0) == C.TIME_UNSET) {
// Suppress source info changes that would make the duration unknown when it is already known.

View File

@ -15,7 +15,7 @@
*/
package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
import com.google.android.exoplayer2.upstream.Allocator;
import java.io.IOException;
@ -36,7 +36,7 @@ public interface MediaSource {
* @param timeline The source's timeline.
* @param manifest The loaded manifest.
*/
void onSourceInfoRefreshed(Timeline timeline, Object manifest);
void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest);
}

View File

@ -27,6 +27,7 @@ import java.util.IdentityHashMap;
/* package */ final class MergingMediaPeriod implements MediaPeriod, MediaPeriod.Callback {
public final MediaPeriod[] periods;
private final Callback callback;
private final IdentityHashMap<SampleStream, Integer> streamPeriodIndices;

View File

@ -15,7 +15,7 @@
*/
package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
import com.google.android.exoplayer2.upstream.Allocator;
import com.google.android.exoplayer2.util.Assertions;
@ -47,7 +47,7 @@ public final class MergingMediaSource implements MediaSource {
mediaSources[0].prepareSource(new Listener() {
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
checkConsistentTimeline(timeline);
// All source timelines must match.
@ -59,7 +59,7 @@ public final class MergingMediaSource implements MediaSource {
mediaSources[i].prepareSource(new Listener() {
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
checkConsistentTimeline(timeline);
}
@ -102,7 +102,7 @@ public final class MergingMediaSource implements MediaSource {
}
}
private void checkConsistentTimeline(Timeline timeline) {
private void checkConsistentTimeline(MediaTimeline timeline) {
int windowCount = timeline.getWindowCount();
for (int i = 0; i < windowCount; i++) {
Assertions.checkArgument(!timeline.getWindow(i).isDynamic);

View File

@ -16,19 +16,19 @@
package com.google.android.exoplayer2.source;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Window;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.MediaWindow;
import com.google.android.exoplayer2.util.Assertions;
/**
* A {@link Timeline} consisting of a single period and static window.
* A {@link MediaTimeline} consisting of a single period and static window.
*/
public final class SinglePeriodTimeline implements Timeline {
public final class SinglePeriodMediaTimeline implements MediaTimeline {
private static final Object ID = new Object();
private final long offsetInFirstPeriodUs;
private final Window window;
private final MediaWindow window;
/**
* Creates a timeline with one period of known duration and a window extending from zero to its
@ -37,8 +37,8 @@ public final class SinglePeriodTimeline implements Timeline {
* @param durationUs The duration of the period, in microseconds.
* @param isSeekable Whether seeking is supported within the period.
*/
public SinglePeriodTimeline(long durationUs, boolean isSeekable) {
this(0, Window.createWindowFromZero(durationUs, isSeekable, false /* isDynamic */));
public SinglePeriodMediaTimeline(long durationUs, boolean isSeekable) {
this(0, MediaWindow.createWindowFromZero(durationUs, isSeekable, false /* isDynamic */));
}
/**
@ -48,7 +48,7 @@ public final class SinglePeriodTimeline implements Timeline {
* @param offsetInFirstPeriodUs The offset of the start of the window in the period.
* @param window The available window within the period.
*/
public SinglePeriodTimeline(long offsetInFirstPeriodUs, Window window) {
public SinglePeriodMediaTimeline(long offsetInFirstPeriodUs, MediaWindow window) {
this.offsetInFirstPeriodUs = offsetInFirstPeriodUs;
this.window = window;
}
@ -82,7 +82,7 @@ public final class SinglePeriodTimeline implements Timeline {
}
@Override
public Window getPeriodWindow(int periodIndex) {
public MediaWindow getPeriodWindow(int periodIndex) {
Assertions.checkIndex(periodIndex, 0, 1);
return window;
}
@ -104,7 +104,7 @@ public final class SinglePeriodTimeline implements Timeline {
}
@Override
public Window getWindow(int windowIndex) {
public MediaWindow getWindow(int windowIndex) {
Assertions.checkIndex(windowIndex, 0, 1);
return window;
}

View File

@ -18,7 +18,7 @@ package com.google.android.exoplayer2.source;
import android.net.Uri;
import android.os.Handler;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
import com.google.android.exoplayer2.upstream.Allocator;
import com.google.android.exoplayer2.upstream.DataSource;
@ -57,7 +57,7 @@ public final class SingleSampleMediaSource implements MediaSource {
private final Handler eventHandler;
private final EventListener eventListener;
private final int eventSourceId;
private final Timeline timeline;
private final MediaTimeline timeline;
public SingleSampleMediaSource(Uri uri, DataSource.Factory dataSourceFactory, Format format,
long durationUs) {
@ -79,7 +79,7 @@ public final class SingleSampleMediaSource implements MediaSource {
this.eventHandler = eventHandler;
this.eventListener = eventListener;
this.eventSourceId = eventSourceId;
timeline = new SinglePeriodTimeline(durationUs, true);
timeline = new SinglePeriodMediaTimeline(durationUs, true);
}
// MediaSource implementation.

View File

@ -21,9 +21,9 @@ import android.os.SystemClock;
import android.util.Log;
import android.util.SparseArray;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.MediaWindow;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Window;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener.EventDispatcher;
import com.google.android.exoplayer2.source.MediaPeriod;
@ -71,8 +71,8 @@ public final class DashMediaSource implements MediaSource {
public static final long DEFAULT_LIVE_EDGE_OFFSET_FIXED_MS = 30000;
/**
* The interval in milliseconds between invocations of
* {@link MediaSource.Listener#onSourceInfoRefreshed(Timeline, Object)} when the source's
* {@link Window} is changing dynamically (for example, for incomplete live streams).
* {@link MediaSource.Listener#onSourceInfoRefreshed(MediaTimeline, Object)} when the source's
* {@link MediaWindow} is changing dynamically (for example, for incomplete live streams).
*/
private static final int NOTIFY_MANIFEST_INTERVAL_MS = 5000;
@ -99,7 +99,7 @@ public final class DashMediaSource implements MediaSource {
private long manifestLoadEndTimestamp;
private DashManifest manifest;
private Handler handler;
private Window window;
private MediaWindow window;
private long elapsedRealtimeOffsetMs;
private int firstPeriodId;
@ -384,9 +384,9 @@ public final class DashMediaSource implements MediaSource {
}
defaultInitialTimeUs = Math.max(0, windowDurationUs - (liveEdgeOffsetForManifestMs * 1000));
}
window = new Window(windowDurationUs, true /* isSeekable */, manifest.dynamic,
window = new MediaWindow(windowDurationUs, true /* isSeekable */, manifest.dynamic,
defaultInitialTimeUs);
sourceListener.onSourceInfoRefreshed(new DashTimeline(firstPeriodId, currentStartTimeUs,
sourceListener.onSourceInfoRefreshed(new DashMediaTimeline(firstPeriodId, currentStartTimeUs,
manifest, window), manifest);
}
@ -466,15 +466,15 @@ public final class DashMediaSource implements MediaSource {
}
private static final class DashTimeline implements Timeline {
private static final class DashMediaTimeline implements MediaTimeline {
private final int firstPeriodId;
private final long offsetInFirstPeriodUs;
private final DashManifest manifest;
private final Window window;
private final MediaWindow window;
public DashTimeline(int firstPeriodId, long offsetInFirstPeriodUs, DashManifest manifest,
Window window) {
public DashMediaTimeline(int firstPeriodId, long offsetInFirstPeriodUs, DashManifest manifest,
MediaWindow window) {
this.firstPeriodId = firstPeriodId;
this.offsetInFirstPeriodUs = offsetInFirstPeriodUs;
this.manifest = manifest;
@ -509,7 +509,7 @@ public final class DashMediaSource implements MediaSource {
}
@Override
public Window getPeriodWindow(int periodIndex) {
public MediaWindow getPeriodWindow(int periodIndex) {
Assertions.checkIndex(periodIndex, 0, manifest.getPeriodCount());
return window;
}
@ -536,7 +536,7 @@ public final class DashMediaSource implements MediaSource {
}
@Override
public Window getWindow(int windowIndex) {
public MediaWindow getWindow(int windowIndex) {
Assertions.checkIndex(windowIndex, 0, 1);
return window;
}

View File

@ -19,14 +19,14 @@ import android.net.Uri;
import android.text.TextUtils;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener.EventDispatcher;
import com.google.android.exoplayer2.source.CompositeSequenceableLoader;
import com.google.android.exoplayer2.source.MediaPeriod;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.SampleStream;
import com.google.android.exoplayer2.source.SinglePeriodTimeline;
import com.google.android.exoplayer2.source.SinglePeriodMediaTimeline;
import com.google.android.exoplayer2.source.TrackGroup;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist;
@ -282,7 +282,7 @@ import java.util.List;
callback.onPrepared(this);
// TODO[playlists]: Calculate the window.
Timeline timeline = new SinglePeriodTimeline(durationUs, !isLive);
MediaTimeline timeline = new SinglePeriodMediaTimeline(durationUs, !isLive);
sourceListener.onSourceInfoRefreshed(timeline, playlist);
}

View File

@ -23,7 +23,7 @@ import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener.Eve
import com.google.android.exoplayer2.source.MediaPeriod;
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.SinglePeriodTimeline;
import com.google.android.exoplayer2.source.SinglePeriodMediaTimeline;
import com.google.android.exoplayer2.upstream.Allocator;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.util.Assertions;
@ -64,7 +64,7 @@ public final class HlsMediaSource implements MediaSource {
public void prepareSource(MediaSource.Listener listener) {
sourceListener = listener;
// TODO: Defer until the playlist has been loaded.
listener.onSourceInfoRefreshed(new SinglePeriodTimeline(C.TIME_UNSET, false), null);
listener.onSourceInfoRefreshed(new SinglePeriodMediaTimeline(C.TIME_UNSET, false), null);
}
@Override

View File

@ -19,15 +19,15 @@ import android.net.Uri;
import android.os.Handler;
import android.os.SystemClock;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.MediaWindow;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Window;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener.EventDispatcher;
import com.google.android.exoplayer2.source.MediaPeriod;
import com.google.android.exoplayer2.source.MediaPeriod.Callback;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.SinglePeriodTimeline;
import com.google.android.exoplayer2.source.SinglePeriodMediaTimeline;
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest;
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement;
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifestParser;
@ -157,7 +157,7 @@ public final class SsMediaSource implements MediaSource,
for (int i = 0; i < mediaPeriods.size(); i++) {
mediaPeriods.get(i).updateManifest(manifest);
}
Timeline timeline;
MediaTimeline timeline;
if (manifest.isLive) {
long startTimeUs = Long.MAX_VALUE;
long endTimeUs = Long.MIN_VALUE;
@ -170,7 +170,7 @@ public final class SsMediaSource implements MediaSource,
}
}
if (startTimeUs == Long.MAX_VALUE) {
timeline = new SinglePeriodTimeline(C.TIME_UNSET, false);
timeline = new SinglePeriodMediaTimeline(C.TIME_UNSET, false);
} else {
if (manifest.dvrWindowLengthUs != C.TIME_UNSET
&& manifest.dvrWindowLengthUs > 0) {
@ -178,13 +178,13 @@ public final class SsMediaSource implements MediaSource,
}
long durationUs = endTimeUs - startTimeUs;
long defaultInitialStartPositionUs = Math.max(0, durationUs - (liveEdgeOffsetMs * 1000));
Window window = new Window(durationUs, true /* isSeekable */, true /* isDynamic */,
defaultInitialStartPositionUs);
timeline = new SinglePeriodTimeline(startTimeUs, window);
MediaWindow window = new MediaWindow(durationUs, true /* isSeekable */,
true /* isDynamic */, defaultInitialStartPositionUs);
timeline = new SinglePeriodMediaTimeline(startTimeUs, window);
}
} else {
boolean isSeekable = manifest.durationUs != C.TIME_UNSET;
timeline = new SinglePeriodTimeline(manifest.durationUs, isSeekable);
timeline = new SinglePeriodMediaTimeline(manifest.durationUs, isSeekable);
}
sourceListener.onSourceInfoRefreshed(timeline, manifest);
scheduleManifestRefresh();

View File

@ -19,8 +19,8 @@ import android.widget.TextView;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.decoder.DecoderCounters;
/**
@ -89,7 +89,7 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
// Do nothing.
}

View File

@ -19,13 +19,13 @@ import android.view.View;
import android.view.View.OnClickListener;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.MediaTimeline;
/**
* An {@link OnClickListener} that can be passed to
* {@link android.widget.MediaController#setPrevNextListeners(OnClickListener, OnClickListener)} to
* make the controller's previous and next buttons seek to the previous and next windows in the
* {@link Timeline}.
* {@link MediaTimeline}.
*/
public class MediaControllerPrevNextClickListener implements OnClickListener {
@ -54,7 +54,7 @@ public class MediaControllerPrevNextClickListener implements OnClickListener {
if (currentWindowIndex == C.INDEX_UNSET) {
return;
}
Timeline timeline = player.getCurrentTimeline();
MediaTimeline timeline = player.getCurrentTimeline();
if (isNext) {
if (currentWindowIndex < timeline.getWindowCount() - 1) {
player.seekToDefaultPosition(currentWindowIndex + 1);

View File

@ -24,8 +24,8 @@ import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaTimeline;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.audio.AudioRendererEventListener;
import com.google.android.exoplayer2.audio.AudioTrack;
import com.google.android.exoplayer2.decoder.DecoderCounters;
@ -215,7 +215,7 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
}
@Override
public final void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
public final void onSourceInfoRefreshed(MediaTimeline timeline, Object manifest) {
// Do nothing.
}