Make ParsableBitArray.data public, like ParsableByteArray.

This commit is contained in:
Oliver Woodman 2015-05-01 20:21:36 +01:00
parent 7ad55dbf2c
commit e6c7defc79
5 changed files with 6 additions and 15 deletions

View file

@ -53,7 +53,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
public Ac3Reader(TrackOutput output) { public Ac3Reader(TrackOutput output) {
super(output); super(output);
headerScratchBits = new ParsableBitArray(new byte[HEADER_SIZE]); headerScratchBits = new ParsableBitArray(new byte[HEADER_SIZE]);
headerScratchBytes = new ParsableByteArray(headerScratchBits.getData()); headerScratchBytes = new ParsableByteArray(headerScratchBits.data);
state = STATE_FINDING_SYNC; state = STATE_FINDING_SYNC;
} }

View file

@ -89,7 +89,7 @@ import java.util.Collections;
break; break;
case STATE_READING_HEADER: case STATE_READING_HEADER:
int targetLength = hasCrc ? HEADER_SIZE + CRC_SIZE : HEADER_SIZE; int targetLength = hasCrc ? HEADER_SIZE + CRC_SIZE : HEADER_SIZE;
if (continueRead(data, adtsScratch.getData(), targetLength)) { if (continueRead(data, adtsScratch.data, targetLength)) {
parseHeader(); parseHeader();
bytesRead = 0; bytesRead = 0;
state = STATE_READING_SAMPLE; state = STATE_READING_SAMPLE;

View file

@ -357,14 +357,14 @@ public final class TsExtractor implements Extractor {
data.skipBytes(data.bytesLeft()); data.skipBytes(data.bytesLeft());
break; break;
case STATE_READING_HEADER: case STATE_READING_HEADER:
if (continueRead(data, pesScratch.getData(), HEADER_SIZE)) { if (continueRead(data, pesScratch.data, HEADER_SIZE)) {
setState(parseHeader() ? STATE_READING_HEADER_EXTENSION : STATE_FINDING_HEADER); setState(parseHeader() ? STATE_READING_HEADER_EXTENSION : STATE_FINDING_HEADER);
} }
break; break;
case STATE_READING_HEADER_EXTENSION: case STATE_READING_HEADER_EXTENSION:
int readLength = Math.min(MAX_HEADER_EXTENSION_SIZE, extendedHeaderLength); int readLength = Math.min(MAX_HEADER_EXTENSION_SIZE, extendedHeaderLength);
// Read as much of the extended header as we're interested in, and skip the rest. // Read as much of the extended header as we're interested in, and skip the rest.
if (continueRead(data, pesScratch.getData(), readLength) if (continueRead(data, pesScratch.data, readLength)
&& continueRead(data, null, extendedHeaderLength)) { && continueRead(data, null, extendedHeaderLength)) {
parseHeaderExtension(); parseHeaderExtension();
bodyStarted = false; bodyStarted = false;

View file

@ -20,7 +20,7 @@ package com.google.android.exoplayer.util;
*/ */
public final class ParsableBitArray { public final class ParsableBitArray {
private byte[] data; public byte[] data;
// The offset within the data, stored as the current byte offset, and the bit offset within that // The offset within the data, stored as the current byte offset, and the bit offset within that
// byte (from 0 to 7). // byte (from 0 to 7).
@ -50,15 +50,6 @@ public final class ParsableBitArray {
bitOffset = 0; bitOffset = 0;
} }
/**
* Gets the backing byte array.
*
* @return The backing byte array.
*/
public byte[] getData() {
return data;
}
/** /**
* Gets the current bit offset. * Gets the current bit offset.
* *

View file

@ -135,7 +135,7 @@ public final class ParsableByteArray {
* @param length The number of bytes to write. * @param length The number of bytes to write.
*/ */
public void readBytes(ParsableBitArray bitArray, int length) { public void readBytes(ParsableBitArray bitArray, int length) {
readBytes(bitArray.getData(), 0, length); readBytes(bitArray.data, 0, length);
bitArray.setPosition(0); bitArray.setPosition(0);
} }