am 7b5bcc68: am 89315051: am 00352e1e: Merge "MediaCodecInfo: allow getting info for secure codec" into lmp-dev

* commit '7b5bcc68fd16be733a557931d78829c3ab9ce7ea':
  MediaCodecInfo: allow getting info for secure codec
This commit is contained in:
Lajos Molnar
2014-09-05 23:32:31 +00:00
committed by Android Git Automerger
3 changed files with 14 additions and 8 deletions

View File

@@ -1622,8 +1622,7 @@ final public class MediaCodec {
* @throws IllegalStateException if in the Uninitialized state.
*/
public MediaCodecInfo getCodecInfo() {
return MediaCodecList.getCodecInfoAt(
MediaCodecList.findCodecByName(getName()));
return MediaCodecList.getInfoFor(getName());
}
private native final ByteBuffer[] getBuffers(boolean input);

View File

@@ -322,6 +322,9 @@ public final class MediaCodecInfo {
// check feature support
for (Feature feat: getValidFeatures()) {
Integer yesNo = (Integer)map.get(MediaFormat.KEY_FEATURE_ + feat.mName);
if (yesNo == null) {
continue;
}
if ((yesNo == 1 && !isFeatureSupported(feat.mName)) ||
(yesNo == 0 && isFeatureRequired(feat.mName))) {
return false;
@@ -471,13 +474,12 @@ public final class MediaCodecInfo {
Integer yesNo = (Integer)map.get(key);
if (yesNo == null) {
continue;
} else if (yesNo > 0) {
mFlagsRequired |= feat.mValue;
mDefaultFormat.setInteger(key, 1);
} else {
mFlagsSupported |= feat.mValue;
mDefaultFormat.setInteger(key, 1);
}
if (yesNo > 0) {
mFlagsRequired |= feat.mValue;
}
mFlagsSupported |= feat.mValue;
mDefaultFormat.setInteger(key, 1);
// TODO restrict features by mFlagsVerified once all codecs reliably verify them
}
}

View File

@@ -116,6 +116,11 @@ final public class MediaCodecList {
/* package private */ static native final int findCodecByName(String codec);
/** @hide */
public static MediaCodecInfo getInfoFor(String codec) {
return sAllCodecInfos[findCodecByName(codec)];
}
private static native final void native_init();
/**