Java Code Examples for android.media.MediaCodecInfo#getName()
The following examples show how to use
android.media.MediaCodecInfo#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaController.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@SuppressLint("NewApi") public static MediaCodecInfo selectCodec(String mimeType) { int numCodecs = MediaCodecList.getCodecCount(); MediaCodecInfo lastCodecInfo = null; 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)) { lastCodecInfo = codecInfo; String name = lastCodecInfo.getName(); if (name != null) { if (!name.equals("OMX.SEC.avc.enc")) { return lastCodecInfo; } else if (name.equals("OMX.SEC.AVC.Encoder")) { return lastCodecInfo; } } } } } return lastCodecInfo; }
Example 2
Source File: MediaCodecVideoDecoderFactory.java From webrtc_android with MIT License | 5 votes |
private boolean isSupportedCodec(MediaCodecInfo info, VideoCodecType type) { String name = info.getName(); if (!MediaCodecUtils.codecSupportsType(info, type)) { return false; } // Check for a supported color format. if (MediaCodecUtils.selectColorFormat( MediaCodecUtils.DECODER_COLOR_FORMATS, info.getCapabilitiesForType(type.mimeType())) == null) { return false; } return isCodecAllowed(info); }
Example 3
Source File: MediaCodecListCompat.java From phoenix with Apache License 2.0 | 5 votes |
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; }
Example 4
Source File: HeifReader.java From heifreader with MIT License | 5 votes |
/** * 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); }
Example 5
Source File: MediaCodecUtil.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
private static Pair<String, CodecCapabilities> getMediaCodecInfoInternal(CodecKey key, MediaCodecListCompat mediaCodecList) { String mimeType = key.mimeType; int numberOfCodecs = mediaCodecList.getCodecCount(); boolean secureDecodersExplicit = mediaCodecList.secureDecodersExplicit(); // Note: MediaCodecList is sorted by the framework such that the best decoders come first. for (int i = 0; i < numberOfCodecs; i++) { MediaCodecInfo info = mediaCodecList.getCodecInfoAt(i); String codecName = info.getName(); if (!info.isEncoder() && codecName.startsWith("OMX.") && (secureDecodersExplicit || !codecName.endsWith(".secure"))) { String[] supportedTypes = info.getSupportedTypes(); for (int j = 0; j < supportedTypes.length; j++) { String supportedType = supportedTypes[j]; if (supportedType.equalsIgnoreCase(mimeType)) { CodecCapabilities capabilities = info.getCapabilitiesForType(supportedType); boolean secure = mediaCodecList.isSecurePlaybackSupported(key.mimeType, capabilities); if (!secureDecodersExplicit) { // Cache variants for both insecure and (if we think it's supported) secure playback. codecs.put(key.secure ? new CodecKey(mimeType, false) : key, Pair.create(codecName, capabilities)); if (secure) { codecs.put(key.secure ? key : new CodecKey(mimeType, true), Pair.create(codecName + ".secure", capabilities)); } } else { // Only cache this variant. If both insecure and secure decoders are available, they // should both be listed separately. codecs.put(key.secure == secure ? key : new CodecKey(mimeType, secure), Pair.create(codecName, capabilities)); } if (codecs.containsKey(key)) { return codecs.get(key); } } } } } return null; }
Example 6
Source File: MediaCodecBridge.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Get a list of supported android codec mimes. */ @CalledByNative private static CodecInfo[] getCodecsInfo() { Map<String, CodecInfo> CodecInfoMap = new HashMap<String, CodecInfo>(); int count = MediaCodecList.getCodecCount(); for (int i = 0; i < count; ++i) { MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i); if (info.isEncoder()) { continue; } boolean secureDecoderSupported = false; String codecString = info.getName(); // ".secure" codecs sometimes crash instead of throwing on pre-JBMR2 // platforms, but this code isn't run on them anyway (MediaDrm // unavailable) so we side-step the issue. http://crbug.com/314868 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { String secureCodecName = codecString + ".secure"; try { MediaCodec secureCodec = MediaCodec.createByCodecName(secureCodecName); if (secureCodec != null) { secureDecoderSupported = true; secureCodec.release(); } } catch (Exception e) { Log.e(TAG, "Failed to create " + secureCodecName); } } String[] supportedTypes = info.getSupportedTypes(); for (int j = 0; j < supportedTypes.length; ++j) { if (!CodecInfoMap.containsKey(supportedTypes[j]) || secureDecoderSupported) { CodecInfoMap.put(supportedTypes[j], new CodecInfo( supportedTypes[j], codecString, secureDecoderSupported)); } } } return CodecInfoMap.values().toArray( new CodecInfo[CodecInfoMap.size()]); }
Example 7
Source File: MediaCodecListCompat.java From phoenix with Apache License 2.0 | 5 votes |
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; }
Example 8
Source File: MediaCodecBridge.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Get a list of supported android codec mimes. */ @CalledByNative private static CodecInfo[] getCodecsInfo() { Map<String, CodecInfo> CodecInfoMap = new HashMap<String, CodecInfo>(); int count = MediaCodecList.getCodecCount(); for (int i = 0; i < count; ++i) { MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i); if (info.isEncoder()) { continue; } boolean secureDecoderSupported = false; String codecString = info.getName(); // ".secure" codecs sometimes crash instead of throwing on pre-JBMR2 // platforms, but this code isn't run on them anyway (MediaDrm // unavailable) so we side-step the issue. http://crbug.com/314868 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { String secureCodecName = codecString + ".secure"; try { MediaCodec secureCodec = MediaCodec.createByCodecName(secureCodecName); if (secureCodec != null) { secureDecoderSupported = true; secureCodec.release(); } } catch (Exception e) { Log.e(TAG, "Failed to create " + secureCodecName); } } String[] supportedTypes = info.getSupportedTypes(); for (int j = 0; j < supportedTypes.length; ++j) { if (!CodecInfoMap.containsKey(supportedTypes[j]) || secureDecoderSupported) { CodecInfoMap.put(supportedTypes[j], new CodecInfo( supportedTypes[j], codecString, secureDecoderSupported)); } } } return CodecInfoMap.values().toArray( new CodecInfo[CodecInfoMap.size()]); }
Example 9
Source File: HardwareVideoEncoderFactory.java From webrtc_android with MIT License | 5 votes |
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); }
Example 10
Source File: HardwareVideoDecoderFactory.java From webrtc_android with MIT License | 5 votes |
@Override public boolean test(MediaCodecInfo arg) { final String name = arg.getName(); for (String prefix : prefixBlacklist) { if (name.startsWith(prefix)) { return false; } } return true; }
Example 11
Source File: PlatformSoftwareVideoDecoderFactory.java From webrtc_android with MIT License | 5 votes |
@Override public boolean test(MediaCodecInfo arg) { final String name = arg.getName(); for (String prefix : prefixWhitelist) { if (name.startsWith(prefix)) { return true; } } return false; }
Example 12
Source File: SMedia.java From NewsMe with Apache License 2.0 | 5 votes |
/** * check c name */ private String haveSEC() { try { int numCodecs = MediaCodecList.getCodecCount(); for (int i = 0; i < numCodecs; i++) { MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); if (codecInfo.isEncoder()) { continue; } String[] types = codecInfo.getSupportedTypes(); if (null == types) { break; } for (int j = 0; j < types.length; j++) { if (types[j] != null && types[j].equalsIgnoreCase(mime) && codecInfo.getName().equalsIgnoreCase( "OMX.SEC.AVC.Decoder")) { // Log.d(TAG, "find SEC," +codecInfo.getName() // +"->support type["+j+"]="+types[j]); return codecInfo.getName(); } } } } catch (Exception ex) { Log.e(TAG, "find SEC error!"); } // Log.d(TAG, "not find SEC!"); return ""; }
Example 13
Source File: IjkMediaCodecInfo.java From WliveTV with Apache License 2.0 | 4 votes |
@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; }
Example 14
Source File: IjkMediaCodecInfo.java From MediaSDK with Apache License 2.0 | 4 votes |
@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; }
Example 15
Source File: IjkMediaCodecInfo.java From IjkPlayerDemo with Apache License 2.0 | 4 votes |
@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; }
Example 16
Source File: CodecManager.java From VideoMeeting with Apache License 2.0 | 4 votes |
/** * Lists all encoders that claim to support a color format that we know how to use. * @return A list of those encoders */ @SuppressLint("NewApi") public synchronized static Codec[] findEncodersForMimeType(String mimeType) { if (sEncoders != null) return sEncoders; ArrayList<Codec> encoders = new ArrayList<Codec>(); // We loop through the encoders, apparently this can take up to a sec (testes on a GS3) for(int j = MediaCodecList.getCodecCount() - 1; j >= 0; j--){ MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(j); if (!codecInfo.isEncoder()) continue; String[] types = codecInfo.getSupportedTypes(); for (int i = 0; i < types.length; i++) { if (types[i].equalsIgnoreCase(mimeType)) { try { MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType); Set<Integer> formats = new HashSet<Integer>(); // And through the color formats supported for (int k = 0; k < capabilities.colorFormats.length; k++) { int format = capabilities.colorFormats[k]; for (int l=0;l<SUPPORTED_COLOR_FORMATS.length;l++) { if (format == SUPPORTED_COLOR_FORMATS[l]) { formats.add(format); break; } } } Codec codec = new Codec(codecInfo.getName(), (Integer[]) formats.toArray(new Integer[formats.size()])); encoders.add(codec); } catch (Exception e) { Log.wtf(TAG,e); } } } } sEncoders = (Codec[]) encoders.toArray(new Codec[encoders.size()]); if (sEncoders.length == 0) { sEncoders = new Codec[]{new Codec(null, new Integer[]{0})}; } return sEncoders; }
Example 17
Source File: IjkMediaCodecInfo.java From JZVideoDemo with MIT License | 4 votes |
@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; }
Example 18
Source File: FimiMediaCodecInfo.java From FimiX8-RE with MIT License | 4 votes |
@TargetApi(16) public static FimiMediaCodecInfo setupCandidate(MediaCodecInfo codecInfo, String mimeType) { if (codecInfo == null || VERSION.SDK_INT < 16) { 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.")) { rank = RANK_NO_SENSE; } else if (!name.startsWith("omx.mtk.")) { Integer knownRank = (Integer) getKnownCodecList().get(name); if (knownRank != null) { rank = knownRank.intValue(); } else { try { if (codecInfo.getCapabilitiesForType(mimeType) != null) { rank = RANK_ACCEPTABLE; } else { rank = RANK_LAST_CHANCE; } } catch (Throwable th) { rank = RANK_LAST_CHANCE; } } } else if (VERSION.SDK_INT < 18) { rank = RANK_NO_SENSE; } else { rank = RANK_TESTED; } FimiMediaCodecInfo candidate = new FimiMediaCodecInfo(); candidate.mCodecInfo = codecInfo; candidate.mRank = rank; candidate.mMimeType = mimeType; return candidate; }
Example 19
Source File: IjkMediaCodecInfo.java From ShareBox with Apache License 2.0 | 4 votes |
@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; }
Example 20
Source File: IjkMediaCodecInfo.java From MKVideoPlayer with MIT License | 4 votes |
@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; }