MediaParserChunkExtractor.Factory


public class MediaParserChunkExtractor.Factory implements ChunkExtractor.Factory


A ChunkExtractor.Factory for MediaParserChunkExtractor instances.

Summary

Public constructors

Public methods

@Nullable ChunkExtractor
createProgressiveMediaExtractor(
    @C.TrackType int primaryTrackType,
    Format representationFormat,
    boolean enableEventMessageTrack,
    List<Format> closedCaptionFormats,
    @Nullable TrackOutput playerEmsgTrackOutput,
    PlayerId playerId
)

Returns a new ChunkExtractor instance.

MediaParserChunkExtractor.Factory
@CanIgnoreReturnValue
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).

Format

Returns the output of emitted C#TRACK_TYPE_TEXT text samples which were originally in sourceFormat}.

MediaParserChunkExtractor.Factory

Sets the SubtitleParser.Factory to use for parsing subtitles during extraction.

Public constructors

Factory

public Factory()

Public methods

createProgressiveMediaExtractor

public @Nullable ChunkExtractor createProgressiveMediaExtractor(
    @C.TrackType int primaryTrackType,
    Format representationFormat,
    boolean enableEventMessageTrack,
    List<Format> closedCaptionFormats,
    @Nullable TrackOutput playerEmsgTrackOutput,
    PlayerId playerId
)

Returns a new ChunkExtractor instance.

Parameters
@C.TrackType int primaryTrackType

The type of the primary track.

Format representationFormat

The format of the representation to extract from.

boolean enableEventMessageTrack

Whether to enable the event message track.

List<Format> closedCaptionFormats

The Formats of the Closed-Caption tracks.

@Nullable TrackOutput playerEmsgTrackOutput

The TrackOutput for extracted EMSG messages, or null.

PlayerId playerId

The PlayerId of the player using this chunk extractor.

Returns
@Nullable ChunkExtractor

A new ChunkExtractor instance, or null if not applicable.

experimentalParseSubtitlesDuringExtraction

@CanIgnoreReturnValue
public MediaParserChunkExtractor.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
boolean parseSubtitlesDuringExtraction

Whether to parse subtitles during extraction or rendering.

Returns
MediaParserChunkExtractor.Factory

This factory, for convenience.

getOutputTextFormat

public Format getOutputTextFormat(Format sourceFormat)

Returns the output of emitted C#TRACK_TYPE_TEXT text samples which were originally in sourceFormat}.

In many cases, where an emits samples from the source without mutation, this method simply returns sourceFormat}. In other cases, such as an 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.

This implementation performs transcoding of the original format to APPLICATION_MEDIA3_CUES if it is supported by SubtitleParser.Factory.

To modify the support behavior, you can set your own subtitle parser factory.

setSubtitleParserFactory

@CanIgnoreReturnValue
public MediaParserChunkExtractor.Factory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)

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

Parameters
SubtitleParser.Factory subtitleParserFactory

The SubtitleParser.Factory for parsing subtitles during extraction.

Returns
MediaParserChunkExtractor.Factory

This factory, for convenience.