package androidx.media3.extractor.ts; import androidx.media3.common.Format; import androidx.media3.common.util.Assertions; import androidx.media3.common.util.ParsableByteArray; import androidx.media3.extractor.CeaUtil; import androidx.media3.extractor.ExtractorOutput; import androidx.media3.extractor.TrackOutput; import androidx.media3.extractor.ts.TsPayloadReader; import java.util.List; /* loaded from: classes2.dex */ final class UserDataReader { private static final int USER_DATA_START_CODE = 434; private final List closedCaptionFormats; private final TrackOutput[] outputs; public UserDataReader(List list) { this.closedCaptionFormats = list; this.outputs = new TrackOutput[list.size()]; } public void createTracks(ExtractorOutput extractorOutput, TsPayloadReader.TrackIdGenerator trackIdGenerator) { for (int i = 0; i < this.outputs.length; i++) { trackIdGenerator.generateNewId(); TrackOutput track = extractorOutput.track(trackIdGenerator.getTrackId(), 3); Format format = this.closedCaptionFormats.get(i); String str = format.sampleMimeType; Assertions.checkArgument("application/cea-608".equals(str) || "application/cea-708".equals(str), "Invalid closed caption MIME type provided: " + str); track.format(new Format.Builder().setId(trackIdGenerator.getFormatId()).setSampleMimeType(str).setSelectionFlags(format.selectionFlags).setLanguage(format.language).setAccessibilityChannel(format.accessibilityChannel).setInitializationData(format.initializationData).build()); this.outputs[i] = track; } } public void consume(long j, ParsableByteArray parsableByteArray) { if (parsableByteArray.bytesLeft() < 9) { return; } int readInt = parsableByteArray.readInt(); int readInt2 = parsableByteArray.readInt(); int readUnsignedByte = parsableByteArray.readUnsignedByte(); if (readInt == USER_DATA_START_CODE && readInt2 == 1195456820 && readUnsignedByte == 3) { CeaUtil.consumeCcData(j, parsableByteArray, this.outputs); } } }