mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add API for sample dependency reading to DefaultMediaSourceFactory
PiperOrigin-RevId: 715372196
This commit is contained in:
parent
2eb8e53f8c
commit
8f17ab84f8
@ -211,6 +211,16 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
|
||||
return this;
|
||||
}
|
||||
|
||||
@CanIgnoreReturnValue
|
||||
@Override
|
||||
@UnstableApi
|
||||
public DefaultMediaSourceFactory experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies) {
|
||||
delegateFactoryLoader.setCodecsToParseWithinGopSampleDependencies(
|
||||
codecsToParseWithinGopSampleDependencies);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link AdsLoader.Provider} that provides {@link AdsLoader} instances for media items
|
||||
* that have {@link MediaItem.LocalConfiguration#adsConfiguration ads configurations}.
|
||||
@ -625,6 +635,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
|
||||
private DataSource.@MonotonicNonNull Factory dataSourceFactory;
|
||||
private boolean parseSubtitlesDuringExtraction;
|
||||
private SubtitleParser.Factory subtitleParserFactory;
|
||||
private @C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies;
|
||||
@Nullable private CmcdConfiguration.Factory cmcdConfigurationFactory;
|
||||
@Nullable private DrmSessionManagerProvider drmSessionManagerProvider;
|
||||
@Nullable private LoadErrorHandlingPolicy loadErrorHandlingPolicy;
|
||||
@ -664,6 +675,8 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
|
||||
}
|
||||
mediaSourceFactory.setSubtitleParserFactory(subtitleParserFactory);
|
||||
mediaSourceFactory.experimentalParseSubtitlesDuringExtraction(parseSubtitlesDuringExtraction);
|
||||
mediaSourceFactory.experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
codecsToParseWithinGopSampleDependencies);
|
||||
mediaSourceFactories.put(contentType, mediaSourceFactory);
|
||||
return mediaSourceFactory;
|
||||
}
|
||||
@ -695,6 +708,13 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public void setCodecsToParseWithinGopSampleDependencies(
|
||||
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies) {
|
||||
this.codecsToParseWithinGopSampleDependencies = codecsToParseWithinGopSampleDependencies;
|
||||
extractorsFactory.experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
codecsToParseWithinGopSampleDependencies);
|
||||
}
|
||||
|
||||
public void setCmcdConfigurationFactory(CmcdConfiguration.Factory cmcdConfigurationFactory) {
|
||||
this.cmcdConfigurationFactory = cmcdConfigurationFactory;
|
||||
for (MediaSource.Factory mediaSourceFactory : mediaSourceFactories.values()) {
|
||||
|
@ -30,7 +30,9 @@ import androidx.media3.exoplayer.drm.DrmSessionManagerProvider;
|
||||
import androidx.media3.exoplayer.upstream.Allocator;
|
||||
import androidx.media3.exoplayer.upstream.CmcdConfiguration;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
import androidx.media3.extractor.mp4.Mp4Extractor;
|
||||
import androidx.media3.extractor.text.SubtitleParser;
|
||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@ -131,6 +133,26 @@ public interface MediaSource {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the set of video codecs for which within GOP sample dependency information should be
|
||||
* parsed as part of extraction. Defaults to {@code 0} - empty set of codecs.
|
||||
*
|
||||
* <p>Having access to additional sample dependency information can speed up seeking. See {@link
|
||||
* Mp4Extractor#FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES}.
|
||||
*
|
||||
* <p>This method is experimental and will be renamed or removed in a future release.
|
||||
*
|
||||
* @param codecsToParseWithinGopSampleDependencies The set of codecs for which to parse within
|
||||
* GOP sample dependency information.
|
||||
* @return This factory, for convenience.
|
||||
*/
|
||||
@UnstableApi
|
||||
@CanIgnoreReturnValue
|
||||
default Factory experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies) {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link C.ContentType content types} supported by media sources created by this
|
||||
* factory.
|
||||
|
@ -30,6 +30,7 @@ import androidx.media3.exoplayer.trackselection.ExoTrackSelection;
|
||||
import androidx.media3.exoplayer.upstream.CmcdConfiguration;
|
||||
import androidx.media3.exoplayer.upstream.LoaderErrorThrower;
|
||||
import androidx.media3.extractor.Extractor;
|
||||
import androidx.media3.extractor.mp4.Mp4Extractor;
|
||||
import androidx.media3.extractor.text.SubtitleParser;
|
||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import java.util.List;
|
||||
@ -71,6 +72,25 @@ public interface DashChunkSource extends ChunkSource {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the set of video codecs for which within GOP sample dependency information should be
|
||||
* parsed as part of extraction. Defaults to {@code 0} - empty set of codecs.
|
||||
*
|
||||
* <p>Having access to additional sample dependency information can speed up seeking. See {@link
|
||||
* Mp4Extractor#FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES}.
|
||||
*
|
||||
* <p>This method is experimental and will be renamed or removed in a future release.
|
||||
*
|
||||
* @param codecsToParseWithinGopSampleDependencies The set of codecs for which to parse within
|
||||
* GOP sample dependency information.
|
||||
* @return This factory, for convenience.
|
||||
*/
|
||||
@CanIgnoreReturnValue
|
||||
default Factory experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies) {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
|
||||
* @param manifest The initial manifest.
|
||||
|
@ -217,6 +217,15 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CanIgnoreReturnValue
|
||||
public Factory experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies) {
|
||||
chunkSourceFactory.experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
codecsToParseWithinGopSampleDependencies);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target {@link Player#getCurrentLiveOffset() offset for live streams} that is used if
|
||||
* no value is defined in the {@link MediaItem} or the manifest.
|
||||
|
@ -130,6 +130,15 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
||||
return this;
|
||||
}
|
||||
|
||||
@CanIgnoreReturnValue
|
||||
@Override
|
||||
public Factory experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies) {
|
||||
chunkExtractorFactory.experimentalSetCodecsToParseWithinGopSampleDependencies(
|
||||
codecsToParseWithinGopSampleDependencies);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DashChunkSource createDashChunkSource(
|
||||
LoaderErrorThrower manifestLoaderErrorThrower,
|
||||
|
Loading…
x
Reference in New Issue
Block a user