Added in API level 16

BufferInfo


class BufferInfo
kotlin.Any
   ↳ android.media.MediaCodec.BufferInfo

Per buffer metadata includes an offset and size specifying the range of valid data in the associated codec (output) buffer.

Summary

Public constructors

Public methods
Unit
set(newOffset: Int, newSize: Int, newTimeUs: Long, newFlags: Int)

Update the buffer metadata information.

Properties
Int

Buffer flags associated with the buffer.

Int

The start-offset of the data in the buffer.

Long

The presentation timestamp in microseconds for the buffer.

Int

The amount of data (in bytes) in the buffer.

Public constructors

BufferInfo

BufferInfo()

Public methods

set

Added in API level 16
fun set(
    newOffset: Int,
    newSize: Int,
    newTimeUs: Long,
    newFlags: Int
): Unit

Update the buffer metadata information.

Parameters
newOffset Int: the start-offset of the data in the buffer.
newSize Int: the amount of data (in bytes) in the buffer.
newTimeUs Long: the presentation timestamp in microseconds.
newFlags Int: buffer flags associated with the buffer. This should be a combination of BUFFER_FLAG_KEY_FRAME and BUFFER_FLAG_END_OF_STREAM. Value is either 0 or a combination of android.media.MediaCodec#BUFFER_FLAG_SYNC_FRAME, android.media.MediaCodec#BUFFER_FLAG_KEY_FRAME, android.media.MediaCodec#BUFFER_FLAG_CODEC_CONFIG, android.media.MediaCodec#BUFFER_FLAG_END_OF_STREAM, android.media.MediaCodec#BUFFER_FLAG_PARTIAL_FRAME, android.media.MediaCodec.BUFFER_FLAG_MUXER_DATA, and android.media.MediaCodec#BUFFER_FLAG_DECODE_ONLY

Properties

flags

Added in API level 16
var flags: Int

Buffer flags associated with the buffer. A combination of BUFFER_FLAG_KEY_FRAME and BUFFER_FLAG_END_OF_STREAM.

Encoded buffers that are key frames are marked with BUFFER_FLAG_KEY_FRAME.

The last output buffer corresponding to the input buffer marked with BUFFER_FLAG_END_OF_STREAM will also be marked with BUFFER_FLAG_END_OF_STREAM. In some cases this could be an empty buffer, whose sole purpose is to carry the end-of-stream marker.
Value is either 0 or a combination of android.media.MediaCodec#BUFFER_FLAG_SYNC_FRAME, android.media.MediaCodec#BUFFER_FLAG_KEY_FRAME, android.media.MediaCodec#BUFFER_FLAG_CODEC_CONFIG, android.media.MediaCodec#BUFFER_FLAG_END_OF_STREAM, android.media.MediaCodec#BUFFER_FLAG_PARTIAL_FRAME, android.media.MediaCodec.BUFFER_FLAG_MUXER_DATA, and android.media.MediaCodec#BUFFER_FLAG_DECODE_ONLY

offset

Added in API level 16
var offset: Int

The start-offset of the data in the buffer.

presentationTimeUs

Added in API level 16
var presentationTimeUs: Long

The presentation timestamp in microseconds for the buffer. This is derived from the presentation timestamp passed in with the corresponding input buffer. This should be ignored for a 0-sized buffer.

size

Added in API level 16
var size: Int

The amount of data (in bytes) in the buffer. If this is 0, the buffer has no data in it and can be discarded. The only use of a 0-size buffer is to carry the end-of-stream marker.