Package com.google.android.exoplayer2.source.chunk

## Interface ChunkExtractor

- All Known Implementing Classes:
    `BundledChunkExtractor`, `MediaParserChunkExtractor`

      public interface ChunkExtractor

  Extracts samples and track `Formats` from chunks.

  The `ChunkExtractor.TrackOutputProvider` passed to `init(com.google.android.exoplayer2.source.chunk.ChunkExtractor.TrackOutputProvider, long, long)` provides the `TrackOutputs` that receive the extracted data.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `ChunkExtractor.Factory` | Creates `ChunkExtractor` instances.
    `static interface` | `ChunkExtractor.TrackOutputProvider` | Provides `TrackOutput` instances to be written to during extraction.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ChunkIndex` | `getChunkIndex()` | Returns the `ChunkIndex` most recently obtained from the chunks, or null if a `ChunkIndex` has not been obtained.
    `Format[]` | `getSampleFormats()` | Returns the sample `Format`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 to `TrackOutput`s provided by the specified `ChunkExtractor.TrackOutputProvider`, and configures the extractor to receive data from a new chunk.
    `boolean` | `read​(ExtractorInput input)` | Reads from the given `ExtractorInput`.
    `void` | `release()` | Releases any held resources.

- - ### Method Detail

    - #### getChunkIndex

          @Nullable
          ChunkIndex getChunkIndex()

      Returns the `ChunkIndex` most recently obtained from the chunks, or null if a `ChunkIndex` has not been obtained.

    - #### getSampleFormats

          @Nullable
          Format[] getSampleFormats()

      Returns the sample `Format`s for the tracks identified by the extractor, or null if the extractor has not finished identifying tracks.

    - #### init

          void init​(@Nullable
                    ChunkExtractor.TrackOutputProvider trackOutputProvider,
                    long startTimeUs,
                    long endTimeUs)

      Initializes the wrapper to output to `TrackOutput`s provided by the specified `ChunkExtractor.TrackOutputProvider`, and configures the extractor to receive data from a new chunk.
      Parameters:
        `trackOutputProvider` - The provider of `TrackOutput`s that will receive sample data.
        `startTimeUs` - The start position in the new chunk, or `C.TIME_UNSET` to output samples from the start of the chunk.
        `endTimeUs` - The end position in the new chunk, or `C.TIME_UNSET` to output samples to the end of the chunk.

    - #### release

          void release()

      Releases any held resources.

    - #### read

          boolean read​(ExtractorInput input)
                throws IOException

      Reads from the given `ExtractorInput`.
      Parameters:
        `input` - 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.