Search in sources :

Example 76 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 77 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 78 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 79 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 80 with ExtractorInput

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

the class VarintReaderTest method testReadVarintEndOfInputAtStart.

public void testReadVarintEndOfInputAtStart() throws IOException, InterruptedException {
    VarintReader reader = new VarintReader();
    // Build an input with no data.
    ExtractorInput input = new FakeExtractorInput.Builder().setSimulateUnknownLength(true).build();
    // End of input allowed.
    long result = reader.readUnsignedVarint(input, true, false, 8);
    assertEquals(C.RESULT_END_OF_INPUT, result);
    // End of input not allowed.
    try {
        reader.readUnsignedVarint(input, false, false, 8);
        fail();
    } catch (EOFException e) {
    // Expected.
    }
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput) EOFException(java.io.EOFException)

Aggregations

FakeExtractorInput (com.google.android.exoplayer2.testutil.FakeExtractorInput)85 Test (org.junit.Test)71 ExtractorInput (com.google.android.exoplayer2.extractor.ExtractorInput)53 ParsableByteArray (com.google.android.exoplayer2.util.ParsableByteArray)39 FlacStreamMetadataHolder (com.google.android.exoplayer2.extractor.FlacMetadataReader.FlacStreamMetadataHolder)20 DataSpec (com.google.android.exoplayer2.upstream.DataSpec)17 DefaultExtractorInput (com.google.android.exoplayer2.extractor.DefaultExtractorInput)16 Nullable (androidx.annotation.Nullable)15 Metadata (com.google.android.exoplayer2.metadata.Metadata)13 SampleNumberHolder (com.google.android.exoplayer2.extractor.FlacFrameReader.SampleNumberHolder)9 FakeDataSource (com.google.android.exoplayer2.testutil.FakeDataSource)9 EOFException (java.io.EOFException)8 SeekPoint (com.google.android.exoplayer2.extractor.SeekPoint)7 RequiresNonNull (org.checkerframework.checker.nullness.qual.RequiresNonNull)7 ParserException (com.google.android.exoplayer2.ParserException)5 SeekMap (com.google.android.exoplayer2.extractor.SeekMap)5 TrackOutput (com.google.android.exoplayer2.extractor.TrackOutput)5 IOException (java.io.IOException)5 PositionHolder (com.google.android.exoplayer2.extractor.PositionHolder)3 Id3Decoder (com.google.android.exoplayer2.metadata.id3.Id3Decoder)3