public interface

ChunkExtractor.Factory

 androidx.media3.exoplayer.source.chunk.ChunkExtractor.Factory

Subclasses:

BundledChunkExtractor.Factory, MediaParserChunkExtractor.Factory

Overview

Creates ChunkExtractor instances.

Summary

Methods
public ChunkExtractorcreateProgressiveMediaExtractor(int primaryTrackType, Format representationFormat, boolean enableEventMessageTrack, java.util.List<Format> closedCaptionFormats, TrackOutput playerEmsgTrackOutput, PlayerId playerId)

Returns a new ChunkExtractor instance.

public ChunkExtractor.FactoryexperimentalParseSubtitlesDuringExtraction(boolean parseSubtitlesDuringExtraction)

Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue).

public FormatgetOutputTextFormat(Format sourceFormat)

Returns the output Format of emitted text samples which were originally in sourceFormat.

public ChunkExtractor.FactorysetSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)

Sets the to use for parsing subtitles during extraction.

Methods

public ChunkExtractor.Factory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)

Sets the to use for parsing subtitles during extraction. The default factory value is implementation dependent.

Parameters:

subtitleParserFactory: The for parsing subtitles during extraction.

Returns:

This factory, for convenience.

public ChunkExtractor.Factory experimentalParseSubtitlesDuringExtraction(boolean parseSubtitlesDuringExtraction)

Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). Defaults to false (i.e. subtitles will be parsed as part of rendering).

This method is experimental and will be renamed or removed in a future release.

Parameters:

parseSubtitlesDuringExtraction: Whether to parse subtitles during extraction or rendering.

Returns:

This factory, for convenience.

public Format getOutputTextFormat(Format sourceFormat)

Returns the output Format of emitted text samples which were originally in sourceFormat.

In many cases, where an Extractor emits samples from the source without mutation, this method simply returns sourceFormat. In other cases, such as an Extractor that transcodes subtitles from the sourceFormat to MimeTypes.APPLICATION_MEDIA3_CUES, the format is updated to indicate the transcoding that is taking place.

Non-text source formats are always returned without mutation.

Parameters:

sourceFormat: The original text-based format.

Returns:

The Format that will be associated with a text track.

public ChunkExtractor createProgressiveMediaExtractor(int primaryTrackType, Format representationFormat, boolean enableEventMessageTrack, java.util.List<Format> closedCaptionFormats, TrackOutput playerEmsgTrackOutput, PlayerId playerId)

Returns a new ChunkExtractor instance.

Parameters:

primaryTrackType: The of the primary track.
representationFormat: The format of the representation to extract from.
enableEventMessageTrack: Whether to enable the event message track.
closedCaptionFormats: The Formats of the Closed-Caption tracks.
playerEmsgTrackOutput: The TrackOutput for extracted EMSG messages, or null.
playerId: The PlayerId of the player using this chunk extractor.

Returns:

A new ChunkExtractor instance, or null if not applicable.