Search in sources :

Example 56 with PositionHolder

use of androidx.media3.extractor.PositionHolder in project media by androidx.

the class TsDurationReaderTest method setUp.

@Before
public void setUp() {
    tsDurationReader = new TsDurationReader(TsExtractor.DEFAULT_TIMESTAMP_SEARCH_BYTES);
    seekPositionHolder = new PositionHolder();
}
Also used : PositionHolder(androidx.media3.extractor.PositionHolder) Before(org.junit.Before)

Example 57 with PositionHolder

use of androidx.media3.extractor.PositionHolder in project media by androidx.

the class TsExtractorSeekTest method readInputFileOnce.

// Internal methods
private void readInputFileOnce(TsExtractor extractor, FakeExtractorOutput extractorOutput, Uri fileUri) throws IOException {
    extractor.init(extractorOutput);
    int readResult = Extractor.RESULT_CONTINUE;
    ExtractorInput input = TestUtil.getExtractorInputFromPosition(dataSource, 0, fileUri);
    while (readResult != Extractor.RESULT_END_OF_INPUT) {
        try {
            while (readResult == Extractor.RESULT_CONTINUE) {
                readResult = extractor.read(input, positionHolder);
            }
        } finally {
            DataSourceUtil.closeQuietly(dataSource);
        }
        if (readResult == Extractor.RESULT_SEEK) {
            input = TestUtil.getExtractorInputFromPosition(dataSource, positionHolder.position, fileUri);
            readResult = Extractor.RESULT_CONTINUE;
        }
    }
}
Also used : ExtractorInput(androidx.media3.extractor.ExtractorInput)

Aggregations

PositionHolder (com.google.android.exoplayer2.extractor.PositionHolder)22 Test (org.junit.Test)22 PositionHolder (androidx.media3.extractor.PositionHolder)19 FakeExtractorInput (androidx.media3.test.utils.FakeExtractorInput)14 FakeExtractorInput (com.google.android.exoplayer2.testutil.FakeExtractorInput)12 Before (org.junit.Before)8 ExtractorInput (androidx.media3.extractor.ExtractorInput)7 DefaultExtractorInput (androidx.media3.extractor.DefaultExtractorInput)6 FakeExtractorOutput (com.google.android.exoplayer2.testutil.FakeExtractorOutput)6 IOException (java.io.IOException)6 Nullable (androidx.annotation.Nullable)5 ParserException (androidx.media3.common.ParserException)5 ParserException (com.google.android.exoplayer2.ParserException)5 ParsableByteArray (androidx.media3.common.util.ParsableByteArray)4 FakeExtractorOutput (androidx.media3.test.utils.FakeExtractorOutput)4 TimestampAdjuster (com.google.android.exoplayer2.util.TimestampAdjuster)4 SeekMap (androidx.media3.extractor.SeekMap)3 SeekPoint (androidx.media3.extractor.SeekPoint)3 TrackOutput (androidx.media3.extractor.TrackOutput)3 DefaultExtractorInput (com.google.android.exoplayer2.extractor.DefaultExtractorInput)3