Stay organized with collections Save and categorize content based on your preferences.

SubtitleOutputBuffer

@UnstableApi
public abstract class SubtitleOutputBuffer extends DecoderOutputBuffer implements Subtitle


Base class for SubtitleDecoder output buffers.

Summary

Public constructors

Public methods

void

Clears the buffer.

List<Cue>
getCues(long timeUs)

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

long
getEventTime(int index)

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
getNextEventTimeIndex(long timeUs)

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

void
setContent(long timeUs, Subtitle subtitle, long subsampleOffsetUs)

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

Inherited fields

From androidx.media3.decoder.DecoderOutputBuffer
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.

Inherited methods

From androidx.media3.decoder.Buffer
final void

Adds the flag to this buffer's flags.

final void

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

final boolean

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

final boolean

Returns whether the BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA flag is set.

final boolean

Returns whether the BUFFER_FLAG_DECODE_ONLY flag is set.

final boolean

Returns whether the BUFFER_FLAG_END_OF_STREAM flag is set.

final boolean

Returns whether the BUFFER_FLAG_FIRST_SAMPLE flag is set.

final boolean

Returns whether the BUFFER_FLAG_KEY_FRAME flag is set.

final void
setFlags(@C.BufferFlags int flags)

Replaces this buffer's flags with flags.

From androidx.media3.decoder.DecoderOutputBuffer
abstract void

Releases the output buffer for reuse.

Public constructors

SubtitleOutputBuffer

public SubtitleOutputBuffer()

Public methods

clear

public void clear()

Clears the buffer.

getCues

public List<CuegetCues(long timeUs)

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

Parameters
long timeUs

The time in microseconds.

Returns
List<Cue>

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

getEventTime

public long getEventTime(int index)

Returns the event time at a specified index.

Parameters
int index

The index of the event time to obtain.

Returns
long

The event time in microseconds.

getEventTimeCount

public int getEventTimeCount()

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

public int getNextEventTimeIndex(long timeUs)

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

Parameters
long timeUs

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

public void setContent(long timeUs, Subtitle subtitle, long subsampleOffsetUs)

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

Parameters
long timeUs

The time of the start of the subtitle in microseconds.

Subtitle subtitle

The subtitle.

long subsampleOffsetUs

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