Package com.google.android.exoplayer2.text

## Class SubtitleOutputBuffer

- java.lang.Object
- - com.google.android.exoplayer2.decoder.Buffer
  - - com.google.android.exoplayer2.decoder.OutputBuffer
    - - com.google.android.exoplayer2.text.SubtitleOutputBuffer

- All Implemented Interfaces:
    `Subtitle`

      public abstract class SubtitleOutputBuffer
      extends OutputBuffer
      implements Subtitle

  Base class for `SubtitleDecoder` output buffers.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.android.exoplayer2.decoder.OutputBuffer

      `OutputBuffer.Owner<S extends OutputBuffer>`

  - ### Field Summary

    - ### Fields inherited from class com.google.android.exoplayer2.decoder.OutputBuffer

      `skippedOutputBufferCount, timeUs`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SubtitleOutputBuffer()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clear()` | 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` | `getEventTimeCount()` | Returns the number of event times, where events are defined as points in time at which the cues returned by `Subtitle.getCues(long)` 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.

    - ### Methods inherited from class com.google.android.exoplayer2.decoder.OutputBuffer

      `release`

    - ### Methods inherited from class com.google.android.exoplayer2.decoder.Buffer

      `addFlag, clearFlag, getFlag, hasSupplementalData, isDecodeOnly, isEndOfStream, isKeyFrame, setFlags`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SubtitleOutputBuffer

          public SubtitleOutputBuffer()

  - ### Method Detail

    - #### 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:
        `timeUs` - The time of the start of the subtitle in microseconds.
        `subtitle` - The subtitle.
        `subsampleOffsetUs` - An offset that must be added to the subtitle's event times, or `Format.OFFSET_SAMPLE_RELATIVE` if `timeUs` should be added.

    - #### getEventTimeCount

          public int getEventTimeCount()

      Description copied from interface: `Subtitle`
      Returns the number of event times, where events are defined as points in time at which the cues returned by `Subtitle.getCues(long)` changes.
      Specified by:
        `getEventTimeCount` in interface `Subtitle`
      Returns:
        The number of event times.

    - #### getEventTime

          public long getEventTime​(int index)

      Description copied from interface: `Subtitle`
      Returns the event time at a specified index.
      Specified by:
        `getEventTime` in interface `Subtitle`
      Parameters:
        `index` - The index of the event time to obtain.
      Returns:
        The event time in microseconds.

    - #### getNextEventTimeIndex

          public int getNextEventTimeIndex​(long timeUs)

      Description copied from interface: `Subtitle`
      Returns the index of the first event that occurs after a given time (exclusive).
      Specified by:
        `getNextEventTimeIndex` in interface `Subtitle`
      Parameters:
        `timeUs` - The time in microseconds.
      Returns:
        The index of the next event, or `C.INDEX_UNSET` if there are no events after the specified time.

    - #### getCues

          public List<Cue> getCues​(long timeUs)

      Description copied from interface: `Subtitle`
      Retrieve the cues that should be displayed at a given time.
      Specified by:
        `getCues` in interface `Subtitle`
      Parameters:
        `timeUs` - The time in microseconds.
      Returns:
        A list of cues that should be displayed, possibly empty.

    - #### clear

          public void clear()

      Description copied from class: `Buffer`
      Clears the buffer.
      Overrides:
        `clear` in class `Buffer`