Android Guides | Samples

Android.Media.MediaCodecInfo Class

Provides information about a given media codec available on the device.

See Also: MediaCodecInfo

Syntax

[Android.Runtime.Register("android/media/MediaCodecInfo", DoNotGenerateAcw=true)]
public sealed class MediaCodecInfo : Object

Remarks

Provides information about a given media codec available on the device. You can iterate through all codecs available by querying MediaCodecList. For example, here's how to find an encoder that supports a given MIME type:

java Example

 private static MediaCodecInfo selectCodec(String mimeType) {
     int numCodecs = MediaCodecList.getCodecCount();
     for (int i = 0; i < numCodecs; i++) {
         MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);

         if (!codecInfo.isEncoder()) {
             continue;
         }

         String[] types = codecInfo.getSupportedTypes();
         for (int j = 0; j < types.length; j++) {
             if (types[j].equalsIgnoreCase(mimeType)) {
                 return codecInfo;
             }
         }
     }
     return null;
 }

[Android Documentation]

Requirements

Namespace: Android.Media
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.Media.MediaCodecInfo are listed below.

See Also: Object

Public Properties

[read-only]
IsEncoderBoolean. Query if the codec is an encoder.
[read-only]
NameString. Retrieve the codec name.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

GetCapabilitiesForType(String) : MediaCodecInfo+CodecCapabilities
Enumerates the capabilities of the codec component.
GetSupportedTypes() : String[]
Query the media types supported by the codec.