BundledChunkExtractor


@UnstableApi
public final class BundledChunkExtractor implements ExtractorOutput, ChunkExtractor


ChunkExtractor implementation that uses ExoPlayer app-bundled Extractors.

Summary

Public fields

@MonotonicNonNull Format[]

Public constructors

BundledChunkExtractor(
    Extractor extractor,
    @C.TrackType int primaryTrackType,
    Format primaryTrackManifestFormat
)

Creates an instance.

Public methods

void

Called when all tracks have been identified, meaning no new trackId values will be passed to track.

@Nullable ChunkIndex

Returns the ChunkIndex most recently obtained from the chunks, or null if a has not been obtained.

@Nullable Format[]

Returns the sample Formats for the tracks identified by the extractor, or null if the extractor has not finished identifying tracks.

void
init(
    @Nullable ChunkExtractor.TrackOutputProvider trackOutputProvider,
    long startTimeUs,
    long endTimeUs
)

Initializes the wrapper to output to TrackOutputs provided by the specified , and configures the extractor to receive data from a new chunk.

boolean

Reads from the given ExtractorInput.

void

Releases any held resources.

void
seekMap(SeekMap seekMap)

Called when a SeekMap has been extracted from the stream.

TrackOutput
track(int id, int type)

Called by the Extractor to get the TrackOutput for a specific track.

Inherited Constants

From androidx.media3.extractor.ExtractorOutput
static final ExtractorOutput

Placeholder ExtractorOutput implementation throwing an in each method.

Constants

Public fields

sampleFormats

public @MonotonicNonNull Format[] sampleFormats

Public constructors

BundledChunkExtractor

public BundledChunkExtractor(
    Extractor extractor,
    @C.TrackType int primaryTrackType,
    Format primaryTrackManifestFormat
)

Creates an instance.

Parameters
Extractor extractor

The extractor to wrap.

@C.TrackType int primaryTrackType

The type of the primary track.

Format primaryTrackManifestFormat

A manifest defined Format whose data should be merged into any sample Format output from the Extractor for the primary track.

Public methods

endTracks

public void endTracks()

Called when all tracks have been identified, meaning no new trackId values will be passed to track.

getChunkIndex

public @Nullable ChunkIndex getChunkIndex()

Returns the ChunkIndex most recently obtained from the chunks, or null if a has not been obtained.

getSampleFormats

public @Nullable Format[] getSampleFormats()

Returns the sample Formats for the tracks identified by the extractor, or null if the extractor has not finished identifying tracks.

init

public void init(
    @Nullable ChunkExtractor.TrackOutputProvider trackOutputProvider,
    long startTimeUs,
    long endTimeUs
)

Initializes the wrapper to output to TrackOutputs provided by the specified , and configures the extractor to receive data from a new chunk.

Parameters
@Nullable ChunkExtractor.TrackOutputProvider trackOutputProvider

The provider of TrackOutputs that will receive sample data.

long startTimeUs

The start position in the new chunk, or TIME_UNSET to output samples from the start of the chunk.

long endTimeUs

The end position in the new chunk, or TIME_UNSET to output samples to the end of the chunk.

read

public boolean read(ExtractorInput input)

Reads from the given ExtractorInput.

Parameters
ExtractorInput input

The input to read from.

Returns
boolean

Whether there is any data left to extract. Returns false if the end of input has been reached.

Throws
java.io.IOException

If an error occurred reading from or parsing the input.

release

public void release()

Releases any held resources.

seekMap

public void seekMap(SeekMap seekMap)

Called when a SeekMap has been extracted from the stream.

Parameters
SeekMap seekMap

The extracted SeekMap.

track

public TrackOutput track(int id, int type)

Called by the Extractor to get the TrackOutput for a specific track.

The same TrackOutput is returned if multiple calls are made with the same id.

Parameters
int id

A track identifier.

int type

The track type.

Returns
TrackOutput

The TrackOutput for the given track identifier.