mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
69 lines
3 KiB
Java
69 lines
3 KiB
Java
package androidx.media3.exoplayer.source.chunk;
|
|
|
|
import androidx.media3.common.Format;
|
|
import androidx.media3.datasource.DataSource;
|
|
import androidx.media3.datasource.DataSourceUtil;
|
|
import androidx.media3.datasource.DataSpec;
|
|
import androidx.media3.exoplayer.source.chunk.ChunkExtractor;
|
|
import androidx.media3.extractor.DefaultExtractorInput;
|
|
import java.io.IOException;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ContainerMediaChunk extends BaseMediaChunk {
|
|
private final int chunkCount;
|
|
private final ChunkExtractor chunkExtractor;
|
|
private volatile boolean loadCanceled;
|
|
private boolean loadCompleted;
|
|
private long nextLoadPosition;
|
|
private final long sampleOffsetUs;
|
|
|
|
@Override // androidx.media3.exoplayer.upstream.Loader.Loadable
|
|
public final void cancelLoad() {
|
|
this.loadCanceled = true;
|
|
}
|
|
|
|
protected ChunkExtractor.TrackOutputProvider getTrackOutputProvider(BaseMediaChunkOutput baseMediaChunkOutput) {
|
|
return baseMediaChunkOutput;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.source.chunk.MediaChunk
|
|
public boolean isLoadCompleted() {
|
|
return this.loadCompleted;
|
|
}
|
|
|
|
public ContainerMediaChunk(DataSource dataSource, DataSpec dataSpec, Format format, int i, Object obj, long j, long j2, long j3, long j4, long j5, int i2, long j6, ChunkExtractor chunkExtractor) {
|
|
super(dataSource, dataSpec, format, i, obj, j, j2, j3, j4, j5);
|
|
this.chunkCount = i2;
|
|
this.sampleOffsetUs = j6;
|
|
this.chunkExtractor = chunkExtractor;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.source.chunk.MediaChunk
|
|
public long getNextChunkIndex() {
|
|
return this.chunkIndex + this.chunkCount;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.upstream.Loader.Loadable
|
|
public final void load() throws IOException {
|
|
if (this.nextLoadPosition == 0) {
|
|
BaseMediaChunkOutput output = getOutput();
|
|
output.setSampleOffsetUs(this.sampleOffsetUs);
|
|
this.chunkExtractor.init(getTrackOutputProvider(output), this.clippedStartTimeUs == -9223372036854775807L ? -9223372036854775807L : this.clippedStartTimeUs - this.sampleOffsetUs, this.clippedEndTimeUs != -9223372036854775807L ? this.clippedEndTimeUs - this.sampleOffsetUs : -9223372036854775807L);
|
|
}
|
|
try {
|
|
DataSpec subrange = this.dataSpec.subrange(this.nextLoadPosition);
|
|
DefaultExtractorInput defaultExtractorInput = new DefaultExtractorInput(this.dataSource, subrange.position, this.dataSource.open(subrange));
|
|
while (!this.loadCanceled && this.chunkExtractor.read(defaultExtractorInput)) {
|
|
try {
|
|
} finally {
|
|
this.nextLoadPosition = defaultExtractorInput.getPosition() - this.dataSpec.position;
|
|
}
|
|
}
|
|
DataSourceUtil.closeQuietly(this.dataSource);
|
|
this.loadCompleted = !this.loadCanceled;
|
|
} catch (Throwable th) {
|
|
DataSourceUtil.closeQuietly(this.dataSource);
|
|
throw th;
|
|
}
|
|
}
|
|
}
|