use of androidx.media3.extractor.ts.Ac4Extractor in project media by androidx.
the class DefaultExtractorsFactory method addExtractorsForFileType.
private void addExtractorsForFileType(@FileTypes.Type int fileType, List<Extractor> extractors) {
switch(fileType) {
case FileTypes.AC3:
extractors.add(new Ac3Extractor());
break;
case FileTypes.AC4:
extractors.add(new Ac4Extractor());
break;
case FileTypes.ADTS:
extractors.add(new AdtsExtractor(adtsFlags | (constantBitrateSeekingEnabled ? AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0) | (constantBitrateSeekingAlwaysEnabled ? AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS : 0)));
break;
case FileTypes.AMR:
extractors.add(new AmrExtractor(amrFlags | (constantBitrateSeekingEnabled ? AmrExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0) | (constantBitrateSeekingAlwaysEnabled ? AmrExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS : 0)));
break;
case FileTypes.FLAC:
@Nullable Extractor flacExtractor = FLAC_EXTENSION_LOADER.getExtractor(flacFlags);
if (flacExtractor != null) {
extractors.add(flacExtractor);
} else {
extractors.add(new FlacExtractor(flacFlags));
}
break;
case FileTypes.FLV:
extractors.add(new FlvExtractor());
break;
case FileTypes.MATROSKA:
extractors.add(new MatroskaExtractor(matroskaFlags));
break;
case FileTypes.MP3:
extractors.add(new Mp3Extractor(mp3Flags | (constantBitrateSeekingEnabled ? Mp3Extractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0) | (constantBitrateSeekingAlwaysEnabled ? Mp3Extractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS : 0)));
break;
case FileTypes.MP4:
extractors.add(new FragmentedMp4Extractor(fragmentedMp4Flags));
extractors.add(new Mp4Extractor(mp4Flags));
break;
case FileTypes.OGG:
extractors.add(new OggExtractor());
break;
case FileTypes.PS:
extractors.add(new PsExtractor());
break;
case FileTypes.TS:
extractors.add(new TsExtractor(tsMode, tsFlags, tsTimestampSearchBytes));
break;
case FileTypes.WAV:
extractors.add(new WavExtractor());
break;
case FileTypes.JPEG:
extractors.add(new JpegExtractor());
break;
case FileTypes.WEBVTT:
case FileTypes.UNKNOWN:
default:
break;
}
}
use of androidx.media3.extractor.ts.Ac4Extractor in project ExoPlayer by google.
the class DefaultExtractorsFactory method addExtractorsForFileType.
private void addExtractorsForFileType(@FileTypes.Type int fileType, List<Extractor> extractors) {
switch(fileType) {
case FileTypes.AC3:
extractors.add(new Ac3Extractor());
break;
case FileTypes.AC4:
extractors.add(new Ac4Extractor());
break;
case FileTypes.ADTS:
extractors.add(new AdtsExtractor(adtsFlags | (constantBitrateSeekingEnabled ? AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0) | (constantBitrateSeekingAlwaysEnabled ? AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS : 0)));
break;
case FileTypes.AMR:
extractors.add(new AmrExtractor(amrFlags | (constantBitrateSeekingEnabled ? AmrExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0) | (constantBitrateSeekingAlwaysEnabled ? AmrExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS : 0)));
break;
case FileTypes.FLAC:
@Nullable Extractor flacExtractor = FLAC_EXTENSION_LOADER.getExtractor(flacFlags);
if (flacExtractor != null) {
extractors.add(flacExtractor);
} else {
extractors.add(new FlacExtractor(flacFlags));
}
break;
case FileTypes.FLV:
extractors.add(new FlvExtractor());
break;
case FileTypes.MATROSKA:
extractors.add(new MatroskaExtractor(matroskaFlags));
break;
case FileTypes.MP3:
extractors.add(new Mp3Extractor(mp3Flags | (constantBitrateSeekingEnabled ? Mp3Extractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0) | (constantBitrateSeekingAlwaysEnabled ? Mp3Extractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS : 0)));
break;
case FileTypes.MP4:
extractors.add(new FragmentedMp4Extractor(fragmentedMp4Flags));
extractors.add(new Mp4Extractor(mp4Flags));
break;
case FileTypes.OGG:
extractors.add(new OggExtractor());
break;
case FileTypes.PS:
extractors.add(new PsExtractor());
break;
case FileTypes.TS:
extractors.add(new TsExtractor(tsMode, tsFlags, tsTimestampSearchBytes));
break;
case FileTypes.WAV:
extractors.add(new WavExtractor());
break;
case FileTypes.JPEG:
extractors.add(new JpegExtractor());
break;
case FileTypes.WEBVTT:
case FileTypes.UNKNOWN:
default:
break;
}
}
use of androidx.media3.extractor.ts.Ac4Extractor in project ExoPlayer by google.
the class BundledHlsMediaChunkExtractor method recreate.
@Override
public HlsMediaChunkExtractor recreate() {
Assertions.checkState(!isReusable());
Extractor newExtractorInstance;
if (extractor instanceof WebvttExtractor) {
newExtractorInstance = new WebvttExtractor(multivariantPlaylistFormat.language, timestampAdjuster);
} else if (extractor instanceof AdtsExtractor) {
newExtractorInstance = new AdtsExtractor();
} else if (extractor instanceof Ac3Extractor) {
newExtractorInstance = new Ac3Extractor();
} else if (extractor instanceof Ac4Extractor) {
newExtractorInstance = new Ac4Extractor();
} else if (extractor instanceof Mp3Extractor) {
newExtractorInstance = new Mp3Extractor();
} else {
throw new IllegalStateException("Unexpected extractor type for recreation: " + extractor.getClass().getSimpleName());
}
return new BundledHlsMediaChunkExtractor(newExtractorInstance, multivariantPlaylistFormat, timestampAdjuster);
}
use of androidx.media3.extractor.ts.Ac4Extractor in project Telegram-FOSS by Telegram-FOSS-Team.
the class DefaultExtractorsFactory method createExtractors.
@Override
public synchronized Extractor[] createExtractors() {
Extractor[] extractors = new Extractor[14];
extractors[0] = new MatroskaExtractor(matroskaFlags);
extractors[1] = new FragmentedMp4Extractor(fragmentedMp4Flags);
extractors[2] = new Mp4Extractor(mp4Flags);
extractors[3] = new OggExtractor();
extractors[4] = new Mp3Extractor(mp3Flags | (constantBitrateSeekingEnabled ? Mp3Extractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0));
extractors[5] = new AdtsExtractor(adtsFlags | (constantBitrateSeekingEnabled ? AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0));
extractors[6] = new Ac3Extractor();
extractors[7] = new TsExtractor(tsMode, tsFlags);
extractors[8] = new FlvExtractor();
extractors[9] = new PsExtractor();
extractors[10] = new WavExtractor();
extractors[11] = new AmrExtractor(amrFlags | (constantBitrateSeekingEnabled ? AmrExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING : 0));
extractors[12] = new Ac4Extractor();
if (FLAC_EXTENSION_EXTRACTOR_CONSTRUCTOR != null) {
try {
extractors[13] = FLAC_EXTENSION_EXTRACTOR_CONSTRUCTOR.newInstance();
} catch (Exception e) {
// Should never happen.
throw new IllegalStateException("Unexpected error creating FLAC extractor", e);
}
} else {
extractors[13] = new FlacExtractor();
}
return extractors;
}
use of androidx.media3.extractor.ts.Ac4Extractor in project Telegram-FOSS by Telegram-FOSS-Team.
the class DefaultHlsExtractorFactory method createExtractor.
@Override
public Result createExtractor(@Nullable Extractor previousExtractor, Uri uri, Format format, @Nullable List<Format> muxedCaptionFormats, TimestampAdjuster timestampAdjuster, Map<String, List<String>> responseHeaders, ExtractorInput extractorInput) throws InterruptedException, IOException {
if (previousExtractor != null) {
// A extractor has already been successfully used. Return one of the same type.
if (isReusable(previousExtractor)) {
return buildResult(previousExtractor);
} else {
Result result = buildResultForSameExtractorType(previousExtractor, format, timestampAdjuster);
if (result == null) {
throw new IllegalArgumentException("Unexpected previousExtractor type: " + previousExtractor.getClass().getSimpleName());
}
}
}
// Try selecting the extractor by the file extension.
Extractor extractorByFileExtension = createExtractorByFileExtension(uri, format, muxedCaptionFormats, timestampAdjuster);
extractorInput.resetPeekPosition();
if (sniffQuietly(extractorByFileExtension, extractorInput)) {
return buildResult(extractorByFileExtension);
}
if (!(extractorByFileExtension instanceof WebvttExtractor)) {
WebvttExtractor webvttExtractor = new WebvttExtractor(format.language, timestampAdjuster);
if (sniffQuietly(webvttExtractor, extractorInput)) {
return buildResult(webvttExtractor);
}
}
if (!(extractorByFileExtension instanceof AdtsExtractor)) {
AdtsExtractor adtsExtractor = new AdtsExtractor();
if (sniffQuietly(adtsExtractor, extractorInput)) {
return buildResult(adtsExtractor);
}
}
if (!(extractorByFileExtension instanceof Ac3Extractor)) {
Ac3Extractor ac3Extractor = new Ac3Extractor();
if (sniffQuietly(ac3Extractor, extractorInput)) {
return buildResult(ac3Extractor);
}
}
if (!(extractorByFileExtension instanceof Ac4Extractor)) {
Ac4Extractor ac4Extractor = new Ac4Extractor();
if (sniffQuietly(ac4Extractor, extractorInput)) {
return buildResult(ac4Extractor);
}
}
if (!(extractorByFileExtension instanceof Mp3Extractor)) {
Mp3Extractor mp3Extractor = new Mp3Extractor(/* flags= */
0, /* forcedFirstSampleTimestampUs= */
0);
if (sniffQuietly(mp3Extractor, extractorInput)) {
return buildResult(mp3Extractor);
}
}
if (!(extractorByFileExtension instanceof FragmentedMp4Extractor)) {
FragmentedMp4Extractor fragmentedMp4Extractor = createFragmentedMp4Extractor(timestampAdjuster, format, muxedCaptionFormats);
if (sniffQuietly(fragmentedMp4Extractor, extractorInput)) {
return buildResult(fragmentedMp4Extractor);
}
}
if (!(extractorByFileExtension instanceof TsExtractor)) {
TsExtractor tsExtractor = createTsExtractor(payloadReaderFactoryFlags, exposeCea608WhenMissingDeclarations, format, muxedCaptionFormats, timestampAdjuster);
if (sniffQuietly(tsExtractor, extractorInput)) {
return buildResult(tsExtractor);
}
}
// Fall back on the extractor created by file extension.
return buildResult(extractorByFileExtension);
}
Aggregations