# Cea608Decoder

# Cea608Decoder

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/extractor/text/cea/Cea608Decoder "View this page in Java")

<br />

```
@UnstableApi
class Cea608Decoder : SubtitleDecoder
```

<br />

*** ** * ** ***

A[SubtitleDecoder](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoder)for CEA-608 (also known as "line 21 captions" and "EIA-608").

## Summary

|                                     ### Constants                                     |
|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [MIN_DATA_CHANNEL_TIMEOUT_MS](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#MIN_DATA_CHANNEL_TIMEOUT_MS())` = 16000` The minimum value for the`validDataChannelTimeoutMs`constructor parameter permitted by ANSI/CTA-608-E R-2014 Annex C.9. |

|                                                                                                                                                                                                                                             ### Public constructors                                                                                                                                                                                                                                             |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Cea608Decoder](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#Cea608Decoder(java.lang.String,int,long))`(` ` mimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` accessibilityChannel: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` validDataChannelTimeoutMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) `)` Constructs an instance. |

|                                                     ### Public functions                                                      |
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SubtitleInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleInputBuffer)`?`   | [dequeueInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#dequeueInputBuffer())`()` Dequeues the next input buffer to be filled and queued to the decoder.                                                                                                                                                       |
| [SubtitleOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleOutputBuffer)`?` | [dequeueOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#dequeueOutputBuffer())`()` Dequeues the next output buffer from the decoder.                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                 | [flush](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#flush())`()` Flushes the decoder.                                                                                                                                                                                                                                   |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                                          | [getName](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#getName())`()` Returns the name of the decoder.                                                                                                                                                                                                                   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                 | [queueInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#queueInputBuffer(androidx.media3.extractor.text.SubtitleInputBuffer))`(inputBuffer: `[SubtitleInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleInputBuffer)`!)` Queues an input buffer to the decoder. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                 | [release](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#release())`()` Releases the decoder.                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                 | [setOutputStartTimeUs](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#setOutputStartTimeUs(long))`(outputStartTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Sets the timestamp from which output buffers should be produced, in microseconds.                                  |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                 | [setPositionUs](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#setPositionUs(long))`(positionUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Informs the decoder of the current playback position.                                                                                   |

|                                                    ### Protected functions                                                    |
|-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Subtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle)`!`                         | [createSubtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#createSubtitle())`()` Creates a[Subtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle)from the available data.                                                                                                                                                                                                                                                                                                                                                                   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                 | [decode](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#decode(androidx.media3.extractor.text.SubtitleInputBuffer))`(inputBuffer: `[SubtitleInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleInputBuffer)`!)` Filters and processes the raw data, providing[Subtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle)s via[createSubtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/CeaDecoder#createSubtitle())when sufficient data has been processed. |
| [SubtitleOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleOutputBuffer)`?` | [getAvailableOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#getAvailableOutputBuffer())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                                 | [getPositionUs](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#getPositionUs())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                           | [isNewSubtitleDataAvailable](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#isNewSubtitleDataAvailable())`()` Returns whether there is data available to create a new[Subtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle).                                                                                                                                                                                                                                                                                                                    |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                 | [releaseOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#releaseOutputBuffer(androidx.media3.extractor.text.SubtitleOutputBuffer))`(outputBuffer: `[SubtitleOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleOutputBuffer)`!)`                                                                                                                                                                                                                                                                                               |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.media3.decoder.Decoder](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder) |------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `abstract I?`                                                                            | [dequeueInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#dequeueInputBuffer())`()` Dequeues the next input buffer to be filled and queued to the decoder. | | `abstract O?`                                                                            | [dequeueOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#dequeueOutputBuffer())`()` Dequeues the next output buffer from the decoder.                    | | `abstract `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [queueInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#queueInputBuffer(I))`(inputBuffer: I!)` Queues an input buffer to the decoder.                     | |

## Constants

### MIN_DATA_CHANNEL_TIMEOUT_MS

```
const val MIN_DATA_CHANNEL_TIMEOUT_MS = 16000: Long
```

The minimum value for the`validDataChannelTimeoutMs`constructor parameter permitted by ANSI/CTA-608-E R-2014 Annex C.9.  

## Public constructors

### Cea608Decoder

```
Cea608Decoder(
    mimeType: String!,
    accessibilityChannel: Int,
    validDataChannelTimeoutMs: Long
)
```

Constructs an instance.  

|                                                 Parameters                                                 |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `mimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`           | The MIME type of the CEA-608 data.                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `accessibilityChannel: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)        | The Accessibility channel, or[NO_VALUE](https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE())if unknown.                                                                                                                                                                                                                                                                                                                   |
| `validDataChannelTimeoutMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The timeout (in milliseconds) permitted by ANSI/CTA-608-E R-2014 Annex C.9 to clear "stuck" captions where no removal control code is received. The timeout should be at least[MIN_DATA_CHANNEL_TIMEOUT_MS](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/cea/Cea608Decoder#MIN_DATA_CHANNEL_TIMEOUT_MS())or[TIME_UNSET](https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET())for no timeout. |

## Public functions

### dequeueInputBuffer

```
fun dequeueInputBuffer(): SubtitleInputBuffer?
```

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

|                                                           Returns                                                           |
|-----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [SubtitleInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleInputBuffer)`?` | The input buffer, which will have been cleared, or null if a buffer isn't available. |

|                                                                              Throws                                                                               |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
| [E](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder)                                                                               | If a decoder error has occurred. |
| [androidx.media3.extractor.text.SubtitleDecoderException](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoderException) |                                  |

### dequeueOutputBuffer

```
fun dequeueOutputBuffer(): SubtitleOutputBuffer?
```

Dequeues the next output buffer from the decoder.  

|                                                            Returns                                                            |
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| [SubtitleOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleOutputBuffer)`?` | The output buffer, or null if an output buffer isn't available. |

|                                                                              Throws                                                                               |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
| [E](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder)                                                                               | If a decoder error has occurred. |
| [androidx.media3.extractor.text.SubtitleDecoderException](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoderException) |                                  |

### flush

```
fun flush(): Unit
```

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

```
fun getName(): String!
```

Returns the name of the decoder.  

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|--------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The name of the decoder. |

### queueInputBuffer

```
fun queueInputBuffer(inputBuffer: SubtitleInputBuffer!): Unit
```

Queues an input buffer to the decoder.  

|                                                                 Parameters                                                                 |
|--------------------------------------------------------------------------------------------------------------------------------------------|-------------------|
| `inputBuffer: `[SubtitleInputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleInputBuffer)`!` | The input buffer. |

|                                                                              Throws                                                                               |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
| [E](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder)                                                                               | If a decoder error has occurred. |
| [androidx.media3.extractor.text.SubtitleDecoderException](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoderException) |                                  |

### release

```
fun release(): Unit
```

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

### setOutputStartTimeUs

```
fun setOutputStartTimeUs(outputStartTimeUs: Long): Unit
```

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[dequeueOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#dequeueOutputBuffer()).

This method must only be called before[queuing the first input buffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#queueInputBuffer(I))initially or after[flush](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#flush()).  

|                                             Parameters                                             |
|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| `outputStartTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The time from which output buffer should be produced, in microseconds. |

### 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: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The current playback position in microseconds. |

## Protected functions

### createSubtitle

```
protected fun createSubtitle(): Subtitle!
```

Creates a[Subtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle)from the available data.  

### decode

```
protected fun decode(inputBuffer: SubtitleInputBuffer!): Unit
```

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

### getAvailableOutputBuffer

```
protected fun getAvailableOutputBuffer(): SubtitleOutputBuffer?
```  

### getPositionUs

```
protected fun getPositionUs(): Long
```  

### isNewSubtitleDataAvailable

```
protected fun isNewSubtitleDataAvailable(): Boolean
```

Returns whether there is data available to create a new[Subtitle](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle).  

### releaseOutputBuffer

```
protected fun releaseOutputBuffer(outputBuffer: SubtitleOutputBuffer!): Unit
```