Search in sources :

Example 31 with ExtractorInput

use of com.google.android.exoplayer2.extractor.ExtractorInput in project ExoPlayer by google.

the class DefaultEbmlReaderTest method testFloatElementEightBytes.

public void testFloatElementEightBytes() throws IOException, InterruptedException {
    ExtractorInput input = createTestInput(0x44, 0x89, 0x88, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
    TestOutput expected = new TestOutput();
    expected.floatElement(TestOutput.ID_DURATION, -2.0);
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Example 32 with ExtractorInput

use of com.google.android.exoplayer2.extractor.ExtractorInput in project ExoPlayer by google.

the class DefaultEbmlReaderTest method testMasterElement.

public void testMasterElement() throws IOException, InterruptedException {
    ExtractorInput input = createTestInput(0x1A, 0x45, 0xDF, 0xA3, 0x84, 0x42, 0x85, 0x81, 0x01);
    TestOutput expected = new TestOutput();
    expected.startMasterElement(TestOutput.ID_EBML, 5, 4);
    expected.integerElement(TestOutput.ID_DOC_TYPE_READ_VERSION, 1);
    expected.endMasterElement(TestOutput.ID_EBML);
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Example 33 with ExtractorInput

use of com.google.android.exoplayer2.extractor.ExtractorInput in project ExoPlayer by google.

the class DefaultEbmlReaderTest method testUnsignedIntegerElementTooLargeBecomesNegative.

public void testUnsignedIntegerElementTooLargeBecomesNegative() throws IOException, InterruptedException {
    ExtractorInput input = createTestInput(0x42, 0xF7, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
    TestOutput expected = new TestOutput();
    expected.integerElement(TestOutput.ID_EBML_READ_VERSION, -1);
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Example 34 with ExtractorInput

use of com.google.android.exoplayer2.extractor.ExtractorInput in project ExoPlayer by google.

the class DefaultEbmlReaderTest method testFloatElementFourBytes.

public void testFloatElementFourBytes() throws IOException, InterruptedException {
    ExtractorInput input = createTestInput(0x44, 0x89, 0x84, 0x3F, 0x80, 0x00, 0x00);
    TestOutput expected = new TestOutput();
    expected.floatElement(TestOutput.ID_DURATION, 1.0);
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Example 35 with ExtractorInput

use of com.google.android.exoplayer2.extractor.ExtractorInput in project ExoPlayer by google.

the class VarintReaderTest method testReadVarint.

private static void testReadVarint(VarintReader reader, boolean removeMask, byte[] data, int expectedLength, long expectedValue) throws IOException, InterruptedException {
    ExtractorInput input = new FakeExtractorInput.Builder().setData(data).setSimulateUnknownLength(true).build();
    long result = reader.readUnsignedVarint(input, false, removeMask, 8);
    assertEquals(expectedLength, input.getPosition());
    assertEquals(expectedValue, result);
}
Also used : FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput) ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Aggregations

ExtractorInput (com.google.android.exoplayer2.extractor.ExtractorInput)20 FakeExtractorInput (com.google.android.exoplayer2.testutil.FakeExtractorInput)19 ParsableByteArray (com.google.android.exoplayer2.util.ParsableByteArray)12 ParserException (com.google.android.exoplayer2.ParserException)8 DefaultExtractorInput (com.google.android.exoplayer2.extractor.DefaultExtractorInput)5 DataSpec (com.google.android.exoplayer2.upstream.DataSpec)5 TrackOutput (com.google.android.exoplayer2.extractor.TrackOutput)4 SeekMap (com.google.android.exoplayer2.extractor.SeekMap)3 Format (com.google.android.exoplayer2.Format)2 Extractor (com.google.android.exoplayer2.extractor.Extractor)2 ContainerAtom (com.google.android.exoplayer2.extractor.mp4.Atom.ContainerAtom)2 EOFException (java.io.EOFException)2 LeafAtom (com.google.android.exoplayer2.extractor.mp4.Atom.LeafAtom)1 VorbisSetup (com.google.android.exoplayer2.extractor.ogg.VorbisReader.VorbisSetup)1 TrackIdGenerator (com.google.android.exoplayer2.extractor.ts.TsPayloadReader.TrackIdGenerator)1 Metadata (com.google.android.exoplayer2.metadata.Metadata)1 PrivFrame (com.google.android.exoplayer2.metadata.id3.PrivFrame)1 SimulatedIOException (com.google.android.exoplayer2.testutil.FakeExtractorInput.SimulatedIOException)1 FlacStreamInfo (com.google.android.exoplayer2.util.FlacStreamInfo)1 ParsableBitArray (com.google.android.exoplayer2.util.ParsableBitArray)1