Package com.google.android.exoplayer2.extractor

## Class DefaultExtractorsFactory

- java.lang.Object
- - com.google.android.exoplayer2.extractor.DefaultExtractorsFactory

- All Implemented Interfaces:
    `ExtractorsFactory`

      public final class DefaultExtractorsFactory
      extends Object
      implements ExtractorsFactory

  An `ExtractorsFactory` that provides an array of extractors for the following formats:
  - MP4, including M4A (`Mp4Extractor`)
  - fMP4 (`FragmentedMp4Extractor`)
  - Matroska and WebM (`MatroskaExtractor`)
  - Ogg Vorbis/FLAC (`OggExtractor`
  - MP3 (`Mp3Extractor`)
  - AAC (`AdtsExtractor`)
  - MPEG TS (`TsExtractor`)
  - MPEG PS (`PsExtractor`)
  - FLV (`FlvExtractor`)
  - WAV (`WavExtractor`)
  - AC3 (`Ac3Extractor`)
  - AC4 (`Ac4Extractor`)
  - AMR (`AmrExtractor`)
  - FLAC
    - If available, the FLAC extension's `com.google.android.exoplayer2.ext.flac.FlacExtractor` is used.
    - Otherwise, the core `FlacExtractor` is used. Note that Android devices do not generally include a FLAC decoder before API 27. This can be worked around by using the FLAC extension or the FFmpeg extension.
  - JPEG (`JpegExtractor`)

- - ### Field Summary

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

      `EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultExtractorsFactory()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Extractor[]` | `createExtractors()` | Returns an array of new `Extractor` instances.
    `Extractor[]` | `createExtractors​(Uri uri, Map<String,​List<String>> responseHeaders)` | Returns an array of new `Extractor` instances.
    `DefaultExtractorsFactory` | `setAdtsExtractorFlags​(int flags)` | Sets flags for `AdtsExtractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setAmrExtractorFlags​(int flags)` | Sets flags for `AmrExtractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setConstantBitrateSeekingEnabled​(boolean constantBitrateSeekingEnabled)` | Convenience method to set whether approximate seeking using constant bitrate assumptions should be enabled for all extractors that support it.
    `DefaultExtractorsFactory` | `setFlacExtractorFlags​(int flags)` | Sets flags for `FlacExtractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setFragmentedMp4ExtractorFlags​(int flags)` | Sets flags for `FragmentedMp4Extractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setMatroskaExtractorFlags​(int flags)` | Sets flags for `MatroskaExtractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setMp3ExtractorFlags​(int flags)` | Sets flags for `Mp3Extractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setMp4ExtractorFlags​(int flags)` | Sets flags for `Mp4Extractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setTsExtractorFlags​(int flags)` | Sets flags for `DefaultTsPayloadReaderFactory`s used by `TsExtractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setTsExtractorMode​(int mode)` | Sets the mode for `TsExtractor` instances created by the factory.
    `DefaultExtractorsFactory` | `setTsExtractorTimestampSearchBytes​(int timestampSearchBytes)` | Sets the number of bytes searched to find a timestamp for `TsExtractor` instances created by the factory.

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

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

- - ### Constructor Detail

    - #### DefaultExtractorsFactory

          public DefaultExtractorsFactory()

  - ### Method Detail

    - #### setConstantBitrateSeekingEnabled

          public DefaultExtractorsFactory setConstantBitrateSeekingEnabled​(boolean constantBitrateSeekingEnabled)

      Convenience method to set whether approximate seeking using constant bitrate assumptions should be enabled for all extractors that support it. If set to true, the flags required to enable this functionality will be OR'd with those passed to the setters when creating extractor instances. If set to false then the flags passed to the setters will be used without modification.
      Parameters:
        `constantBitrateSeekingEnabled` - Whether approximate seeking using a constant bitrate assumption should be enabled for all extractors that support it.
      Returns:
        The factory, for convenience.

    - #### setAdtsExtractorFlags

          public DefaultExtractorsFactory setAdtsExtractorFlags​(@Flags
                                                                int flags)

      Sets flags for `AdtsExtractor` instances created by the factory.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `AdtsExtractor(int)`

    - #### setAmrExtractorFlags

          public DefaultExtractorsFactory setAmrExtractorFlags​(@Flags
                                                               int flags)

      Sets flags for `AmrExtractor` instances created by the factory.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `AmrExtractor(int)`

    - #### setFlacExtractorFlags

          public DefaultExtractorsFactory setFlacExtractorFlags​(@Flags
                                                                int flags)

      Sets flags for `FlacExtractor` instances created by the factory. The flags are also used by `com.google.android.exoplayer2.ext.flac.FlacExtractor` instances if the FLAC extension is being used.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `FlacExtractor(int)`

    - #### setMatroskaExtractorFlags

          public DefaultExtractorsFactory setMatroskaExtractorFlags​(@Flags
                                                                    int flags)

      Sets flags for `MatroskaExtractor` instances created by the factory.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `MatroskaExtractor(int)`

    - #### setMp4ExtractorFlags

          public DefaultExtractorsFactory setMp4ExtractorFlags​(@Flags
                                                               int flags)

      Sets flags for `Mp4Extractor` instances created by the factory.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `Mp4Extractor(int)`

    - #### setFragmentedMp4ExtractorFlags

          public DefaultExtractorsFactory setFragmentedMp4ExtractorFlags​(@Flags
                                                                         int flags)

      Sets flags for `FragmentedMp4Extractor` instances created by the factory.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `FragmentedMp4Extractor(int)`

    - #### setMp3ExtractorFlags

          public DefaultExtractorsFactory setMp3ExtractorFlags​(@Flags
                                                               int flags)

      Sets flags for `Mp3Extractor` instances created by the factory.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `Mp3Extractor(int)`

    - #### setTsExtractorMode

          public DefaultExtractorsFactory setTsExtractorMode​(@Mode
                                                             int mode)

      Sets the mode for `TsExtractor` instances created by the factory.
      Parameters:
        `mode` - The mode to use.
      Returns:
        The factory, for convenience.
      See Also:
        `TsExtractor(int, TimestampAdjuster, TsPayloadReader.Factory, int)`

    - #### setTsExtractorFlags

          public DefaultExtractorsFactory setTsExtractorFlags​(@Flags
                                                              int flags)

      Sets flags for `DefaultTsPayloadReaderFactory`s used by `TsExtractor` instances created by the factory.
      Parameters:
        `flags` - The flags to use.
      Returns:
        The factory, for convenience.
      See Also:
        `TsExtractor(int)`

    - #### setTsExtractorTimestampSearchBytes

          public DefaultExtractorsFactory setTsExtractorTimestampSearchBytes​(int timestampSearchBytes)

      Sets the number of bytes searched to find a timestamp for `TsExtractor` instances created by the factory.
      Parameters:
        `timestampSearchBytes` - The number of search bytes to use.
      Returns:
        The factory, for convenience.
      See Also:
        `TsExtractor(int, TimestampAdjuster, TsPayloadReader.Factory, int)`

    - #### createExtractors

          public Extractor[] createExtractors()

      Description copied from interface: `ExtractorsFactory`
      Returns an array of new `Extractor` instances.
      Specified by:
        `createExtractors` in interface `ExtractorsFactory`

    - #### createExtractors

          public Extractor[] createExtractors​(Uri uri,
                                              Map<String,​List<String>> responseHeaders)

      Description copied from interface: `ExtractorsFactory`
      Returns an array of new `Extractor` instances.
      Specified by:
        `createExtractors` in interface `ExtractorsFactory`
      Parameters:
        `uri` - The `Uri` of the media to extract.
        `responseHeaders` - The response headers of the media to extract, or an empty map if there are none. The map lookup should be case-insensitive.
      Returns:
        The `Extractor` instances.