# Cea708Decoder

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/cea/Cea708Decoder.java+class:androidx.media3.extractor.text.cea.Cea708Decoder)

*** ** * ** ***


```
@UnstableApi
public final class Cea708Decoder implements SubtitleDecoder
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleDecoder` for CEA-708 (also known as "EIA-708").

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#Cea708Decoder(int,java.util.List<byte[]>)( int accessibilityChannel, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/util/List.html<byte[]> initializationData )` Constructs an instance. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleInputBuffer` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#dequeueInputBuffer()()` Dequeues the next input buffer to be filled and queued to the decoder. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleOutputBuffer` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#dequeueOutputBuffer()()` Dequeues the next output buffer from the decoder. |
| `void` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#flush()()` Flushes the decoder. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#getName()()` Returns the name of the decoder. |
| `void` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#queueInputBuffer(androidx.media3.extractor.text.SubtitleInputBuffer)(https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleInputBuffer inputBuffer)` Queues an input buffer to the decoder. |
| `void` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#release()()` Releases the decoder. |
| `final void` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#setOutputStartTimeUs(long)(long outputStartTimeUs)` Sets the timestamp from which output buffers should be produced, in microseconds. |
| `void` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#setPositionUs(long)(long positionUs)` Informs the decoder of the current playback position. |

| ### Protected methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#createSubtitle()()` Creates a `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle` from the available data. |
| `void` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#decode(androidx.media3.extractor.text.SubtitleInputBuffer)(https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleInputBuffer inputBuffer)` Filters and processes the raw data, providing `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle`s via `https://developer.android.com/reference/androidx/media3/extractor/text/cea/CeaDecoder#createSubtitle()` when sufficient data has been processed. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleOutputBuffer` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#getAvailableOutputBuffer()()` |
| `final long` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#getPositionUs()()` |
| `boolean` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#isNewSubtitleDataAvailable()()` Returns whether there is data available to create a new `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle`. |
| `void` | `https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea708Decoder#releaseOutputBuffer(androidx.media3.extractor.text.SubtitleOutputBuffer)(https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleOutputBuffer outputBuffer)` |

| ### 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#queueInputBuffer(I)(I inputBuffer)` Queues an input buffer to the decoder. | | `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. | |

## Public constructors

### Cea708Decoder

```
public Cea708Decoder(
    int accessibilityChannel,
    @Nullable List<byte[]> initializationData
)
```

Constructs an instance.

| Parameters |
|---|---|
| `int accessibilityChannel` | The accessibility channel, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/util/List.html<byte[]> initializationData` | Optional initialization data for the decoder. If present, it must conform to the structure created by `https://developer.android.com/reference/androidx/media3/common/util/CodecSpecificDataUtil#buildCea708InitializationData(boolean)`. |

## Public methods

### dequeueInputBuffer

```
public @Nullable SubtitleInputBuffer dequeueInputBuffer()
```

Dequeues the next input buffer to be filled and queued to the decoder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleInputBuffer` | The input buffer, which will have been cleared, or null if a buffer isn't available. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/decoder/Decoder` | If a decoder error has occurred. |
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleDecoderException` |   |

### dequeueOutputBuffer

```
public @Nullable SubtitleOutputBuffer dequeueOutputBuffer()
```

Dequeues the next output buffer from the decoder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleOutputBuffer` | The output buffer, or null if an output buffer isn't available. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/decoder/Decoder` | If a decoder error has occurred. |
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleDecoderException` |   |

### flush

```
public void flush()
```

Flushes the decoder. Ownership of dequeued input buffers is returned to the decoder. The caller is still responsible for releasing any dequeued output buffers.

### getName

```
public String getName()
```

Returns the name of the decoder.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | The name of the decoder. |

### queueInputBuffer

```
public void queueInputBuffer(SubtitleInputBuffer inputBuffer)
```

Queues an input buffer to the decoder.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleInputBuffer inputBuffer` | The input buffer. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/decoder/Decoder` | If a decoder error has occurred. |
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleDecoderException` |   |

### release

```
public void release()
```

Releases the decoder. Must be called when the decoder is no longer needed.

### setOutputStartTimeUs

```
public final void setOutputStartTimeUs(long outputStartTimeUs)
```

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

Any decoded buffer with a timestamp less than `outputStartTimeUs` should be skipped by the implementation and not made available via `https://developer.android.com/reference/androidx/media3/decoder/Decoder#dequeueOutputBuffer()`.

This method must only be called before `https://developer.android.com/reference/androidx/media3/decoder/Decoder#queueInputBuffer(I)` initially or after `https://developer.android.com/reference/androidx/media3/decoder/Decoder#flush()`.

| Parameters |
|---|---|
| `long outputStartTimeUs` | The time from which output buffer should be produced, in microseconds. |

### setPositionUs

```
public 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. |

## Protected methods

### createSubtitle

```
protected Subtitle createSubtitle()
```

Creates a `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle` from the available data.

### decode

```
protected void decode(SubtitleInputBuffer inputBuffer)
```

Filters and processes the raw data, providing `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle`s via `https://developer.android.com/reference/androidx/media3/extractor/text/cea/CeaDecoder#createSubtitle()` when sufficient data has been processed.

### getAvailableOutputBuffer

```
protected final @Nullable SubtitleOutputBuffer getAvailableOutputBuffer()
```

### getPositionUs

```
protected final long getPositionUs()
```

### isNewSubtitleDataAvailable

```
protected boolean isNewSubtitleDataAvailable()
```

Returns whether there is data available to create a new `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle`.

### releaseOutputBuffer

```
protected void releaseOutputBuffer(SubtitleOutputBuffer outputBuffer)
```