Merge "Replace data source with data reader" into rvc-dev am: edaedb06ee
Change-Id: I0f78f7bc83163f229bcf7d0c91b939b4094a6d46
This commit is contained in:
@@ -21,7 +21,6 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.StringDef;
|
||||
import android.media.MediaCodec.CryptoInfo;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
import android.util.SparseArray;
|
||||
@@ -52,9 +51,6 @@ import com.google.android.exoplayer2.extractor.ts.PsExtractor;
|
||||
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
|
||||
import com.google.android.exoplayer2.extractor.wav.WavExtractor;
|
||||
import com.google.android.exoplayer2.upstream.DataReader;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||
import com.google.android.exoplayer2.upstream.TransferListener;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.ColorInfo;
|
||||
@@ -847,7 +843,7 @@ public final class MediaParser {
|
||||
private final OutputConsumer mOutputConsumer;
|
||||
private final String[] mParserNamesPool;
|
||||
private final PositionHolder mPositionHolder;
|
||||
private final InputReadingDataSource mDataSource;
|
||||
private final InputReadingDataReader mExoDataReader;
|
||||
private final DataReaderAdapter mScratchDataReaderAdapter;
|
||||
private final ParsableByteArrayAdapter mScratchParsableByteArrayAdapter;
|
||||
private String mParserName;
|
||||
@@ -950,11 +946,11 @@ public final class MediaParser {
|
||||
// clearBuffers() method, or similar.
|
||||
mExtractorInput =
|
||||
new DefaultExtractorInput(
|
||||
mDataSource,
|
||||
mExoDataReader,
|
||||
seekableInputReader.getPosition(),
|
||||
seekableInputReader.getLength());
|
||||
}
|
||||
mDataSource.mInputReader = seekableInputReader;
|
||||
mExoDataReader.mInputReader = seekableInputReader;
|
||||
|
||||
// TODO: Apply parameters when creating extractor instances.
|
||||
if (mExtractor == null) {
|
||||
@@ -1046,7 +1042,7 @@ public final class MediaParser {
|
||||
mParserNamesPool = parserNamesPool;
|
||||
mParserName = sniff ? PARSER_NAME_UNKNOWN : parserNamesPool[0];
|
||||
mPositionHolder = new PositionHolder();
|
||||
mDataSource = new InputReadingDataSource();
|
||||
mExoDataReader = new InputReadingDataReader();
|
||||
removePendingSeek();
|
||||
mScratchDataReaderAdapter = new DataReaderAdapter();
|
||||
mScratchParsableByteArrayAdapter = new ParsableByteArrayAdapter();
|
||||
@@ -1181,39 +1177,14 @@ public final class MediaParser {
|
||||
|
||||
// Private classes.
|
||||
|
||||
private static final class InputReadingDataSource implements DataSource {
|
||||
private static final class InputReadingDataReader implements DataReader {
|
||||
|
||||
public InputReader mInputReader;
|
||||
|
||||
@Override
|
||||
public void addTransferListener(TransferListener transferListener) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
return mInputReader.read(buffer, offset, readLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri getUri() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getResponseHeaders() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
private final class ExtractorOutputAdapter implements ExtractorOutput {
|
||||
|
||||
Reference in New Issue
Block a user