mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
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.
This commit is contained in:
parent
c19faa63cd
commit
b2fc944af1
@ -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.
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
* <p>
|
||||
* 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user