# ChunkExtractor.Factory

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/source/chunk/ChunkExtractor.java+class:androidx.media3.exoplayer.source.chunk.ChunkExtractor.Factory)

*** ** * ** ***


```
interface ChunkExtractor.Factory
```

<br />

Known direct subclasses [BundledChunkExtractor.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BundledChunkExtractor.Factory), [MediaParserChunkExtractor.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BundledChunkExtractor.Factory` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory` for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BundledChunkExtractor`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor.Factory` | A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory` for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaParserChunkExtractor` instances. |

*** ** * ** ***

Creates `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instances.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory#createProgressiveMediaExtractor(int,androidx.media3.common.Format,boolean,java.util.List<androidx.media3.common.Format>,androidx.media3.extractor.TrackOutput,androidx.media3.exoplayer.analytics.PlayerId)( @https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType primaryTrackType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, representationFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, enableEventMessageTrack: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, closedCaptionFormats: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Format!>!, playerEmsgTrackOutput: https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput?, playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId! )` Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instance. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/ExperimentalApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory#experimentalParseSubtitlesDuringExtraction(boolean)( parseSubtitlesDuringExtraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory#getOutputTextFormat(androidx.media3.common.Format)(sourceFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Returns the output `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of emitted `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()` which were originally in `sourceFormat`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory#setSubtitleParserFactory(androidx.media3.extractor.text.SubtitleParser.Factory)(subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory` to use for parsing subtitles during extraction. |

## Public functions

### createProgressiveMediaExtractor

```
fun createProgressiveMediaExtractor(
    @C.TrackType primaryTrackType: Int,
    representationFormat: Format!,
    enableEventMessageTrack: Boolean,
    closedCaptionFormats: (Mutable)List<Format!>!,
    playerEmsgTrackOutput: TrackOutput?,
    playerId: PlayerId!
): ChunkExtractor?
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instance.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType primaryTrackType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType` of the primary track. |
| `representationFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The format of the representation to extract from. |
| `enableEventMessageTrack: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to enable the event message track. |
| `closedCaptionFormats: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Format!>!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of the Closed-Caption tracks. |
| `playerEmsgTrackOutput: https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput?` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput` for extracted EMSG messages, or null. |
| `playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId` of the player using this chunk extractor. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor?` | A new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instance, or null if not applicable. |

### experimentalParseSubtitlesDuringExtraction

```
@CanIgnoreReturnValue
@ExperimentalApi
fun experimentalParseSubtitlesDuringExtraction(
    parseSubtitlesDuringExtraction: Boolean
): ChunkExtractor.Factory!
```

Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). Defaults to `false` (i.e. subtitles will be parsed as part of rendering).

This method is experimental and will be renamed or removed in a future release.

| Parameters |
|---|---|
| `parseSubtitlesDuringExtraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to parse subtitles during extraction or rendering. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory!` | This factory, for convenience. |

### getOutputTextFormat

```
fun getOutputTextFormat(sourceFormat: Format!): Format!
```

Returns the output `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of emitted `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()` which were originally in `sourceFormat`.

In many cases, where an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor` emits samples from the source without mutation, this method simply returns `sourceFormat`. In other cases, such as an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor` that transcodes subtitles from the `sourceFormat` to `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()`, the format is updated to indicate the transcoding that is taking place.

Non-text source formats are always returned without mutation.

| Parameters |
|---|---|
| `sourceFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The original text-based format. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` that will be associated with a `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()`. |

### setSubtitleParserFactory

```
@CanIgnoreReturnValue
fun setSubtitleParserFactory(subtitleParserFactory: SubtitleParser.Factory!): ChunkExtractor.Factory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory` to use for parsing subtitles during extraction. The default factory value is implementation dependent.

| Parameters |
|---|---|
| `subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory` for parsing subtitles during extraction. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory!` | This factory, for convenience. |