use of androidx.media3.extractor.ExtractorOutput in project media by androidx.
the class Ac4Extractor method init.
@Override
public void init(ExtractorOutput output) {
reader.createTracks(output, new TrackIdGenerator(/* firstTrackId= */
0, /* trackIdIncrement= */
1));
output.endTracks();
output.seekMap(new SeekMap.Unseekable(/* durationUs= */
C.TIME_UNSET));
}
use of androidx.media3.extractor.ExtractorOutput in project media by androidx.
the class AdtsExtractor method init.
@Override
public void init(ExtractorOutput output) {
this.extractorOutput = output;
reader.createTracks(output, new TrackIdGenerator(0, 1));
output.endTracks();
}
use of androidx.media3.extractor.ExtractorOutput in project media by androidx.
the class AdtsReader method createTracks.
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
idGenerator.generateNewId();
formatId = idGenerator.getFormatId();
output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
currentOutput = output;
if (exposeId3) {
idGenerator.generateNewId();
id3Output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_METADATA);
id3Output.format(new Format.Builder().setId(idGenerator.getFormatId()).setSampleMimeType(MimeTypes.APPLICATION_ID3).build());
} else {
id3Output = new DummyTrackOutput();
}
}
use of androidx.media3.extractor.ExtractorOutput in project media by androidx.
the class SubtitleExtractor method init.
@Override
public void init(ExtractorOutput output) {
checkState(state == STATE_CREATED);
extractorOutput = output;
trackOutput = extractorOutput.track(/* id= */
0, C.TRACK_TYPE_TEXT);
extractorOutput.endTracks();
extractorOutput.seekMap(new IndexSeekMap(/* positions= */
new long[] { 0 }, /* timesUs= */
new long[] { 0 }, /* durationUs= */
C.TIME_UNSET));
trackOutput.format(format);
state = STATE_INITIALIZED;
}
use of androidx.media3.extractor.ExtractorOutput in project media by androidx.
the class AmrExtractorSeekTest method seeking_handlesSeekingForward_extractsCorrectFrames_forNarrowBandAmr.
@Test
public void seeking_handlesSeekingForward_extractsCorrectFrames_forNarrowBandAmr() throws IOException {
String fileName = NARROW_BAND_AMR_FILE;
Uri fileUri = TestUtil.buildAssetUri(fileName);
expectedTrackOutput = TestUtil.extractAllSamplesFromFile(createAmrExtractor(), ApplicationProvider.getApplicationContext(), fileName).trackOutputs.get(0);
AmrExtractor extractor = createAmrExtractor();
FakeExtractorOutput extractorOutput = new FakeExtractorOutput();
SeekMap seekMap = TestUtil.extractSeekMap(extractor, extractorOutput, dataSource, fileUri);
FakeTrackOutput trackOutput = extractorOutput.trackOutputs.get(0);
long firstSeekTimeUs = 980_000;
TestUtil.seekToTimeUs(extractor, seekMap, firstSeekTimeUs, dataSource, trackOutput, fileUri);
long targetSeekTimeUs = 1_200_000;
int extractedFrameIndex = TestUtil.seekToTimeUs(extractor, seekMap, targetSeekTimeUs, dataSource, trackOutput, fileUri);
assertThat(extractedFrameIndex).isNotEqualTo(-1);
assertFirstFrameAfterSeekContainTargetSeekTime(trackOutput, targetSeekTimeUs, extractedFrameIndex);
}
Aggregations