doInit abstract method

int doInit(
  1. CodecBufferHolder<P, CB> inputBufferHolder,
  2. CodecBufferHolder<P, CB> outputBufferHolder,
  3. List<int> bytes,
  4. int start,
  5. int end,
)

Subclass Responsibility: Init the filter

Some algorithms, such as decoders, will need to read header information from the initial bytes before processing data should begin. This information may be needed to appropriately size the output buffer. This is why a CodecBufferHolder is provided instead of the CodecBuffer itself. It gives implementers a chance to provide appropriate constraints on the input/output buffer sizes BEFORE the buffers are created.

Other algorithms, such as encoders, can use this hook to write initial header information to the outputBufferHolder buffer.

The framework needs to be able to detect how much was read from bytes and the caller should return this value. If bytes does not need to be read, then return 0.

Afterwards, this filter will transition from the CodecFilterState.init to the CodecFilterState.processing state.

Return the number of bytes read from the bytes.

Implementation

int doInit(
    CodecBufferHolder<P, CB> inputBufferHolder,
    CodecBufferHolder<P, CB> outputBufferHolder,
    List<int> bytes,
    int start,
    int end);