use of com.google.android.exoplayer2.source.chunk.BundledChunkExtractor in project ExoPlayer by google.
the class DashUtil method newChunkExtractor.
private static ChunkExtractor newChunkExtractor(int trackType, Format format) {
String mimeType = format.containerMimeType;
boolean isWebm = mimeType != null && (mimeType.startsWith(MimeTypes.VIDEO_WEBM) || mimeType.startsWith(MimeTypes.AUDIO_WEBM));
Extractor extractor = isWebm ? new MatroskaExtractor() : new FragmentedMp4Extractor();
return new BundledChunkExtractor(extractor, trackType, format);
}
use of com.google.android.exoplayer2.source.chunk.BundledChunkExtractor in project ExoPlayer by google.
the class DashUtil method loadInitializationData.
/**
* Loads initialization data for the {@code representation} and optionally index data then returns
* a {@link BundledChunkExtractor} which contains the output.
*
* @param chunkExtractor The {@link ChunkExtractor} to use.
* @param dataSource The source from which the data should be loaded.
* @param representation The representation which initialization chunk belongs to.
* @param baseUrlIndex The index of the base URL with which to resolve the request URI.
* @param loadIndex Whether to load index data too.
* @throws IOException Thrown when there is an error while loading.
*/
private static void loadInitializationData(ChunkExtractor chunkExtractor, DataSource dataSource, Representation representation, int baseUrlIndex, boolean loadIndex) throws IOException {
RangedUri initializationUri = Assertions.checkNotNull(representation.getInitializationUri());
@Nullable RangedUri requestUri;
if (loadIndex) {
@Nullable RangedUri indexUri = representation.getIndexUri();
if (indexUri == null) {
return;
}
// It's common for initialization and index data to be stored adjacently. Attempt to merge
// the two requests together to request both at once.
requestUri = initializationUri.attemptMerge(indexUri, representation.baseUrls.get(baseUrlIndex).url);
if (requestUri == null) {
loadInitializationData(dataSource, representation, baseUrlIndex, chunkExtractor, initializationUri);
requestUri = indexUri;
}
} else {
requestUri = initializationUri;
}
loadInitializationData(dataSource, representation, baseUrlIndex, chunkExtractor, requestUri);
}
Aggregations