List of usage examples for android.media MediaCodecList getCodecInfoAt
public static final MediaCodecInfo getCodecInfoAt(int index)
From source file:Main.java
public 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; }/*from w ww . j a v a 2 s . com*/ String[] types = codecInfo.getSupportedTypes(); for (int j = 0; j < types.length; j++) { if (types[j].equalsIgnoreCase(mimeType)) { return codecInfo; } } } return null; }
From source file:Main.java
/** * Returns the first codec capable of encoding the specified MIME type, or null if no * match was found.//from w ww . j av a2 s . c o m * * @param mimeType String * @return MediaCodecInfo */ public 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 (String type : types) { if (type.equalsIgnoreCase(mimeType)) { return codecInfo; } } } return null; }