Skip to content

Instantly share code, notes, and snippets.

@ouchadam
Created January 25, 2016 15:18
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ouchadam/876aa29b80752ecaaa08 to your computer and use it in GitHub Desktop.
Save ouchadam/876aa29b80752ecaaa08 to your computer and use it in GitHub Desktop.
exoplayer x86 hack
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