Share via


MediaCodec.Configure Method

Definition

Overloads

Configure(MediaFormat, Surface, MediaCrypto, MediaCodecConfigFlags)

Configures a component.

Configure(MediaFormat, Surface, MediaCodecConfigFlags, MediaDescrambler)

Configure a component to be used with a descrambler.

Configure(MediaFormat, Surface, MediaCrypto, MediaCodecConfigFlags)

Configures a component.

[Android.Runtime.Register("configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V", "")]
public void Configure (Android.Media.MediaFormat? format, Android.Views.Surface? surface, Android.Media.MediaCrypto? crypto, Android.Media.MediaCodecConfigFlags flags);
[<Android.Runtime.Register("configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V", "")>]
member this.Configure : Android.Media.MediaFormat * Android.Views.Surface * Android.Media.MediaCrypto * Android.Media.MediaCodecConfigFlags -> unit

Parameters

format
MediaFormat

The format of the input data (decoder) or the desired format of the output data (encoder). Passing null as format is equivalent to passing an MediaFormat#MediaFormat an empty mediaformat.

surface
Surface

Specify a surface on which to render the output of this decoder. Pass null as surface if the codec does not generate raw video output (e.g. not a video decoder) and/or if you want to configure the codec for ByteBuffer output.

crypto
MediaCrypto

Specify a crypto object to facilitate secure decryption of the media data. Pass null as crypto for non-secure codecs. Please note that MediaCodec does NOT take ownership of the MediaCrypto object; it is the application's responsibility to properly cleanup the MediaCrypto object when not in use.

flags
MediaCodecConfigFlags

Specify #CONFIGURE_FLAG_ENCODE to configure the component as an encoder.

Attributes

Exceptions

if the surface has been released (or is invalid), or the format is unacceptable (e.g. missing a mandatory key), or the flags are not set properly (e.g. missing ConfigureFlagEncode for an encoder).

if not in the Uninitialized state.

upon DRM error.

upon codec error.

Remarks

Configures a component.

Java documentation for android.media.MediaCodec.configure(android.media.MediaFormat, android.view.Surface, android.media.MediaCrypto, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Configure(MediaFormat, Surface, MediaCodecConfigFlags, MediaDescrambler)

Configure a component to be used with a descrambler.

[Android.Runtime.Register("configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;ILandroid/media/MediaDescrambler;)V", "", ApiSince=26)]
public void Configure (Android.Media.MediaFormat? format, Android.Views.Surface? surface, Android.Media.MediaCodecConfigFlags flags, Android.Media.MediaDescrambler? descrambler);
[<Android.Runtime.Register("configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;ILandroid/media/MediaDescrambler;)V", "", ApiSince=26)>]
member this.Configure : Android.Media.MediaFormat * Android.Views.Surface * Android.Media.MediaCodecConfigFlags * Android.Media.MediaDescrambler -> unit

Parameters

format
MediaFormat

The format of the input data (decoder) or the desired format of the output data (encoder). Passing null as format is equivalent to passing an MediaFormat#MediaFormat an empty mediaformat.

surface
Surface

Specify a surface on which to render the output of this decoder. Pass null as surface if the codec does not generate raw video output (e.g. not a video decoder) and/or if you want to configure the codec for ByteBuffer output.

flags
MediaCodecConfigFlags

Specify #CONFIGURE_FLAG_ENCODE to configure the component as an encoder.

descrambler
MediaDescrambler

Specify a descrambler object to facilitate secure descrambling of the media data, or null for non-secure codecs.

Attributes

Remarks

Configure a component to be used with a descrambler.

Java documentation for android.media.MediaCodec.configure(android.media.MediaFormat, android.view.Surface, int, android.media.MediaDescrambler).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to