am 1bab5064: Merge "MediaCodecInfo.java: Added isFeatureSupported method to CodecCapabilities" into klp-dev

* commit '1bab5064eb907e369a14903a3888847f1dae63a0':
  MediaCodecInfo.java: Added isFeatureSupported method to CodecCapabilities
This commit is contained in:
Lajos Molnar
2013-08-13 18:34:46 -07:00
committed by Android Git Automerger
3 changed files with 29 additions and 2 deletions

View File

@@ -12125,6 +12125,7 @@ package android.media {
public static final class MediaCodecInfo.CodecCapabilities { public static final class MediaCodecInfo.CodecCapabilities {
ctor public MediaCodecInfo.CodecCapabilities(); ctor public MediaCodecInfo.CodecCapabilities();
method public final boolean isFeatureSupported(java.lang.String);
field public static final int COLOR_Format12bitRGB444 = 3; // 0x3 field public static final int COLOR_Format12bitRGB444 = 3; // 0x3
field public static final int COLOR_Format16bitARGB1555 = 5; // 0x5 field public static final int COLOR_Format16bitARGB1555 = 5; // 0x5
field public static final int COLOR_Format16bitARGB4444 = 4; // 0x4 field public static final int COLOR_Format16bitARGB4444 = 4; // 0x4
@@ -12171,6 +12172,7 @@ package android.media {
field public static final int COLOR_FormatYUV444Interleaved = 29; // 0x1d field public static final int COLOR_FormatYUV444Interleaved = 29; // 0x1d
field public static final int COLOR_QCOM_FormatYUV420SemiPlanar = 2141391872; // 0x7fa30c00 field public static final int COLOR_QCOM_FormatYUV420SemiPlanar = 2141391872; // 0x7fa30c00
field public static final int COLOR_TI_FormatYUV420PackedSemiPlanar = 2130706688; // 0x7f000100 field public static final int COLOR_TI_FormatYUV420PackedSemiPlanar = 2130706688; // 0x7f000100
field public static final java.lang.String FEATURE_AdaptivePlayback = "adaptive-playback";
field public int[] colorFormats; field public int[] colorFormats;
field public android.media.MediaCodecInfo.CodecProfileLevel[] profileLevels; field public android.media.MediaCodecInfo.CodecProfileLevel[] profileLevels;
} }

View File

@@ -72,7 +72,8 @@ public final class MediaCodecInfo {
/** /**
* Encapsulates the capabilities of a given codec component. * Encapsulates the capabilities of a given codec component.
* For example, what profile/level combinations it supports and what colorspaces * For example, what profile/level combinations it supports and what colorspaces
* it is capable of providing the decoded data in. * it is capable of providing the decoded data in, as well as some
* codec-type specific capability flags.
* <p>You can get an instance for a given {@link MediaCodecInfo} object with * <p>You can get an instance for a given {@link MediaCodecInfo} object with
* {@link MediaCodecInfo#getCapabilitiesForType getCapabilitiesForType()}, passing a MIME type. * {@link MediaCodecInfo#getCapabilitiesForType getCapabilitiesForType()}, passing a MIME type.
*/ */
@@ -139,6 +140,24 @@ public final class MediaCodecInfo {
* OMX_COLOR_FORMATTYPE. * OMX_COLOR_FORMATTYPE.
*/ */
public int[] colorFormats; public int[] colorFormats;
private final static int FLAG_SupportsAdaptivePlayback = (1 << 0);
private int flags;
/**
* <b>video decoder only</b>: codec supports seamless resolution changes.
*/
public final static String FEATURE_AdaptivePlayback = "adaptive-playback";
/**
* Query codec feature capabilities.
*/
public final boolean isFeatureSupported(String name) {
if (name.equals(FEATURE_AdaptivePlayback)) {
return (flags & FLAG_SupportsAdaptivePlayback) != 0;
}
return false;
}
}; };
/** /**

View File

@@ -110,10 +110,11 @@ static jobject android_media_MediaCodecList_getCodecCapabilities(
Vector<MediaCodecList::ProfileLevel> profileLevels; Vector<MediaCodecList::ProfileLevel> profileLevels;
Vector<uint32_t> colorFormats; Vector<uint32_t> colorFormats;
uint32_t flags;
status_t err = status_t err =
MediaCodecList::getInstance()->getCodecCapabilities( MediaCodecList::getInstance()->getCodecCapabilities(
index, typeStr, &profileLevels, &colorFormats); index, typeStr, &profileLevels, &colorFormats, &flags);
env->ReleaseStringUTFChars(type, typeStr); env->ReleaseStringUTFChars(type, typeStr);
typeStr = NULL; typeStr = NULL;
@@ -127,6 +128,9 @@ static jobject android_media_MediaCodecList_getCodecCapabilities(
env->FindClass("android/media/MediaCodecInfo$CodecCapabilities"); env->FindClass("android/media/MediaCodecInfo$CodecCapabilities");
CHECK(capsClazz != NULL); CHECK(capsClazz != NULL);
jfieldID flagsField =
env->GetFieldID(capsClazz, "flags", "I");
jobject caps = env->AllocObject(capsClazz); jobject caps = env->AllocObject(capsClazz);
jclass profileLevelClazz = jclass profileLevelClazz =
@@ -163,6 +167,8 @@ static jobject android_media_MediaCodecList_getCodecCapabilities(
env->SetObjectField(caps, profileLevelsField, profileLevelArray); env->SetObjectField(caps, profileLevelsField, profileLevelArray);
env->SetIntField(caps, flagsField, flags);
env->DeleteLocalRef(profileLevelArray); env->DeleteLocalRef(profileLevelArray);
profileLevelArray = NULL; profileLevelArray = NULL;