Search in sources :

Example 16 with ParsableByteArray

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());
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray)

Example 17 with ParsableByteArray

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());
    }
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray) ParserException(com.google.android.exoplayer2.ParserException)

Example 18 with ParsableByteArray

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));
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray)

Example 19 with ParsableByteArray

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);
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray)

Example 20 with ParsableByteArray

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());
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray)

Aggregations

ParsableByteArray (com.google.android.exoplayer2.util.ParsableByteArray)48 ParserException (com.google.android.exoplayer2.ParserException)11 Format (com.google.android.exoplayer2.Format)6 ArrayList (java.util.ArrayList)4 SeekMap (com.google.android.exoplayer2.extractor.SeekMap)3 Metadata (com.google.android.exoplayer2.metadata.Metadata)3 TrackOutput (com.google.android.exoplayer2.extractor.TrackOutput)2 ContainerAtom (com.google.android.exoplayer2.extractor.mp4.Atom.ContainerAtom)2 FlacStreamInfo (com.google.android.exoplayer2.util.FlacStreamInfo)2 AvcConfig (com.google.android.exoplayer2.video.AvcConfig)2 ByteBuffer (java.nio.ByteBuffer)2 Matcher (java.util.regex.Matcher)2 Spanned (android.text.Spanned)1 ChunkIndex (com.google.android.exoplayer2.extractor.ChunkIndex)1 MpegAudioHeader (com.google.android.exoplayer2.extractor.MpegAudioHeader)1 LeafAtom (com.google.android.exoplayer2.extractor.mp4.Atom.LeafAtom)1 TrackIdGenerator (com.google.android.exoplayer2.extractor.ts.TsPayloadReader.TrackIdGenerator)1 CommentFrame (com.google.android.exoplayer2.metadata.id3.CommentFrame)1 TextInformationFrame (com.google.android.exoplayer2.metadata.id3.TextInformationFrame)1 FakeExtractorOutput (com.google.android.exoplayer2.testutil.FakeExtractorOutput)1