HlsMediaChunkExtractor


@UnstableApi
public interface HlsMediaChunkExtractor


Extracts samples and track Formats from HlsMediaChunks.

Summary

Public methods

abstract void
init(ExtractorOutput extractorOutput)

Initializes the extractor with an ExtractorOutput.

abstract boolean

Returns whether this is a packed audio extractor, as defined in RFC 8216, Section 3.4.

abstract boolean

Returns whether this instance can be used for extracting multiple continuous segments.

abstract void

Resets the sample parsing state.

abstract boolean
read(ExtractorInput extractorInput)

Extracts data read from a provided ExtractorInput.

abstract HlsMediaChunkExtractor

Returns a new instance for extracting the same type of media as this one.

Public methods

init

abstract void init(ExtractorOutput extractorOutput)

Initializes the extractor with an ExtractorOutput. Called at most once.

Parameters
ExtractorOutput extractorOutput

An ExtractorOutput to receive extracted data.

isPackedAudioExtractor

abstract boolean isPackedAudioExtractor()

Returns whether this is a packed audio extractor, as defined in RFC 8216, Section 3.4.

isReusable

abstract boolean isReusable()

Returns whether this instance can be used for extracting multiple continuous segments.

onTruncatedSegmentParsed

abstract void onTruncatedSegmentParsed()

Resets the sample parsing state.

Resetting the parsing state allows support for Fragmented MP4 EXT-X-I-FRAME-STREAM-INF segments. EXT-X-I-FRAME-STREAM-INF segments are truncated to include only a leading key frame. After parsing said keyframe, an extractor may reach an unexpected end of file. By resetting its state, we can continue feeding samples from the following segments to the extractor. See #7512 for context.

read

abstract boolean read(ExtractorInput extractorInput)

Extracts data read from a provided ExtractorInput. Must not be called before init.

A single call to this method will block until some progress has been made, but will not block for longer than this. Hence each call will consume only a small amount of input data.

When this method throws an IOException, extraction may continue by providing an ExtractorInput with an unchanged read position to a subsequent call to this method.

Parameters
ExtractorInput extractorInput

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.

recreate

abstract HlsMediaChunkExtractor recreate()

Returns a new instance for extracting the same type of media as this one. Can only be called on instances that are not reusable.