Class MediaParserChunkExtractor
- java.lang.Object
-
- com.google.android.exoplayer2.source.chunk.MediaParserChunkExtractor
-
- All Implemented Interfaces:
ChunkExtractor
public final class MediaParserChunkExtractor extends Object implements ChunkExtractor
ChunkExtractor
implemented on top of the platform'sMediaParser
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.chunk.ChunkExtractor
ChunkExtractor.TrackOutputProvider
-
-
Constructor Summary
Constructors Constructor Description MediaParserChunkExtractor(int primaryTrackType, Format manifestFormat, List<Format> closedCaptionFormats)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChunkIndex
getChunkIndex()
Returns theChunkIndex
most recently obtained from the chunks, or null if aChunkIndex
has not been obtained.Format[]
getSampleFormats()
Returns the sampleFormat
s for the tracks identified by the extractor, or null if the extractor has not finished identifying tracks.void
init(ChunkExtractor.TrackOutputProvider trackOutputProvider, long startTimeUs, long endTimeUs)
Initializes the wrapper to output toTrackOutput
s provided by the specifiedChunkExtractor.TrackOutputProvider
, and configures the extractor to receive data from a new chunk.boolean
read(ExtractorInput extractorInput)
Reads from the givenExtractorInput
.void
release()
Releases any held resources.
-
-
-
Constructor Detail
-
MediaParserChunkExtractor
public MediaParserChunkExtractor(int primaryTrackType, Format manifestFormat, List<Format> closedCaptionFormats)
Creates a new instance.- Parameters:
primaryTrackType
- The type of the primary track, orC.TRACK_TYPE_NONE
if there is no primary track. Must be one of theC.TRACK_TYPE_*
constants.manifestFormat
- The chunksFormat
as obtained from the manifest.closedCaptionFormats
- A list containing theFormats
of the closed-caption tracks in the chunks.
-
-
Method Detail
-
init
public void init(@Nullable ChunkExtractor.TrackOutputProvider trackOutputProvider, long startTimeUs, long endTimeUs)
Description copied from interface:ChunkExtractor
Initializes the wrapper to output toTrackOutput
s provided by the specifiedChunkExtractor.TrackOutputProvider
, and configures the extractor to receive data from a new chunk.- Specified by:
init
in interfaceChunkExtractor
- Parameters:
trackOutputProvider
- The provider ofTrackOutput
s that will receive sample data.startTimeUs
- The start position in the new chunk, orC.TIME_UNSET
to output samples from the start of the chunk.endTimeUs
- The end position in the new chunk, orC.TIME_UNSET
to output samples to the end of the chunk.
-
release
public void release()
Description copied from interface:ChunkExtractor
Releases any held resources.- Specified by:
release
in interfaceChunkExtractor
-
read
public boolean read(ExtractorInput extractorInput) throws IOException
Description copied from interface:ChunkExtractor
Reads from the givenExtractorInput
.- Specified by:
read
in interfaceChunkExtractor
- Parameters:
extractorInput
- The input to read from.- Returns:
- Whether there is any data left to extract. Returns false if the end of input has been reached.
- Throws:
IOException
- If an error occurred reading from or parsing the input.
-
getChunkIndex
@Nullable public ChunkIndex getChunkIndex()
Description copied from interface:ChunkExtractor
Returns theChunkIndex
most recently obtained from the chunks, or null if aChunkIndex
has not been obtained.- Specified by:
getChunkIndex
in interfaceChunkExtractor
-
getSampleFormats
@Nullable public Format[] getSampleFormats()
Description copied from interface:ChunkExtractor
Returns the sampleFormat
s for the tracks identified by the extractor, or null if the extractor has not finished identifying tracks.- Specified by:
getSampleFormats
in interfaceChunkExtractor
-
-