Loading media/java/android/media/MediaCodecInfo.java +24 −2 Original line number Diff line number Diff line Loading @@ -182,10 +182,15 @@ public final class MediaCodecInfo { public String mName; public int mValue; public boolean mDefault; public boolean mInternal; public Feature(String name, int value, boolean def) { this(name, value, def, false /* internal */); } public Feature(String name, int value, boolean def, boolean internal) { mName = name; mValue = value; mDefault = def; mInternal = internal; } } Loading Loading @@ -578,6 +583,11 @@ public final class MediaCodecInfo { */ public static final String FEATURE_LowLatency = "low-latency"; /** * Do not include in REGULAR_CODECS list in MediaCodecList. */ private static final String FEATURE_SpecialCodec = "special-codec"; /** * <b>video encoder only</b>: codec supports quantization parameter bounds. * @see MediaFormat#KEY_VIDEO_QP_MAX Loading Loading @@ -616,6 +626,8 @@ public final class MediaCodecInfo { new Feature(FEATURE_MultipleFrames, (1 << 5), false), new Feature(FEATURE_DynamicTimestamp, (1 << 6), false), new Feature(FEATURE_LowLatency, (1 << 7), true), // feature to exclude codec from REGULAR codec list new Feature(FEATURE_SpecialCodec, (1 << 30), false, true), }; private static final Feature[] encoderFeatures = { Loading @@ -623,6 +635,8 @@ public final class MediaCodecInfo { new Feature(FEATURE_MultipleFrames, (1 << 1), false), new Feature(FEATURE_DynamicTimestamp, (1 << 2), false), new Feature(FEATURE_QpBounds, (1 << 3), false), // feature to exclude codec from REGULAR codec list new Feature(FEATURE_SpecialCodec, (1 << 30), false, true), }; /** @hide */ Loading @@ -630,8 +644,10 @@ public final class MediaCodecInfo { Feature[] features = getValidFeatures(); String[] res = new String[features.length]; for (int i = 0; i < res.length; i++) { if (!features[i].mInternal) { res[i] = features[i].mName; } } return res; } Loading Loading @@ -778,6 +794,10 @@ public final class MediaCodecInfo { // check feature support for (Feature feat: getValidFeatures()) { if (feat.mInternal) { continue; } Integer yesNo = (Integer)map.get(MediaFormat.KEY_FEATURE_ + feat.mName); if (yesNo == null) { continue; Loading Loading @@ -1091,7 +1111,9 @@ public final class MediaCodecInfo { mFlagsRequired |= feat.mValue; } mFlagsSupported |= feat.mValue; if (!feat.mInternal) { mDefaultFormat.setInteger(key, 1); } // TODO restrict features by mFlagsVerified once all codecs reliably verify them } } Loading Loading
media/java/android/media/MediaCodecInfo.java +24 −2 Original line number Diff line number Diff line Loading @@ -182,10 +182,15 @@ public final class MediaCodecInfo { public String mName; public int mValue; public boolean mDefault; public boolean mInternal; public Feature(String name, int value, boolean def) { this(name, value, def, false /* internal */); } public Feature(String name, int value, boolean def, boolean internal) { mName = name; mValue = value; mDefault = def; mInternal = internal; } } Loading Loading @@ -578,6 +583,11 @@ public final class MediaCodecInfo { */ public static final String FEATURE_LowLatency = "low-latency"; /** * Do not include in REGULAR_CODECS list in MediaCodecList. */ private static final String FEATURE_SpecialCodec = "special-codec"; /** * <b>video encoder only</b>: codec supports quantization parameter bounds. * @see MediaFormat#KEY_VIDEO_QP_MAX Loading Loading @@ -616,6 +626,8 @@ public final class MediaCodecInfo { new Feature(FEATURE_MultipleFrames, (1 << 5), false), new Feature(FEATURE_DynamicTimestamp, (1 << 6), false), new Feature(FEATURE_LowLatency, (1 << 7), true), // feature to exclude codec from REGULAR codec list new Feature(FEATURE_SpecialCodec, (1 << 30), false, true), }; private static final Feature[] encoderFeatures = { Loading @@ -623,6 +635,8 @@ public final class MediaCodecInfo { new Feature(FEATURE_MultipleFrames, (1 << 1), false), new Feature(FEATURE_DynamicTimestamp, (1 << 2), false), new Feature(FEATURE_QpBounds, (1 << 3), false), // feature to exclude codec from REGULAR codec list new Feature(FEATURE_SpecialCodec, (1 << 30), false, true), }; /** @hide */ Loading @@ -630,8 +644,10 @@ public final class MediaCodecInfo { Feature[] features = getValidFeatures(); String[] res = new String[features.length]; for (int i = 0; i < res.length; i++) { if (!features[i].mInternal) { res[i] = features[i].mName; } } return res; } Loading Loading @@ -778,6 +794,10 @@ public final class MediaCodecInfo { // check feature support for (Feature feat: getValidFeatures()) { if (feat.mInternal) { continue; } Integer yesNo = (Integer)map.get(MediaFormat.KEY_FEATURE_ + feat.mName); if (yesNo == null) { continue; Loading Loading @@ -1091,7 +1111,9 @@ public final class MediaCodecInfo { mFlagsRequired |= feat.mValue; } mFlagsSupported |= feat.mValue; if (!feat.mInternal) { mDefaultFormat.setInteger(key, 1); } // TODO restrict features by mFlagsVerified once all codecs reliably verify them } } Loading