# 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
public interface SubtitleDecoder extends Decoder<SubtitleInputBuffer, SubtitleOutputBuffer, SubtitleDecoderException>
```

<br />

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

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

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleDecoder#setPositionUs(long)(long positionUs)` Informs the decoder of the current playback position. |

### Inherited methods

From [androidx.media3.decoder.Decoder](https://developer.android.com/reference/androidx/media3/decoder/Decoder) `abstract @https://developer.android.com/reference/androidx/annotation/Nullable I` `https://developer.android.com/reference/androidx/media3/decoder/Decoder#dequeueInputBuffer()()`

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

Dequeues the next output buffer from the decoder.
`abstract void` `https://developer.android.com/reference/androidx/media3/decoder/Decoder#flush()()`

Flushes the decoder.
`abstract https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/media3/decoder/Decoder#getName()()`

Returns the name of the decoder.
`abstract void` `https://developer.android.com/reference/androidx/media3/decoder/Decoder#queueInputBuffer(I)(I inputBuffer)`

Queues an input buffer to the decoder.
`abstract void` `https://developer.android.com/reference/androidx/media3/decoder/Decoder#release()()`

Releases the decoder.
`default void` `https://developer.android.com/reference/androidx/media3/decoder/Decoder#setCallback(androidx.media3.decoder.Decoder.Callback,java.util.concurrent.Executor)(https://developer.android.com/reference/androidx/media3/decoder/Decoder.Callback callback, https://developer.android.com/reference/java/util/concurrent/Executor.html executor)`

Sets the callback and executor.
`abstract void` `https://developer.android.com/reference/androidx/media3/decoder/Decoder#setOutputStartTimeUs(long)(long outputStartTimeUs)`

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

## Public methods

### setPositionUs

```
abstract void setPositionUs(long positionUs)
```

Informs the decoder of the current playback position.

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

| Parameters |
|---|---|
| `long positionUs` | The current playback position in microseconds. |