mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 09:32:27 -06:00
60 lines
2 KiB
Java
60 lines
2 KiB
Java
|
package androidx.media3.extractor;
|
||
|
|
||
|
import androidx.media3.common.util.Assertions;
|
||
|
import androidx.media3.extractor.TrackOutput;
|
||
|
import java.io.IOException;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class TrueHdSampleRechunker {
|
||
|
private int chunkFlags;
|
||
|
private int chunkOffset;
|
||
|
private int chunkSampleCount;
|
||
|
private int chunkSize;
|
||
|
private long chunkTimeUs;
|
||
|
private boolean foundSyncframe;
|
||
|
private final byte[] syncframePrefix = new byte[10];
|
||
|
|
||
|
public void reset() {
|
||
|
this.foundSyncframe = false;
|
||
|
this.chunkSampleCount = 0;
|
||
|
}
|
||
|
|
||
|
public void startSample(ExtractorInput extractorInput) throws IOException {
|
||
|
if (this.foundSyncframe) {
|
||
|
return;
|
||
|
}
|
||
|
extractorInput.peekFully(this.syncframePrefix, 0, 10);
|
||
|
extractorInput.resetPeekPosition();
|
||
|
if (Ac3Util.parseTrueHdSyncframeAudioSampleCount(this.syncframePrefix) == 0) {
|
||
|
return;
|
||
|
}
|
||
|
this.foundSyncframe = true;
|
||
|
}
|
||
|
|
||
|
public void sampleMetadata(TrackOutput trackOutput, long j, int i, int i2, int i3, TrackOutput.CryptoData cryptoData) {
|
||
|
Assertions.checkState(this.chunkOffset <= i2 + i3, "TrueHD chunk samples must be contiguous in the sample queue.");
|
||
|
if (this.foundSyncframe) {
|
||
|
int i4 = this.chunkSampleCount;
|
||
|
int i5 = i4 + 1;
|
||
|
this.chunkSampleCount = i5;
|
||
|
if (i4 == 0) {
|
||
|
this.chunkTimeUs = j;
|
||
|
this.chunkFlags = i;
|
||
|
this.chunkSize = 0;
|
||
|
}
|
||
|
this.chunkSize += i2;
|
||
|
this.chunkOffset = i3;
|
||
|
if (i5 >= 16) {
|
||
|
outputPendingSampleMetadata(trackOutput, cryptoData);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void outputPendingSampleMetadata(TrackOutput trackOutput, TrackOutput.CryptoData cryptoData) {
|
||
|
if (this.chunkSampleCount > 0) {
|
||
|
trackOutput.sampleMetadata(this.chunkTimeUs, this.chunkFlags, this.chunkSize, this.chunkOffset, cryptoData);
|
||
|
this.chunkSampleCount = 0;
|
||
|
}
|
||
|
}
|
||
|
}
|