@UnstableApi
abstract class Buffer

Known direct subclasses
DecoderInputBuffer

Holds input for a decoder.

DecoderOutputBuffer

Output buffer decoded by a Decoder.


Base class for buffers with flags.

Summary

Public constructors

Public functions

Unit

Adds the flag to this buffer's flags.

Unit

Clears the buffer.

Unit

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

Boolean

Returns whether the BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA flag is set.

Boolean

This function is deprecated.

Check instead whether the buffer time is greater or equal to the desired start time.

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.

Unit

Replaces this buffer's flags with flags.

Protected functions

Boolean

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

Public constructors

Buffer

Buffer()

Public functions

addFlag

fun addFlag(@C.BufferFlags flag: Int): Unit

Adds the flag to this buffer's flags.

Parameters
@C.BufferFlags flag: Int

The flag to add to this buffer's flags, which should be one of the C.BUFFER_FLAG_* constants.

clear

@CallSuper
fun clear(): Unit

Clears the buffer.

clearFlag

fun clearFlag(@C.BufferFlags flag: Int): Unit

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

Parameters
@C.BufferFlags flag: Int

The flag to remove.

hasSupplementalData

fun hasSupplementalData(): Boolean

Returns whether the BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA flag is set.

isDecodeOnly

fun isDecodeOnly(): Boolean

isEndOfStream

fun isEndOfStream(): Boolean

Returns whether the BUFFER_FLAG_END_OF_STREAM flag is set.

If this is set, all other attributes of the buffer should be ignored.

isFirstSample

fun isFirstSample(): Boolean

Returns whether the BUFFER_FLAG_FIRST_SAMPLE flag is set.

isKeyFrame

fun isKeyFrame(): Boolean

Returns whether the BUFFER_FLAG_KEY_FRAME flag is set.

isLastSample

fun isLastSample(): Boolean

Returns whether the BUFFER_FLAG_LAST_SAMPLE flag is set.

setFlags

fun setFlags(@C.BufferFlags flags: Int): Unit

Replaces this buffer's flags with flags.

Parameters
@C.BufferFlags flags: Int

The flags to set, which should be a combination of the C.BUFFER_FLAG_* constants.

Protected functions

getFlag

protected fun getFlag(@C.BufferFlags flag: Int): Boolean

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

Parameters
@C.BufferFlags flag: Int

The flag to check.

Returns
Boolean

Whether the flag is set.