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

Commit 54c4766d authored by qiang yin's avatar qiang yin Committed by Automerger Merge Worker
Browse files

Add for Dolby thumbnail am: ed71a121 am: 3d679d88 am: b887d139

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1876132

Change-Id: I5bd848aaa06e7053906b1afef8e81827a720df6f
parents cbc2fd60 b887d139
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -225,10 +225,17 @@ sp<IMemory> StagefrightMetadataRetriever::getImageInternal(
            "media.stagefright.thumbnail.prefer_hw_codecs", false);
            "media.stagefright.thumbnail.prefer_hw_codecs", false);
    uint32_t flags = preferhw ? 0 : MediaCodecList::kPreferSoftwareCodecs;
    uint32_t flags = preferhw ? 0 : MediaCodecList::kPreferSoftwareCodecs;
    Vector<AString> matchingCodecs;
    Vector<AString> matchingCodecs;
    sp<AMessage> format = new AMessage;
    status_t err = convertMetaDataToMessage(trackMeta, &format);
    if (err != OK) {
        format = NULL;
    }

    MediaCodecList::findMatchingCodecs(
    MediaCodecList::findMatchingCodecs(
            mime,
            mime,
            false, /* encoder */
            false, /* encoder */
            flags,
            flags,
            format,
            &matchingCodecs);
            &matchingCodecs);


    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
@@ -348,11 +355,18 @@ sp<IMemory> StagefrightMetadataRetriever::getFrameInternal(
    bool preferhw = property_get_bool(
    bool preferhw = property_get_bool(
            "media.stagefright.thumbnail.prefer_hw_codecs", false);
            "media.stagefright.thumbnail.prefer_hw_codecs", false);
    uint32_t flags = preferhw ? 0 : MediaCodecList::kPreferSoftwareCodecs;
    uint32_t flags = preferhw ? 0 : MediaCodecList::kPreferSoftwareCodecs;
    sp<AMessage> format = new AMessage;
    status_t err = convertMetaDataToMessage(trackMeta, &format);
    if (err != OK) {
        format = NULL;
    }

    Vector<AString> matchingCodecs;
    Vector<AString> matchingCodecs;
    MediaCodecList::findMatchingCodecs(
    MediaCodecList::findMatchingCodecs(
            mime,
            mime,
            false, /* encoder */
            false, /* encoder */
            flags,
            flags,
            format,
            &matchingCodecs);
            &matchingCodecs);


    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
+23 −0
Original line number Original line Diff line number Diff line
@@ -509,6 +509,29 @@ bool MediaCodecList::codecHandlesFormat(const char *mime, sp<MediaCodecInfo> inf
                }
                }
            }
            }
        }
        }

        int32_t profile = -1;
        if (format->findInt32("profile", &profile)) {
            int32_t level = -1;
            format->findInt32("level", &level);
            Vector<MediaCodecInfo::ProfileLevel> profileLevels;
            capabilities->getSupportedProfileLevels(&profileLevels);
            auto it = profileLevels.begin();
            for (; it != profileLevels.end(); ++it) {
                if (profile != it->mProfile) {
                    continue;
                }
                if (level > -1 && level > it->mLevel) {
                    continue;
                }
                break;
            }

            if (it == profileLevels.end()) {
                ALOGV("Codec does not support profile %d with level %d", profile, level);
                return false;
            }
        }
    }
    }


    // haven't found a reason to discard this one
    // haven't found a reason to discard this one