From b2fc944af14c6d87e6eeb48ef5dc8e4bf6906ee7 Mon Sep 17 00:00:00 2001 From: Oliver Woodman Date: Fri, 19 Sep 2014 18:26:04 +0100 Subject: [PATCH] Remove getLoadedData API from ExoPlayer components. This API wasn't particularly nice. Best to remove it whilst hopefully no-one is using it. Leaving the ReadHead abstraction in place, since it might well prove useful in the future. --- .../google/android/exoplayer/chunk/Chunk.java | 12 ----------- .../chunk/SingleSampleMediaChunk.java | 6 ++---- .../exoplayer/upstream/DataSourceStream.java | 20 ------------------- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer/chunk/Chunk.java b/library/src/main/java/com/google/android/exoplayer/chunk/Chunk.java index 6724e283fb..8a9471c113 100644 --- a/library/src/main/java/com/google/android/exoplayer/chunk/Chunk.java +++ b/library/src/main/java/com/google/android/exoplayer/chunk/Chunk.java @@ -134,18 +134,6 @@ public abstract class Chunk implements Loadable { consumeStream(dataSourceStream); } - /** - * Returns a byte array containing the loaded data. If the chunk is partially loaded, this - * method returns the data that has been loaded so far. If nothing has been loaded, null is - * returned. - * - * @return The loaded data or null. - */ - public final byte[] getLoadedData() { - Assertions.checkState(dataSourceStream != null); - return dataSourceStream.getLoadedData(); - } - /** * Invoked by {@link #consume()}. Implementations may override this method if they wish to * consume the loaded data at this point. diff --git a/library/src/main/java/com/google/android/exoplayer/chunk/SingleSampleMediaChunk.java b/library/src/main/java/com/google/android/exoplayer/chunk/SingleSampleMediaChunk.java index dfe0d71584..e0b9f91ad0 100644 --- a/library/src/main/java/com/google/android/exoplayer/chunk/SingleSampleMediaChunk.java +++ b/library/src/main/java/com/google/android/exoplayer/chunk/SingleSampleMediaChunk.java @@ -64,10 +64,8 @@ public class SingleSampleMediaChunk extends MediaChunk { * @param nextChunkIndex The index of the next chunk, or -1 if this is the last chunk. * @param sampleFormat The format of the media contained by the chunk. * @param headerData Custom header data for the sample. May be null. If set, the header data is - * prepended to the sample data returned when {@link #read(SampleHolder)} is called. It is - * however not considered part of the loaded data, and so is not prepended to the data - * returned by {@link #getLoadedData()}. It is also not reflected in the values returned by - * {@link #bytesLoaded()} and {@link #getLength()}. + * prepended to the sample data returned when {@link #read(SampleHolder)} is called. It is not + * reflected in the values returned by {@link #bytesLoaded()} and {@link #getLength()}. */ public SingleSampleMediaChunk(DataSource dataSource, DataSpec dataSpec, Format format, int trigger, long startTimeUs, long endTimeUs, int nextChunkIndex, MediaFormat sampleFormat, diff --git a/library/src/main/java/com/google/android/exoplayer/upstream/DataSourceStream.java b/library/src/main/java/com/google/android/exoplayer/upstream/DataSourceStream.java index dc5227e426..5c4dcd65b2 100644 --- a/library/src/main/java/com/google/android/exoplayer/upstream/DataSourceStream.java +++ b/library/src/main/java/com/google/android/exoplayer/upstream/DataSourceStream.java @@ -119,26 +119,6 @@ public final class DataSourceStream implements Loadable, NonBlockingInputStream return resolvedLength != C.LENGTH_UNBOUNDED && loadPosition == resolvedLength; } - /** - * Returns a byte array containing the loaded data. If the data is partially loaded, this method - * returns the portion of the data that has been loaded so far. If nothing has been loaded, null - * is returned. This method does not use or update the current read position. - *

- * Note: The read methods provide a more efficient way of consuming the loaded data. Use this - * method only when a freshly allocated byte[] containing all of the loaded data is required. - * - * @return The loaded data, or null. - */ - public final byte[] getLoadedData() { - if (loadPosition == 0) { - return null; - } - - byte[] rawData = new byte[(int) loadPosition]; - read(null, rawData, 0, new ReadHead(), rawData.length); - return rawData; - } - // {@link NonBlockingInputStream} implementation. @Override