MediaCodec.Callback

public static abstract class MediaCodec.Callback
extends Object

java.lang.Object
   ↳ android.media.MediaCodec.Callback


MediaCodec callback interface. Used to notify the user asynchronously of various MediaCodec events.

Summary

Public constructors

Callback()

Public methods

void onCryptoError(MediaCodec codec, MediaCodec.CryptoException e)

Called only when MediaCodec encountered a crypto(decryption) error when using a decoder configured with CONFIGURE_FLAG_USE_CRYPTO_ASYNC flag along with crypto or descrambler object.

abstract void onError(MediaCodec codec, MediaCodec.CodecException e)

Called when the MediaCodec encountered an error

abstract void onInputBufferAvailable(MediaCodec codec, int index)

Called when an input buffer becomes available.

abstract void onOutputBufferAvailable(MediaCodec codec, int index, MediaCodec.BufferInfo info)

Called when an output buffer becomes available.

abstract void onOutputFormatChanged(MediaCodec codec, MediaFormat format)

Called when the output format has changed

Inherited methods

Public constructors

Callback

public Callback ()

Public methods

onCryptoError

Added in API level 34
public void onCryptoError (MediaCodec codec, 
                MediaCodec.CryptoException e)

Called only when MediaCodec encountered a crypto(decryption) error when using a decoder configured with CONFIGURE_FLAG_USE_CRYPTO_ASYNC flag along with crypto or descrambler object.

Parameters
codec MediaCodec: The MediaCodec object This value cannot be null.

e MediaCodec.CryptoException: The MediaCodec.CryptoException object with error details. This value cannot be null.

onError

Added in API level 21
public abstract void onError (MediaCodec codec, 
                MediaCodec.CodecException e)

Called when the MediaCodec encountered an error

Parameters
codec MediaCodec: The MediaCodec object. This value cannot be null.

e MediaCodec.CodecException: The MediaCodec.CodecException object describing the error. This value cannot be null.

onInputBufferAvailable

Added in API level 21
public abstract void onInputBufferAvailable (MediaCodec codec, 
                int index)

Called when an input buffer becomes available.

Parameters
codec MediaCodec: The MediaCodec object. This value cannot be null.

index int: The index of the available input buffer.

onOutputBufferAvailable

Added in API level 21
public abstract void onOutputBufferAvailable (MediaCodec codec, 
                int index, 
                MediaCodec.BufferInfo info)

Called when an output buffer becomes available.

Parameters
codec MediaCodec: The MediaCodec object. This value cannot be null.

index int: The index of the available output buffer.

info MediaCodec.BufferInfo: Info regarding the available output buffer MediaCodec.BufferInfo. This value cannot be null.

onOutputFormatChanged

Added in API level 21
public abstract void onOutputFormatChanged (MediaCodec codec, 
                MediaFormat format)

Called when the output format has changed

Parameters
codec MediaCodec: The MediaCodec object. This value cannot be null.

format MediaFormat: The new output format. This value cannot be null.