本文整理汇总了Java中android.media.MediaCodecInfo.getName方法的典型用法代码示例。如果您正苦于以下问题:Java MediaCodecInfo.getName方法的具体用法?Java MediaCodecInfo.getName怎么用?Java MediaCodecInfo.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.MediaCodecInfo
的用法示例。
在下文中一共展示了MediaCodecInfo.getName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
/**
* Initialize HeifReader module.
*
* @param context Context.
*/
public static void initialize(Context context) {
mRenderScript = RenderScript.create(context);
mCacheDir = context.getCacheDir();
// find best HEVC decoder
mDecoderName = null;
mDecoderSupportedSize = new Size(0, 0);
int numCodecs = MediaCodecList.getCodecCount();
for (int i = 0; i < numCodecs; i++) {
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
if (codecInfo.isEncoder()) {
continue;
}
for (String type : codecInfo.getSupportedTypes()) {
if (type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_HEVC)) {
MediaCodecInfo.CodecCapabilities cap = codecInfo.getCapabilitiesForType(MediaFormat.MIMETYPE_VIDEO_HEVC);
MediaCodecInfo.VideoCapabilities vcap = cap.getVideoCapabilities();
Size supportedSize = new Size(vcap.getSupportedWidths().getUpper(), vcap.getSupportedHeights().getUpper());
Log.d(TAG, "HEVC decoder=\"" + codecInfo.getName() + "\""
+ " supported-size=" + supportedSize
+ " color-formats=" + Arrays.toString(cap.colorFormats)
);
if (mDecoderSupportedSize.getWidth() * mDecoderSupportedSize.getHeight() < supportedSize.getWidth() * supportedSize.getHeight()) {
mDecoderName = codecInfo.getName();
mDecoderSupportedSize = supportedSize;
}
}
}
}
if (mDecoderName == null) {
throw new RuntimeException("no HEVC decoding support");
}
Log.i(TAG, "HEVC decoder=\"" + mDecoderName + "\" supported-size=" + mDecoderSupportedSize);
}
示例2: FindHardWareEncoder16
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
private static String FindHardWareEncoder16(String mime) {
int mediaCodecCount = MediaCodecList.getCodecCount();
for (int i = 0; i < mediaCodecCount; i++) {
MediaCodecInfo mediaCodecInfo = MediaCodecList.getCodecInfoAt(i);
if (!mediaCodecInfo.isEncoder()) {
continue;
}
String types[] = mediaCodecInfo.getSupportedTypes();
for (int j = 0; j < types.length; j++) {
if (types[j].equalsIgnoreCase(mime)) {
String decoderName = mediaCodecInfo.getName();
Log.e(ERROR_TAGE, "hwDecoderName = " + decoderName);
boolean isHardwareEncode = (decoderName.indexOf("google") == -1);
if (isHardwareEncode) {
return decoderName;
}
}
}
}
return null;
}
示例3: FindHardWareEncoder21
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
private static String FindHardWareEncoder21(String mime) {
MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
MediaCodecInfo[] mediaCodecInfos = mediaCodecList.getCodecInfos();
for (int i = 0; i < mediaCodecInfos.length; i++) {
MediaCodecInfo mediaCodecInfo = mediaCodecInfos[i];
if (!mediaCodecInfo.isEncoder()) {
continue;
}
String types[] = mediaCodecInfo.getSupportedTypes();
for (int j = 0; j < types.length; j++) {
if (types[j].equalsIgnoreCase(mime)) {
String decoderName = mediaCodecInfo.getName();
Log.e(TAG, "hwDecoderName = " + decoderName);
boolean isHardwareEncode = (decoderName.indexOf("google") == -1);
if (isHardwareEncode) {
return decoderName;
}
}
}
}
return null;
}
示例4: isHardwareSupported
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
private boolean isHardwareSupported(MediaCodecInfo info, VideoCodecType type) {
String name = info.getName();
switch (type) {
case VP8:
// QCOM, Intel, Exynos, and Nvidia all supported for VP8.
return name.startsWith(QCOM_PREFIX) || name.startsWith(INTEL_PREFIX)
|| name.startsWith(EXYNOS_PREFIX) || name.startsWith(NVIDIA_PREFIX);
case VP9:
// QCOM and Exynos supported for VP9.
return name.startsWith(QCOM_PREFIX) || name.startsWith(EXYNOS_PREFIX);
case H264:
// QCOM, Intel, and Exynos supported for H264.
return name.startsWith(QCOM_PREFIX) || name.startsWith(INTEL_PREFIX)
|| name.startsWith(EXYNOS_PREFIX);
default:
return false;
}
}
示例5: createEncoder
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
@Override
public VideoEncoder createEncoder(VideoCodecInfo input) {
VideoCodecType type = VideoCodecType.valueOf(input.name);
MediaCodecInfo info = findCodecForType(type);
if (info == null) {
return null; // No support for this type.
}
String codecName = info.getName();
String mime = type.mimeType();
Integer surfaceColorFormat = MediaCodecUtils.selectColorFormat(
MediaCodecUtils.TEXTURE_COLOR_FORMATS, info.getCapabilitiesForType(mime));
Integer yuvColorFormat = MediaCodecUtils.selectColorFormat(
MediaCodecUtils.ENCODER_COLOR_FORMATS, info.getCapabilitiesForType(mime));
return new HardwareVideoEncoder(codecName, type, surfaceColorFormat, yuvColorFormat,
input.params, getKeyFrameIntervalSec(type), getForcedKeyFrameIntervalMs(type, codecName),
createBitrateAdjuster(type, codecName), sharedContext);
}
示例6: FindHardWareDecoder16
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public int FindHardWareDecoder16(){
String mimeType = mAVCodeIDToMime.get(mCodeId);
Log.e(TAG, "mimeType = " + mimeType + "codeid = " + mCodeId);
int mediaCodecCount = MediaCodecList.getCodecCount();
for (int i = 0; i < mediaCodecCount; i++) {
MediaCodecInfo mediaCodecInfo = MediaCodecList.getCodecInfoAt(i);
if(mediaCodecInfo.isEncoder()){
continue;
}
String types[] = mediaCodecInfo.getSupportedTypes();
for (int j = 0;j < types.length;j++){
if (types[j].equalsIgnoreCase(mimeType)){
String decoderName = mediaCodecInfo.getName();
Log.e(TAG,"hwDecoderName = " + decoderName);
if(decoderName.indexOf("google") == -1){
mHWDecoderName = decoderName;
return 1;
}
}
}
}
return 0;
}
示例7: FindHardWareDecoder21
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
public int FindHardWareDecoder21(){
String mimeType = mAVCodeIDToMime.get(mCodeId);
Log.e(TAG, "mimeType = " + mimeType + "codeid = " + mCodeId);
MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
MediaCodecInfo[] mediaCodecInfos = mediaCodecList.getCodecInfos();
for (int i = 0;i < mediaCodecInfos.length;i++){
MediaCodecInfo mediaCodecInfo = mediaCodecInfos[i];
if(mediaCodecInfo.isEncoder()){
continue;
}
String types[] = mediaCodecInfo.getSupportedTypes();
for (int j = 0;j < types.length;j++){
if (types[j].equalsIgnoreCase(mimeType)){
String decoderName = mediaCodecInfo.getName();
Log.e(TAG,"hwDecoderName = " + decoderName);
if(decoderName.indexOf("google") == -1){
mHWDecoderName = decoderName;
return 1;
}
}
}
}
return 0;
}
示例8: findCoderForFormat
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
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;
}
示例9: createDecoder
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
@Override
public VideoDecoder createDecoder(String codecType) {
VideoCodecType type = VideoCodecType.valueOf(codecType);
MediaCodecInfo info = findCodecForType(type);
if (info == null) {
return null; // No support for this codec type.
}
CodecCapabilities capabilities = info.getCapabilitiesForType(type.mimeType());
return new HardwareVideoDecoder(info.getName(), type,
MediaCodecUtils.selectColorFormat(MediaCodecUtils.DECODER_COLOR_FORMATS, capabilities),
sharedContext);
}
示例10: isHardwareSupportedInCurrentSdkVp8
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
private boolean isHardwareSupportedInCurrentSdkVp8(MediaCodecInfo info) {
String name = info.getName();
// QCOM Vp8 encoder is supported in KITKAT or later.
return (name.startsWith(QCOM_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
// Exynos VP8 encoder is supported in M or later.
|| (name.startsWith(EXYNOS_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
// Intel Vp8 encoder is supported in LOLLIPOP or later, with the intel encoder enabled.
|| (name.startsWith(INTEL_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& enableIntelVp8Encoder);
}
示例11: isHardwareSupportedInCurrentSdkH264
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
private boolean isHardwareSupportedInCurrentSdkH264(MediaCodecInfo info) {
// First, H264 hardware might perform poorly on this model.
if (H264_HW_EXCEPTION_MODELS.contains(Build.MODEL)) {
return false;
}
String name = info.getName();
// QCOM H264 encoder is supported in KITKAT or later.
return (name.startsWith(QCOM_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
// Exynos H264 encoder is supported in LOLLIPOP or later.
|| (name.startsWith(EXYNOS_PREFIX)
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
}
示例12: setupCandidate
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static IjkMediaCodecInfo setupCandidate(MediaCodecInfo codecInfo,
String mimeType) {
if (codecInfo == null
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
return null;
String name = codecInfo.getName();
if (TextUtils.isEmpty(name))
return null;
name = name.toLowerCase(Locale.US);
int rank = RANK_NO_SENSE;
if (!name.startsWith("omx.")) {
rank = RANK_NON_STANDARD;
} else if (name.startsWith("omx.pv")) {
rank = RANK_SOFTWARE;
} else if (name.startsWith("omx.google.")) {
rank = RANK_SOFTWARE;
} else if (name.startsWith("omx.ffmpeg.")) {
rank = RANK_SOFTWARE;
} else if (name.startsWith("omx.k3.ffmpeg.")) {
rank = RANK_SOFTWARE;
} else if (name.startsWith("omx.avcodec.")) {
rank = RANK_SOFTWARE;
} else if (name.startsWith("omx.ittiam.")) {
// unknown codec in qualcomm SoC
rank = RANK_NO_SENSE;
} else if (name.startsWith("omx.mtk.")) {
// 1. MTK only works on 4.3 and above
// 2. MTK works on MIUI 6 (4.2.1)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2)
rank = RANK_NO_SENSE;
else
rank = RANK_TESTED;
} else {
Integer knownRank = getKnownCodecList().get(name);
if (knownRank != null) {
rank = knownRank;
} else {
try {
CodecCapabilities cap = codecInfo
.getCapabilitiesForType(mimeType);
if (cap != null)
rank = RANK_ACCEPTABLE;
else
rank = RANK_LAST_CHANCE;
} catch (Throwable e) {
rank = RANK_LAST_CHANCE;
}
}
}
IjkMediaCodecInfo candidate = new IjkMediaCodecInfo();
candidate.mCodecInfo = codecInfo;
candidate.mRank = rank;
candidate.mMimeType = mimeType;
return candidate;
}
示例13: isHardwareSupportedInCurrentSdkVp9
import android.media.MediaCodecInfo; //导入方法依赖的package包/类
private boolean isHardwareSupportedInCurrentSdkVp9(MediaCodecInfo info) {
String name = info.getName();
return (name.startsWith(QCOM_PREFIX) || name.startsWith(EXYNOS_PREFIX))
// Both QCOM and Exynos VP9 encoders are supported in N or later.
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
}