Commit 48bc98f1 by olly Committed by Oliver Woodman

Naming cleanup.

- RollingSampleBuffer -> DefaultTrackOutput
- TsChunk -> HlsMediaChunk
- Established hls.playlist package for HLS playlist things
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120325049
parent 69b431b8
Showing with 102 additions and 95 deletions
...@@ -30,10 +30,10 @@ import com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser; ...@@ -30,10 +30,10 @@ import com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser;
import com.google.android.exoplayer.drm.MediaDrmCallback; import com.google.android.exoplayer.drm.MediaDrmCallback;
import com.google.android.exoplayer.extractor.ExtractorSampleSource; import com.google.android.exoplayer.extractor.ExtractorSampleSource;
import com.google.android.exoplayer.hls.HlsChunkSource; import com.google.android.exoplayer.hls.HlsChunkSource;
import com.google.android.exoplayer.hls.HlsPlaylist;
import com.google.android.exoplayer.hls.HlsPlaylistParser;
import com.google.android.exoplayer.hls.HlsSampleSource; import com.google.android.exoplayer.hls.HlsSampleSource;
import com.google.android.exoplayer.hls.PtsTimestampAdjusterProvider; import com.google.android.exoplayer.hls.PtsTimestampAdjusterProvider;
import com.google.android.exoplayer.hls.playlist.HlsPlaylist;
import com.google.android.exoplayer.hls.playlist.HlsPlaylistParser;
import com.google.android.exoplayer.smoothstreaming.SmoothStreamingChunkSource; import com.google.android.exoplayer.smoothstreaming.SmoothStreamingChunkSource;
import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest; import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest;
import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifestParser; import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifestParser;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
import com.google.android.exoplayer.C; import com.google.android.exoplayer.C;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
import com.google.android.exoplayer.C; import com.google.android.exoplayer.C;
......
...@@ -17,18 +17,18 @@ package com.google.android.exoplayer.chunk; ...@@ -17,18 +17,18 @@ package com.google.android.exoplayer.chunk;
import com.google.android.exoplayer.Format; import com.google.android.exoplayer.Format;
import com.google.android.exoplayer.drm.DrmInitData; import com.google.android.exoplayer.drm.DrmInitData;
import com.google.android.exoplayer.extractor.RollingSampleBuffer; import com.google.android.exoplayer.extractor.DefaultTrackOutput;
import com.google.android.exoplayer.upstream.DataSource; import com.google.android.exoplayer.upstream.DataSource;
import com.google.android.exoplayer.upstream.DataSpec; import com.google.android.exoplayer.upstream.DataSpec;
/** /**
* A base implementation of {@link MediaChunk}, for chunks that contain a single track. * A base implementation of {@link MediaChunk}, for chunks that contain a single track.
* <p> * <p>
* Loaded samples are output to a {@link RollingSampleBuffer}. * Loaded samples are output to a {@link DefaultTrackOutput}.
*/ */
public abstract class BaseMediaChunk extends MediaChunk { public abstract class BaseMediaChunk extends MediaChunk {
private RollingSampleBuffer trackOutput; private DefaultTrackOutput trackOutput;
private int firstSampleIndex; private int firstSampleIndex;
/** /**
...@@ -46,19 +46,19 @@ public abstract class BaseMediaChunk extends MediaChunk { ...@@ -46,19 +46,19 @@ public abstract class BaseMediaChunk extends MediaChunk {
} }
/** /**
* Initializes the chunk for loading, setting the {@link RollingSampleBuffer} that will receive * Initializes the chunk for loading, setting the {@link DefaultTrackOutput} that will receive
* samples as they are loaded. * samples as they are loaded.
* *
* @param trackOutput The output that will receive the loaded samples. * @param trackOutput The output that will receive the loaded samples.
*/ */
public void init(RollingSampleBuffer trackOutput) { public void init(DefaultTrackOutput trackOutput) {
this.trackOutput = trackOutput; this.trackOutput = trackOutput;
this.firstSampleIndex = trackOutput.getWriteIndex(); this.firstSampleIndex = trackOutput.getWriteIndex();
} }
/** /**
* Returns the index of the first sample in the output that was passed to * Returns the index of the first sample in the output that was passed to
* {@link #init(RollingSampleBuffer)} that will originate from this chunk. * {@link #init(DefaultTrackOutput)} that will originate from this chunk.
*/ */
public final int getFirstSampleIndex() { public final int getFirstSampleIndex() {
return firstSampleIndex; return firstSampleIndex;
...@@ -72,9 +72,9 @@ public abstract class BaseMediaChunk extends MediaChunk { ...@@ -72,9 +72,9 @@ public abstract class BaseMediaChunk extends MediaChunk {
public abstract DrmInitData getDrmInitData(); public abstract DrmInitData getDrmInitData();
/** /**
* Returns the track output most recently passed to {@link #init(RollingSampleBuffer)}. * Returns the track output most recently passed to {@link #init(DefaultTrackOutput)}.
*/ */
protected final RollingSampleBuffer getTrackOutput() { protected final DefaultTrackOutput getTrackOutput() {
return trackOutput; return trackOutput;
} }
......
...@@ -26,7 +26,7 @@ import com.google.android.exoplayer.TrackGroupArray; ...@@ -26,7 +26,7 @@ import com.google.android.exoplayer.TrackGroupArray;
import com.google.android.exoplayer.TrackSelection; import com.google.android.exoplayer.TrackSelection;
import com.google.android.exoplayer.TrackStream; import com.google.android.exoplayer.TrackStream;
import com.google.android.exoplayer.chunk.ChunkSampleSourceEventListener.EventDispatcher; import com.google.android.exoplayer.chunk.ChunkSampleSourceEventListener.EventDispatcher;
import com.google.android.exoplayer.extractor.RollingSampleBuffer; import com.google.android.exoplayer.extractor.DefaultTrackOutput;
import com.google.android.exoplayer.upstream.Loader; import com.google.android.exoplayer.upstream.Loader;
import com.google.android.exoplayer.upstream.Loader.Loadable; import com.google.android.exoplayer.upstream.Loader.Loadable;
import com.google.android.exoplayer.util.Assertions; import com.google.android.exoplayer.util.Assertions;
...@@ -56,7 +56,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call ...@@ -56,7 +56,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
private final ChunkHolder nextChunkHolder; private final ChunkHolder nextChunkHolder;
private final LinkedList<BaseMediaChunk> mediaChunks; private final LinkedList<BaseMediaChunk> mediaChunks;
private final List<BaseMediaChunk> readOnlyMediaChunks; private final List<BaseMediaChunk> readOnlyMediaChunks;
private final RollingSampleBuffer sampleQueue; private final DefaultTrackOutput sampleQueue;
private final int bufferSizeContribution; private final int bufferSizeContribution;
private final EventDispatcher eventDispatcher; private final EventDispatcher eventDispatcher;
...@@ -125,7 +125,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call ...@@ -125,7 +125,7 @@ public class ChunkSampleSource implements SampleSource, TrackStream, Loader.Call
nextChunkHolder = new ChunkHolder(); nextChunkHolder = new ChunkHolder();
mediaChunks = new LinkedList<>(); mediaChunks = new LinkedList<>();
readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks); readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);
sampleQueue = new RollingSampleBuffer(loadControl.getAllocator()); sampleQueue = new DefaultTrackOutput(loadControl.getAllocator());
pendingResetPositionUs = C.UNSET_TIME_US; pendingResetPositionUs = C.UNSET_TIME_US;
} }
......
...@@ -19,9 +19,9 @@ import com.google.android.exoplayer.Format; ...@@ -19,9 +19,9 @@ import com.google.android.exoplayer.Format;
import com.google.android.exoplayer.chunk.ChunkExtractorWrapper.SingleTrackMetadataOutput; import com.google.android.exoplayer.chunk.ChunkExtractorWrapper.SingleTrackMetadataOutput;
import com.google.android.exoplayer.drm.DrmInitData; import com.google.android.exoplayer.drm.DrmInitData;
import com.google.android.exoplayer.extractor.DefaultExtractorInput; import com.google.android.exoplayer.extractor.DefaultExtractorInput;
import com.google.android.exoplayer.extractor.DefaultTrackOutput;
import com.google.android.exoplayer.extractor.Extractor; import com.google.android.exoplayer.extractor.Extractor;
import com.google.android.exoplayer.extractor.ExtractorInput; import com.google.android.exoplayer.extractor.ExtractorInput;
import com.google.android.exoplayer.extractor.RollingSampleBuffer;
import com.google.android.exoplayer.extractor.SeekMap; import com.google.android.exoplayer.extractor.SeekMap;
import com.google.android.exoplayer.upstream.DataSource; import com.google.android.exoplayer.upstream.DataSource;
import com.google.android.exoplayer.upstream.DataSpec; import com.google.android.exoplayer.upstream.DataSpec;
...@@ -111,7 +111,7 @@ public class ContainerMediaChunk extends BaseMediaChunk implements SingleTrackMe ...@@ -111,7 +111,7 @@ public class ContainerMediaChunk extends BaseMediaChunk implements SingleTrackMe
loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec)); loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
if (bytesLoaded == 0) { if (bytesLoaded == 0) {
// Set the target to ourselves. // Set the target to ourselves.
RollingSampleBuffer trackOutput = getTrackOutput(); DefaultTrackOutput trackOutput = getTrackOutput();
trackOutput.formatWithOffset(sampleFormat, sampleOffsetUs); trackOutput.formatWithOffset(sampleFormat, sampleOffsetUs);
extractorWrapper.init(this, trackOutput); extractorWrapper.init(this, trackOutput);
} }
......
...@@ -19,8 +19,8 @@ import com.google.android.exoplayer.C; ...@@ -19,8 +19,8 @@ import com.google.android.exoplayer.C;
import com.google.android.exoplayer.Format; import com.google.android.exoplayer.Format;
import com.google.android.exoplayer.drm.DrmInitData; import com.google.android.exoplayer.drm.DrmInitData;
import com.google.android.exoplayer.extractor.DefaultExtractorInput; import com.google.android.exoplayer.extractor.DefaultExtractorInput;
import com.google.android.exoplayer.extractor.DefaultTrackOutput;
import com.google.android.exoplayer.extractor.ExtractorInput; import com.google.android.exoplayer.extractor.ExtractorInput;
import com.google.android.exoplayer.extractor.RollingSampleBuffer;
import com.google.android.exoplayer.upstream.DataSource; import com.google.android.exoplayer.upstream.DataSource;
import com.google.android.exoplayer.upstream.DataSpec; import com.google.android.exoplayer.upstream.DataSpec;
import com.google.android.exoplayer.util.Util; import com.google.android.exoplayer.util.Util;
...@@ -91,7 +91,7 @@ public final class SingleSampleMediaChunk extends BaseMediaChunk { ...@@ -91,7 +91,7 @@ public final class SingleSampleMediaChunk extends BaseMediaChunk {
length += bytesLoaded; length += bytesLoaded;
} }
ExtractorInput extractorInput = new DefaultExtractorInput(dataSource, bytesLoaded, length); ExtractorInput extractorInput = new DefaultExtractorInput(dataSource, bytesLoaded, length);
RollingSampleBuffer trackOutput = getTrackOutput(); DefaultTrackOutput trackOutput = getTrackOutput();
trackOutput.formatWithOffset(sampleFormat, 0); trackOutput.formatWithOffset(sampleFormat, 0);
// Load the sample data. // Load the sample data.
int result = 0; int result = 0;
......
...@@ -29,9 +29,10 @@ import java.nio.ByteBuffer; ...@@ -29,9 +29,10 @@ import java.nio.ByteBuffer;
import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingDeque;
/** /**
* A rolling buffer of sample data and corresponding sample information. * A {@link TrackOutput} that buffers extracted samples in a queue and allows for consumption from
* that queue.
*/ */
public final class RollingSampleBuffer implements TrackOutput { public final class DefaultTrackOutput implements TrackOutput {
private static final int INITIAL_SCRATCH_SIZE = 32; private static final int INITIAL_SCRATCH_SIZE = 32;
...@@ -60,7 +61,7 @@ public final class RollingSampleBuffer implements TrackOutput { ...@@ -60,7 +61,7 @@ public final class RollingSampleBuffer implements TrackOutput {
/** /**
* @param allocator An {@link Allocator} from which allocations for sample data can be obtained. * @param allocator An {@link Allocator} from which allocations for sample data can be obtained.
*/ */
public RollingSampleBuffer(Allocator allocator) { public DefaultTrackOutput(Allocator allocator) {
this.allocator = allocator; this.allocator = allocator;
allocationLength = allocator.getIndividualAllocationLength(); allocationLength = allocator.getIndividualAllocationLength();
infoQueue = new InfoQueue(); infoQueue = new InfoQueue();
......
...@@ -208,7 +208,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu ...@@ -208,7 +208,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
private boolean prepared; private boolean prepared;
private boolean seenFirstTrackSelection; private boolean seenFirstTrackSelection;
private int enabledTrackCount; private int enabledTrackCount;
private RollingSampleBuffer[] sampleQueues; private DefaultTrackOutput[] sampleQueues;
private TrackGroupArray tracks; private TrackGroupArray tracks;
private long durationUs; private long durationUs;
private boolean[] pendingMediaFormat; private boolean[] pendingMediaFormat;
...@@ -324,7 +324,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu ...@@ -324,7 +324,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
} }
extractorHolder = new ExtractorHolder(extractors, this); extractorHolder = new ExtractorHolder(extractors, this);
pendingResetPositionUs = C.UNSET_TIME_US; pendingResetPositionUs = C.UNSET_TIME_US;
sampleQueues = new RollingSampleBuffer[0]; sampleQueues = new DefaultTrackOutput[0];
} }
// SampleSource implementation. // SampleSource implementation.
...@@ -425,7 +425,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu ...@@ -425,7 +425,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
return pendingResetPositionUs; return pendingResetPositionUs;
} else { } else {
long largestQueuedTimestampUs = Long.MIN_VALUE; long largestQueuedTimestampUs = Long.MIN_VALUE;
for (RollingSampleBuffer sampleQueue : sampleQueues) { for (DefaultTrackOutput sampleQueue : sampleQueues) {
largestQueuedTimestampUs = Math.max(largestQueuedTimestampUs, largestQueuedTimestampUs = Math.max(largestQueuedTimestampUs,
sampleQueue.getLargestQueuedTimestampUs()); sampleQueue.getLargestQueuedTimestampUs());
} }
...@@ -473,7 +473,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu ...@@ -473,7 +473,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
return TrackStream.NOTHING_READ; return TrackStream.NOTHING_READ;
} }
RollingSampleBuffer sampleQueue = sampleQueues[track]; DefaultTrackOutput sampleQueue = sampleQueues[track];
if (pendingMediaFormat[track]) { if (pendingMediaFormat[track]) {
formatHolder.format = sampleQueue.getUpstreamFormat(); formatHolder.format = sampleQueue.getUpstreamFormat();
formatHolder.drmInitData = drmInitData; formatHolder.drmInitData = drmInitData;
...@@ -538,7 +538,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu ...@@ -538,7 +538,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
@Override @Override
public TrackOutput track(int id) { public TrackOutput track(int id) {
sampleQueues = Arrays.copyOf(sampleQueues, sampleQueues.length + 1); sampleQueues = Arrays.copyOf(sampleQueues, sampleQueues.length + 1);
RollingSampleBuffer sampleQueue = new RollingSampleBuffer(allocator); DefaultTrackOutput sampleQueue = new DefaultTrackOutput(allocator);
sampleQueues[sampleQueues.length - 1] = sampleQueue; sampleQueues[sampleQueues.length - 1] = sampleQueue;
return sampleQueue; return sampleQueue;
} }
...@@ -634,14 +634,14 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu ...@@ -634,14 +634,14 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
private int getExtractedSamplesCount() { private int getExtractedSamplesCount() {
int extractedSamplesCount = 0; int extractedSamplesCount = 0;
for (RollingSampleBuffer sampleQueue : sampleQueues) { for (DefaultTrackOutput sampleQueue : sampleQueues) {
extractedSamplesCount += sampleQueue.getWriteIndex(); extractedSamplesCount += sampleQueue.getWriteIndex();
} }
return extractedSamplesCount; return extractedSamplesCount;
} }
private boolean haveFormatsForAllTracks() { private boolean haveFormatsForAllTracks() {
for (RollingSampleBuffer sampleQueue : sampleQueues) { for (DefaultTrackOutput sampleQueue : sampleQueues) {
if (sampleQueue.getUpstreamFormat() == null) { if (sampleQueue.getUpstreamFormat() == null) {
return false; return false;
} }
...@@ -664,7 +664,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu ...@@ -664,7 +664,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
} }
private void clearSampleQueues() { private void clearSampleQueues() {
for (RollingSampleBuffer sampleQueue : sampleQueues) { for (DefaultTrackOutput sampleQueue : sampleQueues) {
sampleQueue.clear(); sampleQueue.clear();
} }
} }
......
...@@ -28,6 +28,11 @@ import com.google.android.exoplayer.extractor.mp3.Mp3Extractor; ...@@ -28,6 +28,11 @@ import com.google.android.exoplayer.extractor.mp3.Mp3Extractor;
import com.google.android.exoplayer.extractor.ts.AdtsExtractor; import com.google.android.exoplayer.extractor.ts.AdtsExtractor;
import com.google.android.exoplayer.extractor.ts.PtsTimestampAdjuster; import com.google.android.exoplayer.extractor.ts.PtsTimestampAdjuster;
import com.google.android.exoplayer.extractor.ts.TsExtractor; import com.google.android.exoplayer.extractor.ts.TsExtractor;
import com.google.android.exoplayer.hls.playlist.HlsMasterPlaylist;
import com.google.android.exoplayer.hls.playlist.HlsMediaPlaylist;
import com.google.android.exoplayer.hls.playlist.HlsPlaylist;
import com.google.android.exoplayer.hls.playlist.HlsPlaylistParser;
import com.google.android.exoplayer.hls.playlist.Variant;
import com.google.android.exoplayer.upstream.DataSource; import com.google.android.exoplayer.upstream.DataSource;
import com.google.android.exoplayer.upstream.DataSpec; import com.google.android.exoplayer.upstream.DataSpec;
import com.google.android.exoplayer.upstream.HttpDataSource.InvalidResponseCodeException; import com.google.android.exoplayer.upstream.HttpDataSource.InvalidResponseCodeException;
...@@ -325,7 +330,7 @@ public class HlsChunkSource { ...@@ -325,7 +330,7 @@ public class HlsChunkSource {
* should be interpreted as a seek position. * should be interpreted as a seek position.
* @param out A holder to populate. * @param out A holder to populate.
*/ */
public void getNextChunk(TsChunk previous, long playbackPositionUs, ChunkHolder out) { public void getNextChunk(HlsMediaChunk previous, long playbackPositionUs, ChunkHolder out) {
int variantIndex = getNextVariantIndex(previous, playbackPositionUs); int variantIndex = getNextVariantIndex(previous, playbackPositionUs);
boolean switchingVariant = previous != null boolean switchingVariant = previous != null
&& variants[variantIndex].format != previous.format; && variants[variantIndex].format != previous.format;
...@@ -450,7 +455,7 @@ public class HlsChunkSource { ...@@ -450,7 +455,7 @@ public class HlsChunkSource {
extractorNeedsInit = false; extractorNeedsInit = false;
} }
out.chunk = new TsChunk(dataSource, dataSpec, trigger, format, startTimeUs, endTimeUs, out.chunk = new HlsMediaChunk(dataSource, dataSpec, trigger, format, startTimeUs, endTimeUs,
chunkMediaSequence, segment.discontinuitySequenceNumber, extractor, extractorNeedsInit, chunkMediaSequence, segment.discontinuitySequenceNumber, extractor, extractorNeedsInit,
switchingVariant, encryptionKey, encryptionIv); switchingVariant, encryptionKey, encryptionIv);
} }
...@@ -576,7 +581,7 @@ public class HlsChunkSource { ...@@ -576,7 +581,7 @@ public class HlsChunkSource {
return false; return false;
} }
private int getNextVariantIndex(TsChunk previous, long playbackPositionUs) { private int getNextVariantIndex(HlsMediaChunk previous, long playbackPositionUs) {
clearStaleBlacklistedVariants(); clearStaleBlacklistedVariants();
if (enabledVariants.length > 1) { if (enabledVariants.length > 1) {
long bufferedDurationUs; long bufferedDurationUs;
......
...@@ -27,9 +27,9 @@ import com.google.android.exoplayer.util.Util; ...@@ -27,9 +27,9 @@ import com.google.android.exoplayer.util.Util;
import java.io.IOException; import java.io.IOException;
/** /**
* An MPEG2TS chunk. * An HLS {@link MediaChunk}.
*/ */
public final class TsChunk extends MediaChunk { /* package */ final class HlsMediaChunk extends MediaChunk {
/** /**
* The discontinuity sequence number of the chunk. * The discontinuity sequence number of the chunk.
...@@ -65,7 +65,7 @@ public final class TsChunk extends MediaChunk { ...@@ -65,7 +65,7 @@ public final class TsChunk extends MediaChunk {
* @param encryptionKey For AES encryption chunks, the encryption key. * @param encryptionKey For AES encryption chunks, the encryption key.
* @param encryptionIv For AES encryption chunks, the encryption initialization vector. * @param encryptionIv For AES encryption chunks, the encryption initialization vector.
*/ */
public TsChunk(DataSource dataSource, DataSpec dataSpec, int trigger, Format format, public HlsMediaChunk(DataSource dataSource, DataSpec dataSpec, int trigger, Format format,
long startTimeUs, long endTimeUs, int chunkIndex, int discontinuitySequenceNumber, long startTimeUs, long endTimeUs, int chunkIndex, int discontinuitySequenceNumber,
Extractor extractor, boolean extractorNeedsInit, boolean shouldSpliceIn, Extractor extractor, boolean extractorNeedsInit, boolean shouldSpliceIn,
byte[] encryptionKey, byte[] encryptionIv) { byte[] encryptionKey, byte[] encryptionIv) {
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls;
import com.google.android.exoplayer.drm.DrmInitData; import com.google.android.exoplayer.drm.DrmInitData;
import com.google.android.exoplayer.extractor.DefaultTrackOutput;
import com.google.android.exoplayer.extractor.ExtractorOutput; import com.google.android.exoplayer.extractor.ExtractorOutput;
import com.google.android.exoplayer.extractor.RollingSampleBuffer;
import com.google.android.exoplayer.extractor.SeekMap; import com.google.android.exoplayer.extractor.SeekMap;
import com.google.android.exoplayer.upstream.Allocator; import com.google.android.exoplayer.upstream.Allocator;
...@@ -29,10 +29,10 @@ import android.util.SparseArray; ...@@ -29,10 +29,10 @@ import android.util.SparseArray;
/* package */ final class HlsOutput implements ExtractorOutput { /* package */ final class HlsOutput implements ExtractorOutput {
private final Allocator allocator; private final Allocator allocator;
private final SparseArray<RollingSampleBuffer> sampleQueues = new SparseArray<>(); private final SparseArray<DefaultTrackOutput> sampleQueues = new SparseArray<>();
private boolean prepared; private boolean prepared;
private RollingSampleBuffer[] trackOutputArray; private DefaultTrackOutput[] trackOutputArray;
private volatile boolean tracksBuilt; private volatile boolean tracksBuilt;
public HlsOutput(Allocator allocator) { public HlsOutput(Allocator allocator) {
...@@ -53,12 +53,12 @@ import android.util.SparseArray; ...@@ -53,12 +53,12 @@ import android.util.SparseArray;
return false; return false;
} else { } else {
if (trackOutputArray == null) { if (trackOutputArray == null) {
trackOutputArray = new RollingSampleBuffer[sampleQueues.size()]; trackOutputArray = new DefaultTrackOutput[sampleQueues.size()];
for (int i = 0; i < trackOutputArray.length; i++) { for (int i = 0; i < trackOutputArray.length; i++) {
trackOutputArray[i] = sampleQueues.valueAt(i); trackOutputArray[i] = sampleQueues.valueAt(i);
} }
} }
for (RollingSampleBuffer sampleQueue : trackOutputArray) { for (DefaultTrackOutput sampleQueue : trackOutputArray) {
if (sampleQueue.getUpstreamFormat() == null) { if (sampleQueue.getUpstreamFormat() == null) {
return false; return false;
} }
...@@ -71,7 +71,7 @@ import android.util.SparseArray; ...@@ -71,7 +71,7 @@ import android.util.SparseArray;
/** /**
* Returns the array of track outputs, or null if the output is not yet prepared. * Returns the array of track outputs, or null if the output is not yet prepared.
*/ */
public RollingSampleBuffer[] getTrackOutputs() { public DefaultTrackOutput[] getTrackOutputs() {
return trackOutputArray; return trackOutputArray;
} }
...@@ -98,11 +98,11 @@ import android.util.SparseArray; ...@@ -98,11 +98,11 @@ import android.util.SparseArray;
// ExtractorOutput implementation. Called by the loading thread. // ExtractorOutput implementation. Called by the loading thread.
@Override @Override
public RollingSampleBuffer track(int id) { public DefaultTrackOutput track(int id) {
if (sampleQueues.indexOfKey(id) >= 0) { if (sampleQueues.indexOfKey(id) >= 0) {
return sampleQueues.get(id); return sampleQueues.get(id);
} }
RollingSampleBuffer trackOutput = new RollingSampleBuffer(allocator); DefaultTrackOutput trackOutput = new DefaultTrackOutput(allocator);
sampleQueues.put(id, trackOutput); sampleQueues.put(id, trackOutput);
return trackOutput; return trackOutput;
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
import com.google.android.exoplayer.Format; import com.google.android.exoplayer.Format;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
import com.google.android.exoplayer.C; import com.google.android.exoplayer.C;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
import com.google.android.exoplayer.ParserException; import com.google.android.exoplayer.ParserException;
......
...@@ -13,15 +13,15 @@ ...@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
/** /**
* Represents an HLS playlist. * Represents an HLS playlist.
*/ */
public abstract class HlsPlaylist { public abstract class HlsPlaylist {
public final static int TYPE_MASTER = 0; public static final int TYPE_MASTER = 0;
public final static int TYPE_MEDIA = 1; public static final int TYPE_MEDIA = 1;
public final String baseUri; public final String baseUri;
public final int type; public final int type;
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
import com.google.android.exoplayer.C; import com.google.android.exoplayer.C;
import com.google.android.exoplayer.Format; import com.google.android.exoplayer.Format;
import com.google.android.exoplayer.ParserException; import com.google.android.exoplayer.ParserException;
import com.google.android.exoplayer.hls.HlsMediaPlaylist.Segment; import com.google.android.exoplayer.hls.playlist.HlsMediaPlaylist.Segment;
import com.google.android.exoplayer.upstream.UriLoadable; import com.google.android.exoplayer.upstream.UriLoadable;
import com.google.android.exoplayer.util.MimeTypes; import com.google.android.exoplayer.util.MimeTypes;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.hls; package com.google.android.exoplayer.hls.playlist;
import com.google.android.exoplayer.Format; import com.google.android.exoplayer.Format;
......
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