# SubtitleDecoder

Artifact: [androidx.media3:media3-extractor](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/extractor/text/SubtitleDecoder.java+class:androidx.media3.extractor.text.SubtitleDecoder)

*** ** * ** ***


```
@UnstableApi
interface SubtitleDecoder : Decoder<SubtitleInputBuffer!, SubtitleOutputBuffer!, SubtitleDecoderException!>
```

<br />

Known direct subclasses [Cea608Decoder](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder), [Cea708Decoder](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea708Decoder), [SimpleSubtitleDecoder](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SimpleSubtitleDecoder)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder` | A `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoder` for CEA-608 (also known as "line 21 captions" and "EIA-608"). |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea708Decoder` | A `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoder` for CEA-708 (also known as "EIA-708"). |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SimpleSubtitleDecoder` | Base class for subtitle parsers that use their own decode thread. |

*** ** * ** ***

Decodes `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle`s from `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleInputBuffer`s.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoder#setPositionUs(long)(positionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Informs the decoder of the current playback position. |

### Inherited functions

From [androidx.media3.decoder.Decoder](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder) `I?` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#dequeueInputBuffer()()`

Dequeues the next input buffer to be filled and queued to the decoder.
`O?` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#dequeueOutputBuffer()()`

Dequeues the next output buffer from the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#flush()()`

Flushes the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#getName()()`

Returns the name of the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#queueInputBuffer(I)(inputBuffer: I!)`

Queues an input buffer to the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#release()()`

Releases the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#setCallback(androidx.media3.decoder.Decoder.Callback,java.util.concurrent.Executor)(callback: https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder.Callback!, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html!)`

Sets the callback and executor.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#setOutputStartTimeUs(long)(outputStartTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Sets the timestamp from which output buffers should be produced, in microseconds.

## Public functions

### setPositionUs

```
fun setPositionUs(positionUs: Long): Unit
```

Informs the decoder of the current playback position.

Must be called prior to each attempt to dequeue output buffers from the decoder.

| Parameters |
|---|---|
| `positionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The current playback position in microseconds. |