android.media.MediaCodecInfo.CodecCapabilities Java Examples
The following examples show how to use
android.media.MediaCodecInfo.CodecCapabilities.
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: MediaCodecInfo.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Creates an instance. * * @param name The name of the {@link MediaCodec}. * @param mimeType A mime type supported by the {@link MediaCodec}. * @param codecMimeType The MIME type that the codec uses for media of type {@code #mimeType}. * Equal to {@code mimeType} unless the codec is known to use a non-standard MIME type alias. * @param capabilities The capabilities of the {@link MediaCodec} for the specified mime type, or * {@code null} if not known. * @param hardwareAccelerated Whether the {@link MediaCodec} is hardware accelerated. * @param softwareOnly Whether the {@link MediaCodec} is software only. * @param vendor Whether the {@link MediaCodec} is provided by the vendor. * @param forceDisableAdaptive Whether {@link #adaptive} should be forced to {@code false}. * @param forceSecure Whether {@link #secure} should be forced to {@code true}. * @return The created instance. */ public static MediaCodecInfo newInstance( String name, String mimeType, String codecMimeType, @Nullable CodecCapabilities capabilities, boolean hardwareAccelerated, boolean softwareOnly, boolean vendor, boolean forceDisableAdaptive, boolean forceSecure) { return new MediaCodecInfo( name, mimeType, codecMimeType, capabilities, /* passthrough= */ false, hardwareAccelerated, softwareOnly, vendor, forceDisableAdaptive, forceSecure); }
Example #2
Source File: MediaCodecUtil.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
/** * Returns the name of the best decoder and its capabilities for the given mimeType. */ private static synchronized Pair<String, CodecCapabilities> getMediaCodecInfo( String mimeType, boolean secure) throws DecoderQueryException { CodecKey key = new CodecKey(mimeType, secure); if (codecs.containsKey(key)) { return codecs.get(key); } MediaCodecListCompat mediaCodecList = Util.SDK_INT >= 21 ? new MediaCodecListCompatV21(secure) : new MediaCodecListCompatV16(); Pair<String, CodecCapabilities> codecInfo = getMediaCodecInfo(key, mediaCodecList); // TODO: Verify this cannot occur on v22, and change >= to == [Internal: b/18678462]. if (secure && codecInfo == null && Util.SDK_INT >= 21) { // Some devices don't list secure decoders on API level 21. Try the legacy path. mediaCodecList = new MediaCodecListCompatV16(); codecInfo = getMediaCodecInfo(key, mediaCodecList); if (codecInfo != null) { Log.w(TAG, "MediaCodecList API didn't list secure decoder for: " + mimeType + ". Assuming: " + codecInfo.first); } } return codecInfo; }
Example #3
Source File: MediaCodecInfo.java From Telegram with GNU General Public License v2.0 | 6 votes |
private MediaCodecInfo( String name, @Nullable String mimeType, @Nullable String codecMimeType, @Nullable CodecCapabilities capabilities, boolean passthrough, boolean forceDisableAdaptive, boolean forceSecure) { this.name = Assertions.checkNotNull(name); this.mimeType = mimeType; this.codecMimeType = codecMimeType; this.capabilities = capabilities; this.passthrough = passthrough; adaptive = !forceDisableAdaptive && capabilities != null && isAdaptive(capabilities); tunneling = capabilities != null && isTunneling(capabilities); secure = forceSecure || (capabilities != null && isSecure(capabilities)); isVideo = MimeTypes.isVideo(mimeType); }
Example #4
Source File: MediaCodecInfo.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private MediaCodecInfo( String name, @Nullable String mimeType, @Nullable String codecMimeType, @Nullable CodecCapabilities capabilities, boolean passthrough, boolean forceDisableAdaptive, boolean forceSecure) { this.name = Assertions.checkNotNull(name); this.mimeType = mimeType; this.codecMimeType = codecMimeType; this.capabilities = capabilities; this.passthrough = passthrough; adaptive = !forceDisableAdaptive && capabilities != null && isAdaptive(capabilities); tunneling = capabilities != null && isTunneling(capabilities); secure = forceSecure || (capabilities != null && isSecure(capabilities)); isVideo = MimeTypes.isVideo(mimeType); }
Example #5
Source File: FimiMediaCodecInfo.java From FimiX8-RE with MIT License | 6 votes |
@TargetApi(16) public void dumpProfileLevels(String mimeType) { if (VERSION.SDK_INT >= 16) { try { CodecCapabilities caps = this.mCodecInfo.getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (!(caps == null || caps.profileLevels == null)) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel != null) { maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", new Object[]{getProfileLevelName(maxProfile, maxLevel)})); } catch (Throwable th) { Log.i(TAG, "profile-level: exception"); } } }
Example #6
Source File: FimiMediaCodecInfo.java From FimiX8-RE with MIT License | 6 votes |
@TargetApi(16) public void dumpProfileLevels(String mimeType) { if (VERSION.SDK_INT >= 16) { try { CodecCapabilities caps = this.mCodecInfo.getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (!(caps == null || caps.profileLevels == null)) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel != null) { maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", new Object[]{getProfileLevelName(maxProfile, maxLevel)})); } catch (Throwable th) { Log.i(TAG, "profile-level: exception"); } } }
Example #7
Source File: MediaCodecUtil.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
/** * @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) throws DecoderQueryException { Pair<String, CodecCapabilities> info = getMediaCodecInfo(MimeTypes.VIDEO_H264, false); 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; }
Example #8
Source File: MediaCodecUtil.java From 365browser with Apache License 2.0 | 6 votes |
/** * Returns true if the given codec supports adaptive playback (dynamic resolution change). * @param mediaCodec the codec. * @param mime MIME type that corresponds to the codec creation. * @return true if this codec and mime type combination supports adaptive playback. */ @TargetApi(Build.VERSION_CODES.KITKAT) private static boolean codecSupportsAdaptivePlayback(MediaCodec mediaCodec, String mime) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || mediaCodec == null) { return false; } try { MediaCodecInfo info = mediaCodec.getCodecInfo(); if (info.isEncoder()) { return false; } if (isAdaptivePlaybackBlacklisted(mime)) { return false; } MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilitiesForType(mime); return (capabilities != null) && capabilities.isFeatureSupported( MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback); } catch (IllegalArgumentException e) { Log.e(TAG, "Cannot retrieve codec information", e); } return false; }
Example #9
Source File: MediaCodecUtil.java From 365browser with Apache License 2.0 | 6 votes |
/** * Return an array of supported codecs and profiles. */ @CalledByNative private static Object[] getSupportedCodecProfileLevels() { CodecProfileLevelList profileLevels = new CodecProfileLevelList(); MediaCodecListHelper codecListHelper = new MediaCodecListHelper(); for (MediaCodecInfo info : codecListHelper) { for (String mime : info.getSupportedTypes()) { // On versions L and M, VP9 codecCapabilities do not advertise profile level // support. In this case, estimate the level from MediaCodecInfo.VideoCapabilities // instead. Assume VP9 is not supported before L. For more information, consult // https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html CodecCapabilities codecCapabilities = info.getCapabilitiesForType(mime); if (mime.endsWith("vp9") && Build.VERSION_CODES.LOLLIPOP <= Build.VERSION.SDK_INT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { addVp9CodecProfileLevels(profileLevels, codecCapabilities); continue; } for (CodecProfileLevel profileLevel : codecCapabilities.profileLevels) { profileLevels.addCodecProfileLevel(mime, profileLevel); } } } return profileLevels.toArray(); }
Example #10
Source File: MediaCodecUtil.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
private static boolean isAdaptive(CodecCapabilities capabilities) { if (Util.SDK_INT >= 19) { return isAdaptiveV19(capabilities); } else { return false; } }
Example #11
Source File: MediaCodecUtil.java From MediaSDK with Apache License 2.0 | 5 votes |
@Override public boolean isFeatureSupported( String feature, String mimeType, CodecCapabilities capabilities) { // Secure decoders weren't explicitly listed prior to API level 21. We assume that a secure // H264 decoder exists. return CodecCapabilities.FEATURE_SecurePlayback.equals(feature) && MimeTypes.VIDEO_H264.equals(mimeType); }
Example #12
Source File: IjkMediaCodecInfo.java From GiraffePlayer with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void dumpProfileLevels(String mimeType) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; try { CodecCapabilities caps = mCodecInfo .getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (caps != null) { if (caps.profileLevels != null) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel == null) continue; maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", getProfileLevelName(maxProfile, maxLevel))); } catch (Throwable e) { Log.i(TAG, "profile-level: exception"); } }
Example #13
Source File: MediaCodecUtils.java From webrtc_android with MIT License | 5 votes |
static Integer selectColorFormat( int[] supportedColorFormats, CodecCapabilities capabilities) { for (int supportedColorFormat : supportedColorFormats) { for (int codecColorFormat : capabilities.colorFormats) { if (codecColorFormat == supportedColorFormat) { return codecColorFormat; } } } return null; }
Example #14
Source File: MediaCodecVideoDecoderFactory.java From webrtc_android with MIT License | 5 votes |
@Override public VideoDecoder createDecoder(VideoCodecInfo codecType) { VideoCodecType type = VideoCodecType.valueOf(codecType.getName()); MediaCodecInfo info = findCodecForType(type); if (info == null) { return null; } CodecCapabilities capabilities = info.getCapabilitiesForType(type.mimeType()); return new AndroidVideoDecoder(new MediaCodecWrapperFactoryImpl(), info.getName(), type, MediaCodecUtils.selectColorFormat(MediaCodecUtils.DECODER_COLOR_FORMATS, capabilities), sharedContext); }
Example #15
Source File: MediaCodecInfo.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Creates an instance. * * @param name The name of the {@link MediaCodec}. * @param mimeType A mime type supported by the {@link MediaCodec}. * @param capabilities The capabilities of the {@link MediaCodec} for the specified mime type. * @return The created instance. */ public static MediaCodecInfo newInstance(String name, String mimeType, CodecCapabilities capabilities) { return new MediaCodecInfo( name, mimeType, capabilities, /* passthrough= */ false, /* forceDisableAdaptive= */ false, /* forceSecure= */ false); }
Example #16
Source File: MediaCodecInfo.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Creates an instance. * * @param name The name of the {@link MediaCodec}. * @param mimeType A mime type supported by the {@link MediaCodec}. * @param capabilities The capabilities of the {@link MediaCodec} for the specified mime type. * @return The created instance. */ public static MediaCodecInfo newInstance(String name, String mimeType, CodecCapabilities capabilities) { return new MediaCodecInfo( name, mimeType, capabilities, /* passthrough= */ false, /* forceDisableAdaptive= */ false, /* forceSecure= */ false); }
Example #17
Source File: IjkMediaCodecInfo.java From WliveTV with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void dumpProfileLevels(String mimeType) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; try { CodecCapabilities caps = mCodecInfo .getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (caps != null) { if (caps.profileLevels != null) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel == null) continue; maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", getProfileLevelName(maxProfile, maxLevel))); } catch (Throwable e) { Log.i(TAG, "profile-level: exception"); } }
Example #18
Source File: IjkMediaCodecInfo.java From DanDanPlayForAndroid with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void dumpProfileLevels(String mimeType) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; try { CodecCapabilities caps = mCodecInfo .getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (caps != null) { if (caps.profileLevels != null) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel == null) continue; maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", getProfileLevelName(maxProfile, maxLevel))); } catch (Throwable e) { Log.i(TAG, "profile-level: exception"); } }
Example #19
Source File: MediaCodecUtil.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public boolean isFeatureSupported( String feature, String mimeType, CodecCapabilities capabilities) { // Secure decoders weren't explicitly listed prior to API level 21. We assume that a secure // H264 decoder exists. return CodecCapabilities.FEATURE_SecurePlayback.equals(feature) && MimeTypes.VIDEO_H264.equals(mimeType); }
Example #20
Source File: CodecWrapper.java From letv with Apache License 2.0 | 5 votes |
public static int getProfile() { int maxProfile = 0; Log.d(LOG_TAG, "getProfile()->Build.VERSION.SDK_INT:" + String.valueOf(VERSION.SDK_INT)); if (VERSION.SDK_INT >= 16) { int mediaCodecListCount = MediaCodecList.getCodecCount(); for (int i = 0; i < mediaCodecListCount; i++) { MediaCodecInfo mediaCodecInfo = MediaCodecList.getCodecInfoAt(i); if (!(mediaCodecInfo.isEncoder() || mediaCodecInfo.getName().startsWith("OMX.google") || mediaCodecInfo.getName().startsWith("OMX.TI."))) { Log.d(LOG_TAG, "getProfile()->name:" + mediaCodecInfo.getName()); for (String type : mediaCodecInfo.getSupportedTypes()) { if (type.contains("avc")) { Log.d(LOG_TAG, "getProfile()->type:" + type); try { CodecCapabilities codecCapabilities = mediaCodecInfo.getCapabilitiesForType(type); for (int colorFormat : codecCapabilities.colorFormats) { Log.d(LOG_TAG, "getProfile()->Color Format: " + colorFormat + " " + colorFormatToString(colorFormat)); } for (CodecProfileLevel codecProfileLevel : codecCapabilities.profileLevels) { String level = "unknown type"; String sprofile = "unknown type"; Log.d(LOG_TAG, "getProfile()->Codec Profile Level:" + avcLevelToString(codecProfileLevel.level) + " profile:" + avcProfileToString(codecProfileLevel.profile)); if (codecProfileLevel.profile > maxProfile) { maxProfile = codecProfileLevel.profile; } } } catch (Exception e) { e.printStackTrace(); } } } } } Log.d(LOG_TAG, "getProfile()->Max profile:" + maxProfile + " " + avcProfileToString(maxProfile)); } return maxProfile; }
Example #21
Source File: IjkMediaCodecInfo.java From AndroidTvDemo with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void dumpProfileLevels(String mimeType) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; try { CodecCapabilities caps = mCodecInfo .getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (caps != null) { if (caps.profileLevels != null) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel == null) continue; maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", getProfileLevelName(maxProfile, maxLevel))); } catch (Throwable e) { Log.i(TAG, "profile-level: exception"); } }
Example #22
Source File: IjkMediaCodecInfo.java From ShareBox with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void dumpProfileLevels(String mimeType) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; try { CodecCapabilities caps = mCodecInfo .getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (caps != null) { if (caps.profileLevels != null) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel == null) continue; maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", getProfileLevelName(maxProfile, maxLevel))); } catch (Throwable e) { Log.i(TAG, "profile-level: exception"); } }
Example #23
Source File: IjkMediaCodecInfo.java From MKVideoPlayer with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void dumpProfileLevels(String mimeType) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; try { CodecCapabilities caps = mCodecInfo .getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (caps != null) { if (caps.profileLevels != null) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel == null) continue; maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", getProfileLevelName(maxProfile, maxLevel))); } catch (Throwable e) { Log.i(TAG, "profile-level: exception"); } }
Example #24
Source File: IjkMediaCodecInfo.java From LivePlayback with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void dumpProfileLevels(String mimeType) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; try { CodecCapabilities caps = mCodecInfo .getCapabilitiesForType(mimeType); int maxProfile = 0; int maxLevel = 0; if (caps != null) { if (caps.profileLevels != null) { for (CodecProfileLevel profileLevel : caps.profileLevels) { if (profileLevel == null) continue; maxProfile = Math.max(maxProfile, profileLevel.profile); maxLevel = Math.max(maxLevel, profileLevel.level); } } } Log.i(TAG, String.format(Locale.US, "%s", getProfileLevelName(maxProfile, maxLevel))); } catch (Throwable e) { Log.i(TAG, "profile-level: exception"); } }
Example #25
Source File: MediaCodecUtil.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
private static Pair<String, CodecCapabilities> getMediaCodecInfo(CodecKey key, MediaCodecListCompat mediaCodecList) throws DecoderQueryException { try { return getMediaCodecInfoInternal(key, mediaCodecList); } catch (Exception e) { // If the underlying mediaserver is in a bad state, we may catch an IllegalStateException // or an IllegalArgumentException here. throw new DecoderQueryException(e); } }
Example #26
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 #27
Source File: MediaCodecUtil.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public boolean isSecurePlaybackSupported(String mimeType, CodecCapabilities capabilities) { // Secure decoders weren't explicitly listed prior to API level 21. We assume that a secure // H264 decoder exists. return MimeTypes.VIDEO_H264.equals(mimeType); }
Example #28
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; }
Example #29
Source File: IjkMediaCodecInfo.java From AndroidTvDemo 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 #30
Source File: MediaCodecInfo.java From MediaSDK with Apache License 2.0 | 4 votes |
private static boolean isTunneling(CodecCapabilities capabilities) { return Util.SDK_INT >= 21 && isTunnelingV21(capabilities); }