SubtitleOutputBuffer


@UnstableApi
abstract class SubtitleOutputBuffer : DecoderOutputBuffer, Subtitle


Base class for SubtitleDecoder output buffers.

Summary

Public constructors

Public functions

Unit

Clears the buffer.

(Mutable)List<Cue!>!
getCues(timeUs: Long)

Retrieve the cues that should be displayed at a given time.

Long
getEventTime(index: Int)

Returns the event time at a specified index.

Int

Returns the number of event times, where events are defined as points in time at which the cues returned by getCues changes.

Int

Returns the index of the first event that occurs after a given time (exclusive).

Unit
setContent(timeUs: Long, subtitle: Subtitle!, subsampleOffsetUs: Long)

Sets the content of the output buffer, consisting of a Subtitle and associated metadata.

Inherited functions

From androidx.media3.decoder.Buffer
Unit

Adds the flag to this buffer's flags.

Unit

Removes the flag from this buffer's flags, if it is set.

Boolean

Returns whether the specified flag has been set on this buffer.

Boolean

Returns whether the BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA flag is set.

Boolean

Returns whether the BUFFER_FLAG_END_OF_STREAM flag is set.

Boolean

Returns whether the BUFFER_FLAG_FIRST_SAMPLE flag is set.

Boolean

Returns whether the BUFFER_FLAG_KEY_FRAME flag is set.

Boolean

Returns whether the BUFFER_FLAG_LAST_SAMPLE flag is set.

Boolean

Returns whether the BUFFER_FLAG_NOT_DEPENDED_ON flag is set.

Unit

Replaces this buffer's flags with flags.

From androidx.media3.decoder.DecoderOutputBuffer
abstract Unit

Releases the output buffer for reuse.

Inherited properties

From androidx.media3.decoder.DecoderOutputBuffer
Boolean

Whether this buffer should be skipped, usually because the decoding process generated no data or invalid data.

Int

The number of buffers immediately prior to this one that were skipped in the Decoder.

Long

The presentation timestamp for the buffer, in microseconds.

Public constructors

SubtitleOutputBuffer

SubtitleOutputBuffer()

Public functions

clear

fun clear(): Unit

Clears the buffer.

getCues

fun getCues(timeUs: Long): (Mutable)List<Cue!>!

Retrieve the cues that should be displayed at a given time.

Parameters
timeUs: Long

The time in microseconds.

Returns
(Mutable)List<Cue!>!

A list of cues that should be displayed, possibly empty.

getEventTime

fun getEventTime(index: Int): Long

Returns the event time at a specified index.

Parameters
index: Int

The index of the event time to obtain.

Returns
Long

The event time in microseconds.

getEventTimeCount

fun getEventTimeCount(): Int

Returns the number of event times, where events are defined as points in time at which the cues returned by getCues changes.

Returns
Int

The number of event times.

getNextEventTimeIndex

fun getNextEventTimeIndex(timeUs: Long): Int

Returns the index of the first event that occurs after a given time (exclusive).

Parameters
timeUs: Long

The time in microseconds.

Returns
Int

The index of the next event, or INDEX_UNSET if there are no events after the specified time.

setContent

fun setContent(timeUs: Long, subtitle: Subtitle!, subsampleOffsetUs: Long): Unit

Sets the content of the output buffer, consisting of a Subtitle and associated metadata.

Parameters
timeUs: Long

The time of the start of the subtitle in microseconds.

subtitle: Subtitle!

The subtitle.

subsampleOffsetUs: Long

An offset that must be added to the subtitle's event times, or OFFSET_SAMPLE_RELATIVE if timeUs should be added.