Search in sources :

Example 1 with ExtractorInput

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

the class DefaultEbmlReaderTest method testBinaryElement.

public void testBinaryElement() throws IOException, InterruptedException {
    ExtractorInput input = createTestInput(0xA3, 0x88, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08);
    TestOutput expected = new TestOutput();
    expected.binaryElement(TestOutput.ID_SIMPLE_BLOCK, 8, createTestInput(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08));
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Example 2 with ExtractorInput

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

the class DefaultEbmlReaderTest method testStringElement.

public void testStringElement() throws IOException, InterruptedException {
    ExtractorInput input = createTestInput(0x42, 0x82, 0x86, 0x41, 0x62, 0x63, 0x31, 0x32, 0x33);
    TestOutput expected = new TestOutput();
    expected.stringElement(TestOutput.ID_DOC_TYPE, "Abc123");
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Example 3 with ExtractorInput

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

the class DefaultEbmlReaderTest method testUnsignedIntegerElement.

public void testUnsignedIntegerElement() throws IOException, InterruptedException {
    // 0xFE is chosen because for signed integers it should be interpreted as -2
    ExtractorInput input = createTestInput(0x42, 0xF7, 0x81, 0xFE);
    TestOutput expected = new TestOutput();
    expected.integerElement(TestOutput.ID_EBML_READ_VERSION, 254);
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

Example 4 with ExtractorInput

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

the class DefaultEbmlReaderTest method testUnsignedIntegerElementLarge.

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

Example 5 with ExtractorInput

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

the class DefaultEbmlReaderTest method testStringElementEmpty.

public void testStringElementEmpty() throws IOException, InterruptedException {
    ExtractorInput input = createTestInput(0x42, 0x82, 0x80);
    TestOutput expected = new TestOutput();
    expected.stringElement(TestOutput.ID_DOC_TYPE, "");
    assertEvents(input, expected.events);
}
Also used : ExtractorInput(com.google.android.exoplayer2.extractor.ExtractorInput) FakeExtractorInput(com.google.android.exoplayer2.testutil.FakeExtractorInput)

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