Cea608Decoder
@UnstableApi
class Cea608Decoder : SubtitleDecoder
A SubtitleDecoder for CEA-608 (also known as "line 21 captions" and "EIA-608").
Summary
Constants |
|
|---|---|
const Long |
MIN_DATA_CHANNEL_TIMEOUT_MS = 16000The minimum value for the |
Public constructors |
|---|
Cea608Decoder(Constructs an instance. |
Public functions |
|
|---|---|
SubtitleInputBuffer? |
Dequeues the next input buffer to be filled and queued to the decoder. |
SubtitleOutputBuffer? |
Dequeues the next output buffer from the decoder. |
Unit |
flush()Flushes the decoder. |
String! |
getName()Returns the name of the decoder. |
Unit |
queueInputBuffer(inputBuffer: SubtitleInputBuffer!)Queues an input buffer to the decoder. |
Unit |
release()Releases the decoder. |
Unit |
setOutputStartTimeUs(outputStartTimeUs: Long)Sets the timestamp from which output buffers should be produced, in microseconds. |
Unit |
setPositionUs(positionUs: Long)Informs the decoder of the current playback position. |
Protected functions |
|
|---|---|
Subtitle! |
Creates a |
Unit |
decode(inputBuffer: SubtitleInputBuffer!)Filters and processes the raw data, providing |
SubtitleOutputBuffer? |
|
Long |
|
Boolean |
Returns whether there is data available to create a new |
Unit |
releaseOutputBuffer(outputBuffer: SubtitleOutputBuffer!) |
Inherited functions |
||||||
|---|---|---|---|---|---|---|
|
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! |
The MIME type of the CEA-608 data. |
accessibilityChannel: Int |
The Accessibility channel, or |
validDataChannelTimeoutMs: Long |
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 |
Public functions
dequeueInputBuffer
fun dequeueInputBuffer(): SubtitleInputBuffer?
Dequeues the next input buffer to be filled and queued to the decoder.
| Returns | |
|---|---|
SubtitleInputBuffer? |
The input buffer, which will have been cleared, or null if a buffer isn't available. |
| Throws | |
|---|---|
E |
If a decoder error has occurred. |
androidx.media3.extractor.text.SubtitleDecoderException |
dequeueOutputBuffer
fun dequeueOutputBuffer(): SubtitleOutputBuffer?
Dequeues the next output buffer from the decoder.
| Returns | |
|---|---|
SubtitleOutputBuffer? |
The output buffer, or null if an output buffer isn't available. |
| Throws | |
|---|---|
E |
If a decoder error has occurred. |
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! |
The name of the decoder. |
queueInputBuffer
fun queueInputBuffer(inputBuffer: SubtitleInputBuffer!): Unit
Queues an input buffer to the decoder.
| Parameters | |
|---|---|
inputBuffer: SubtitleInputBuffer! |
The input buffer. |
| Throws | |
|---|---|
E |
If a decoder error has occurred. |
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.
This method must only be called before queuing the first input buffer initially or after flush.
| Parameters | |
|---|---|
outputStartTimeUs: Long |
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 |
The current playback position in microseconds. |
Protected functions
createSubtitle
protected fun createSubtitle(): Subtitle!
Creates a Subtitle from the available data.
decode
protected fun decode(inputBuffer: SubtitleInputBuffer!): Unit
Filters and processes the raw data, providing Subtitles via createSubtitle when sufficient data has been processed.
isNewSubtitleDataAvailable
protected fun isNewSubtitleDataAvailable(): Boolean
Returns whether there is data available to create a new Subtitle.