Skip to content

Most visited

Recently visited

navigation

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

MediaCodec.Callback()

Public methods

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

From class java.lang.Object

Public constructors

MediaCodec.Callback

added in API level 21
MediaCodec.Callback ()

Public methods

onError

added in API level 21
void onError (MediaCodec codec, 
                MediaCodec.CodecException e)

Called when the MediaCodec encountered an error

Parameters
codec MediaCodec: The MediaCodec object.

This value must never be null.

e MediaCodec.CodecException: The MediaCodec.CodecException object describing the error.

This value must never be null.

onInputBufferAvailable

added in API level 21
void onInputBufferAvailable (MediaCodec codec, 
                int index)

Called when an input buffer becomes available.

Parameters
codec MediaCodec: The MediaCodec object.

This value must never be null.

index int: The index of the available input buffer.

onOutputBufferAvailable

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

Called when an output buffer becomes available.

Parameters
codec MediaCodec: The MediaCodec object.

This value must never be null.

index int: The index of the available output buffer.

info MediaCodec.BufferInfo: Info regarding the available output buffer MediaCodec.BufferInfo.

This value must never be null.

onOutputFormatChanged

added in API level 21
void onOutputFormatChanged (MediaCodec codec, 
                MediaFormat format)

Called when the output format has changed

Parameters
codec MediaCodec: The MediaCodec object.

This value must never be null.

format MediaFormat: The new output format.

This value must never be null.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)