use of com.google.android.exoplayer2.util.ParsableByteArray in project ExoPlayer by google.
the class VorbisUtilTest method testReadIdHeader.
public void testReadIdHeader() throws Exception {
byte[] data = TestData.getIdentificationHeaderData();
ParsableByteArray headerData = new ParsableByteArray(data, data.length);
VorbisUtil.VorbisIdHeader vorbisIdHeader = VorbisUtil.readVorbisIdentificationHeader(headerData);
assertEquals(22050, vorbisIdHeader.sampleRate);
assertEquals(0, vorbisIdHeader.version);
assertTrue(vorbisIdHeader.framingFlag);
assertEquals(2, vorbisIdHeader.channels);
assertEquals(512, vorbisIdHeader.blockSize0);
assertEquals(1024, vorbisIdHeader.blockSize1);
assertEquals(-1, vorbisIdHeader.bitrateMax);
assertEquals(-1, vorbisIdHeader.bitrateMin);
assertEquals(66666, vorbisIdHeader.bitrateNominal);
assertEquals(66666, vorbisIdHeader.getApproximateBitrate());
}
use of com.google.android.exoplayer2.util.ParsableByteArray in project ExoPlayer by google.
the class VorbisUtilTest method testVerifyVorbisHeaderCapturePatternInvalidHeader.
public void testVerifyVorbisHeaderCapturePatternInvalidHeader() {
ParsableByteArray header = new ParsableByteArray(new byte[] { 0x01, 'v', 'o', 'r', 'b', 'i', 's' });
try {
VorbisUtil.verifyVorbisHeaderCapturePattern(0x99, header, false);
fail();
} catch (ParserException e) {
assertEquals("expected header type 99", e.getMessage());
}
}
use of com.google.android.exoplayer2.util.ParsableByteArray in project ExoPlayer by google.
the class VorbisUtilTest method testVerifyVorbisHeaderCapturePattern.
public void testVerifyVorbisHeaderCapturePattern() throws ParserException {
ParsableByteArray header = new ParsableByteArray(new byte[] { 0x01, 'v', 'o', 'r', 'b', 'i', 's' });
assertEquals(true, VorbisUtil.verifyVorbisHeaderCapturePattern(0x01, header, false));
}
use of com.google.android.exoplayer2.util.ParsableByteArray in project ExoPlayer by google.
the class VorbisUtilTest method testReadVorbisModes.
public void testReadVorbisModes() throws ParserException {
byte[] data = TestData.getSetupHeaderData();
ParsableByteArray headerData = new ParsableByteArray(data, data.length);
VorbisUtil.Mode[] modes = VorbisUtil.readVorbisModes(headerData, 2);
assertEquals(2, modes.length);
assertEquals(false, modes[0].blockFlag);
assertEquals(0, modes[0].mapping);
assertEquals(0, modes[0].transformType);
assertEquals(0, modes[0].windowType);
assertEquals(true, modes[1].blockFlag);
assertEquals(1, modes[1].mapping);
assertEquals(0, modes[1].transformType);
assertEquals(0, modes[1].windowType);
}
use of com.google.android.exoplayer2.util.ParsableByteArray in project ExoPlayer by google.
the class CssParserTest method assertSkipsToEndOfSkip.
// Utility methods.
private void assertSkipsToEndOfSkip(String expectedLine, String s) {
ParsableByteArray input = new ParsableByteArray(Util.getUtf8Bytes(s));
CssParser.skipWhitespaceAndComments(input);
assertEquals(expectedLine, input.readLine());
}
Aggregations