HlsMediaChunkExtractor
public final class BundledHlsMediaChunkExtractor extends Object implements HlsMediaChunkExtractor
HlsMediaChunkExtractor
implementation that uses ExoPlayer app-bundled Extractors
.Constructor | Description |
---|---|
BundledHlsMediaChunkExtractor(Extractor extractor,
Format masterPlaylistFormat,
TimestampAdjuster timestampAdjuster) |
Creates a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
void |
init(ExtractorOutput extractorOutput) |
Initializes the extractor with an
ExtractorOutput . |
boolean |
isPackedAudioExtractor() |
Returns whether this is a packed audio extractor, as defined in RFC 8216, Section 3.4.
|
boolean |
isReusable() |
Returns whether this instance can be used for extracting multiple continuous segments.
|
void |
onTruncatedSegmentParsed() |
Resets the sample parsing state.
|
boolean |
read(ExtractorInput extractorInput) |
Extracts data read from a provided
ExtractorInput . |
HlsMediaChunkExtractor |
recreate() |
Returns a new instance for extracting the same type of media as this one.
|
public BundledHlsMediaChunkExtractor(Extractor extractor, Format masterPlaylistFormat, TimestampAdjuster timestampAdjuster)
extractor
- The underlying Extractor
.masterPlaylistFormat
- The Format
obtained from the master playlist.timestampAdjuster
- A TimestampAdjuster
to adjust sample timestamps.public void init(ExtractorOutput extractorOutput)
HlsMediaChunkExtractor
ExtractorOutput
. Called at most once.init
in interface HlsMediaChunkExtractor
extractorOutput
- An ExtractorOutput
to receive extracted data.public boolean read(ExtractorInput extractorInput) throws IOException
HlsMediaChunkExtractor
ExtractorInput
. Must not be called before HlsMediaChunkExtractor.init(ExtractorOutput)
.
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.
read
in interface HlsMediaChunkExtractor
extractorInput
- The input to read from.IOException
- If an error occurred reading from or parsing the input.public boolean isPackedAudioExtractor()
HlsMediaChunkExtractor
isPackedAudioExtractor
in interface HlsMediaChunkExtractor
public boolean isReusable()
HlsMediaChunkExtractor
isReusable
in interface HlsMediaChunkExtractor
public HlsMediaChunkExtractor recreate()
HlsMediaChunkExtractor
reusable
.recreate
in interface HlsMediaChunkExtractor
public void onTruncatedSegmentParsed()
HlsMediaChunkExtractor
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.
onTruncatedSegmentParsed
in interface HlsMediaChunkExtractor