Created
January 25, 2016 15:18
-
-
Save ouchadam/876aa29b80752ecaaa08 to your computer and use it in GitHub Desktop.
exoplayer x86 hack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
Log.e("!!!", " --------- secure explicit? : " + secureDecodersExplicit); | |
for (int i = 0; i < numberOfCodecs; i++) { | |
MediaCodecInfo info = mediaCodecList.getCodecInfoAt(i); | |
String codecName = info.getName(); | |
Log.e("!!!", "codec name : " + codecName); | |
if (codecName.equals("OMX.Intel.hw_vd.h264.secure")) { | |
codecName = "OMX.Intel.hw_vd.h264"; | |
} | |
if (codecName.equals("OMX.Intel.VideoDecoder.AVC.secure")) { | |
codecName = "OMX.Intel.VideoDecoder.AVC"; | |
} | |
if (isCodecUsableDecoder(info, codecName, secureDecodersExplicit)) { | |
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) { | |
// Log.e("!!!", "adding secure : " + codecName); | |
// 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); | |
} | |
} | |
} | |
} | |
} | |
Log.e("!!!", " --------- "); | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment