use of android.media.MediaCodecInfo in project LanSoEditor_common by LanSoSdk.
the class VideoEditor method selectCodec.
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;
}
use of android.media.MediaCodecInfo in project Pix-Art-Messenger by kriztan.
the class MediaCodecListCompat method findCoderForFormat.
private String findCoderForFormat(MediaFormat format, boolean findEncoder) {
String mimeType = format.getString(MediaFormat.KEY_MIME);
Iterator<MediaCodecInfo> iterator = new MediaCodecInfoIterator();
while (iterator.hasNext()) {
MediaCodecInfo codecInfo = iterator.next();
if (codecInfo.isEncoder() != findEncoder)
continue;
if (Arrays.asList(codecInfo.getSupportedTypes()).contains(mimeType)) {
return codecInfo.getName();
}
}
return null;
}
use of android.media.MediaCodecInfo in project EasyPlayer-RTMP-Android by EasyDSS.
the class EasyPlayerClient method codecName.
private static String codecName() {
ArrayList<String> array = new ArrayList<>();
int numCodecs = MediaCodecList.getCodecCount();
for (int i1 = 0; i1 < numCodecs; i1++) {
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i1);
if (codecInfo.isEncoder()) {
continue;
}
if (codecMatch("video/avc", codecInfo)) {
String name = codecInfo.getName();
Log.d("DECODER", String.format("decoder:%s", name));
array.add(name);
}
}
// }
if (array.isEmpty()) {
return "";
}
return array.get(0);
}
use of android.media.MediaCodecInfo in project edx-app-android by edx.
the class MediaCodecUtil method isH264ProfileSupported.
/**
* @param profile An AVC profile constant from {@link CodecProfileLevel}.
* @param level An AVC profile level from {@link CodecProfileLevel}.
* @return Whether the specified profile is supported at the specified level.
*/
public static boolean isH264ProfileSupported(int profile, int level) {
Pair<MediaCodecInfo, CodecCapabilities> info = getMediaCodecInfo(MimeTypes.VIDEO_H264);
if (info == null) {
return false;
}
CodecCapabilities capabilities = info.second;
for (int i = 0; i < capabilities.profileLevels.length; i++) {
CodecProfileLevel profileLevel = capabilities.profileLevels[i];
if (profileLevel.profile == profile && profileLevel.level >= level) {
return true;
}
}
return false;
}
use of android.media.MediaCodecInfo in project edx-app-android by edx.
the class MediaCodecUtil method maxH264DecodableFrameSize.
/**
* @return the maximum frame size for an H264 stream that can be decoded on the device.
*/
public static int maxH264DecodableFrameSize() {
Pair<MediaCodecInfo, CodecCapabilities> info = getMediaCodecInfo(MimeTypes.VIDEO_H264);
if (info == null) {
return 0;
}
int maxH264DecodableFrameSize = 0;
CodecCapabilities capabilities = info.second;
for (int i = 0; i < capabilities.profileLevels.length; i++) {
CodecProfileLevel profileLevel = capabilities.profileLevels[i];
maxH264DecodableFrameSize = Math.max(avcLevelToMaxFrameSize(profileLevel.level), maxH264DecodableFrameSize);
}
return maxH264DecodableFrameSize;
}
Aggregations