NalUnitTargetBuffer


@UnstableApi
public final class NalUnitTargetBuffer


A buffer that fills itself with data corresponding to a specific NAL unit, as it is encountered in the stream.

Summary

Public fields

boolean
byte[]
int

Public constructors

NalUnitTargetBuffer(int targetType, int initialCapacity)

Creates the buffer.

Public methods

void
appendToNalUnit(byte[] data, int offset, int limit)

Called to pass stream data.

boolean
endNalUnit(int discardPadding)

Called to indicate that a NAL unit has ended.

boolean

Returns whether the buffer currently holds a complete NAL unit of the target type.

void

Resets the buffer, clearing any data that it holds.

void
startNalUnit(int type)

Called to indicate that a NAL unit has started.

Public fields

isCompleted

public boolean isCompleted

nalData

public byte[] nalData

nalLength

public int nalLength

Public constructors

NalUnitTargetBuffer

public NalUnitTargetBuffer(int targetType, int initialCapacity)

Creates the buffer.

Parameters
int targetType

The type of the NAL unit.

int initialCapacity

The initial capacity of the buffer in bytes.

Public methods

appendToNalUnit

public void appendToNalUnit(byte[] data, int offset, int limit)

Called to pass stream data. The data passed should not include the 3 byte start code.

Parameters
byte[] data

Holds the data being passed.

int offset

The offset of the data in data.

int limit

The limit (exclusive) of the data in data.

endNalUnit

public boolean endNalUnit(int discardPadding)

Called to indicate that a NAL unit has ended.

Parameters
int discardPadding

The number of excess bytes that were passed to appendToNalUnit, which should be discarded.

Returns
boolean

Whether the ended NAL unit is of the target type.

isCompleted

public boolean isCompleted()

Returns whether the buffer currently holds a complete NAL unit of the target type.

reset

public void reset()

Resets the buffer, clearing any data that it holds.

startNalUnit

public void startNalUnit(int type)

Called to indicate that a NAL unit has started.

Parameters
int type

The type of the NAL unit.