Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public final class

MediaCodecInfo

extends Object
java.lang.Object
   ↳ android.media.MediaCodecInfo

Class Overview

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:

        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;
 }
       

Summary

Nested Classes
class MediaCodecInfo.CodecCapabilities Encapsulates the capabilities of a given codec component. 
class MediaCodecInfo.CodecProfileLevel Encapsulates the profiles available for a codec component. 
Public Methods
final MediaCodecInfo.CodecCapabilities getCapabilitiesForType ( String type)
Enumerates the capabilities of the codec component.
final String getName ()
Retrieve the codec name.
final String[] getSupportedTypes ()
Query the media types supported by the codec.
final boolean isEncoder ()
Query if the codec is an encoder.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public final MediaCodecInfo.CodecCapabilities getCapabilitiesForType ( String type)

Enumerates the capabilities of the codec component. Since a single component can support data of a variety of types, the type has to be specified to yield a meaningful result.

Parameters
type The MIME type to query

public final String getName ()

Retrieve the codec name.

public final String[] getSupportedTypes ()

Query the media types supported by the codec.

public final boolean isEncoder ()

Query if the codec is an encoder.