use of androidx.media3.extractor.mp3.Mp3Extractor in project ExoPlayer by google.
the class HlsMediaChunk method buildPackedAudioExtractor.
private Extractor buildPackedAudioExtractor(long startTimeUs) {
Extractor extractor;
if (lastPathSegment.endsWith(AAC_FILE_EXTENSION)) {
extractor = new AdtsExtractor(startTimeUs);
} else if (lastPathSegment.endsWith(AC3_FILE_EXTENSION) || lastPathSegment.endsWith(EC3_FILE_EXTENSION)) {
extractor = new Ac3Extractor(startTimeUs);
} else if (lastPathSegment.endsWith(MP3_FILE_EXTENSION)) {
extractor = new Mp3Extractor(0, startTimeUs);
} else {
throw new IllegalArgumentException("Unkown extension for audio file: " + lastPathSegment);
}
extractor.init(extractorOutput);
return extractor;
}
use of androidx.media3.extractor.mp3.Mp3Extractor 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.mp3.Mp3Extractor in project media by androidx.
the class ConstantBitrateSeekerTest method setUp.
@Before
public void setUp() throws Exception {
extractor = new Mp3Extractor();
extractorOutput = new FakeExtractorOutput();
dataSource = new DefaultDataSource.Factory(ApplicationProvider.getApplicationContext()).createDataSource();
}
use of androidx.media3.extractor.mp3.Mp3Extractor 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.mp3.Mp3Extractor 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);
}
Aggregations