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

## Class BundledChunkExtractor

- java.lang.Object
- - com.google.android.exoplayer2.source.chunk.BundledChunkExtractor

- All Implemented Interfaces:
    `ExtractorOutput`, `ChunkExtractor`

      public final class BundledChunkExtractor
      extends Object
      implements ExtractorOutput, ChunkExtractor

  `ChunkExtractor` implementation that uses ExoPlayer app-bundled `Extractors`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.chunk.ChunkExtractor

      `ChunkExtractor.Factory, ChunkExtractor.TrackOutputProvider`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static ChunkExtractor.Factory` | `FACTORY` | `ChunkExtractor.Factory` for instances of this class.

    - ### Fields inherited from interface com.google.android.exoplayer2.extractor.ExtractorOutput

      `PLACEHOLDER`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BundledChunkExtractor​(Extractor extractor, @com.google.android.exoplayer2.C.TrackType int primaryTrackType, Format primaryTrackManifestFormat)` | Creates an instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `endTracks()` | Called when all tracks have been identified, meaning no new `trackId` values will be passed to `ExtractorOutput.track(int, int)`.
    `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.
    `void` | `seekMap​(SeekMap seekMap)` | Called when a `SeekMap` has been extracted from the stream.
    `TrackOutput` | `track​(int id, int type)` | Called by the `Extractor` to get the `TrackOutput` for a specific track.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FACTORY

          public static final ChunkExtractor.Factory FACTORY

      `ChunkExtractor.Factory` for instances of this class.

  - ### Constructor Detail

    - #### BundledChunkExtractor

          public BundledChunkExtractor​(Extractor extractor,
                                       @com.google.android.exoplayer2.C.TrackType int primaryTrackType,
                                       Format primaryTrackManifestFormat)

      Creates an instance.
      Parameters:
        `extractor` - The extractor to wrap.
        `primaryTrackType` - The `type` of the primary track.
        `primaryTrackManifestFormat` - A manifest defined `Format` whose data should be merged into any sample `Format` output from the `Extractor` for the primary track.

  - ### Method Detail

    - #### getChunkIndex

          @Nullable
          public ChunkIndex getChunkIndex()

      Description copied from interface: `ChunkExtractor`
      Returns the `ChunkIndex` most recently obtained from the chunks, or null if a `ChunkIndex` has not been obtained.
      Specified by:
        `getChunkIndex` in interface `ChunkExtractor`

    - #### getSampleFormats

          @Nullable
          public Format[] getSampleFormats()

      Description copied from interface: `ChunkExtractor`
      Returns the sample `Format`s for the tracks identified by the extractor, or null if the extractor has not finished identifying tracks.
      Specified by:
        `getSampleFormats` in interface `ChunkExtractor`

    - #### init

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

      Description copied from interface: `ChunkExtractor`
      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.
      Specified by:
        `init` in interface `ChunkExtractor`
      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

          public void release()

      Description copied from interface: `ChunkExtractor`
      Releases any held resources.
      Specified by:
        `release` in interface `ChunkExtractor`

    - #### read

          public boolean read​(ExtractorInput input)
                       throws IOException

      Description copied from interface: `ChunkExtractor`
      Reads from the given `ExtractorInput`.
      Specified by:
        `read` in interface `ChunkExtractor`
      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.

    - #### track

          public TrackOutput track​(int id,
                                   int type)

      Description copied from interface: `ExtractorOutput`
      Called by the `Extractor` to get the `TrackOutput` for a specific track.

      The same `TrackOutput` is returned if multiple calls are made with the same `id`.

      Specified by:
        `track` in interface `ExtractorOutput`
      Parameters:
        `id` - A track identifier.
        `type` - The `track type`.
      Returns:
        The `TrackOutput` for the given track identifier.

    - #### endTracks

          public void endTracks()

      Description copied from interface: `ExtractorOutput`
      Called when all tracks have been identified, meaning no new `trackId` values will be passed to `ExtractorOutput.track(int, int)`.
      Specified by:
        `endTracks` in interface `ExtractorOutput`

    - #### seekMap

          public void seekMap​(SeekMap seekMap)

      Description copied from interface: `ExtractorOutput`
      Called when a `SeekMap` has been extracted from the stream.
      Specified by:
        `seekMap` in interface `ExtractorOutput`
      Parameters:
        `seekMap` - The extracted `SeekMap`.