Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bab5064 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

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

parents 3fbaf5a6 80c4437e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12125,6 +12125,7 @@ package android.media {
  public static final class 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_Format16bitARGB1555 = 5; // 0x5
    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_QCOM_FormatYUV420SemiPlanar = 2141391872; // 0x7fa30c00
    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 android.media.MediaCodecInfo.CodecProfileLevel[] profileLevels;
  }
+20 −1
Original line number Diff line number Diff line
@@ -72,7 +72,8 @@ public final class MediaCodecInfo {
    /**
     * Encapsulates the capabilities of a given codec component.
     * 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
     * {@link MediaCodecInfo#getCapabilitiesForType getCapabilitiesForType()}, passing a MIME type.
     */
@@ -139,6 +140,24 @@ public final class MediaCodecInfo {
         * OMX_COLOR_FORMATTYPE.
         */
        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;
        }
    };

    /**
+7 −1
Original line number Diff line number Diff line
@@ -110,10 +110,11 @@ static jobject android_media_MediaCodecList_getCodecCapabilities(

    Vector<MediaCodecList::ProfileLevel> profileLevels;
    Vector<uint32_t> colorFormats;
    uint32_t flags;

    status_t err =
        MediaCodecList::getInstance()->getCodecCapabilities(
                index, typeStr, &profileLevels, &colorFormats);
                index, typeStr, &profileLevels, &colorFormats, &flags);

    env->ReleaseStringUTFChars(type, typeStr);
    typeStr = NULL;
@@ -127,6 +128,9 @@ static jobject android_media_MediaCodecList_getCodecCapabilities(
        env->FindClass("android/media/MediaCodecInfo$CodecCapabilities");
    CHECK(capsClazz != NULL);

    jfieldID flagsField =
        env->GetFieldID(capsClazz, "flags", "I");

    jobject caps = env->AllocObject(capsClazz);

    jclass profileLevelClazz =
@@ -163,6 +167,8 @@ static jobject android_media_MediaCodecList_getCodecCapabilities(

    env->SetObjectField(caps, profileLevelsField, profileLevelArray);

    env->SetIntField(caps, flagsField, flags);

    env->DeleteLocalRef(profileLevelArray);
    profileLevelArray = NULL;