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

Commit 78b6cf84 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add for Dolby thubmnail"

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

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

    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
@@ -348,11 +355,18 @@ sp<IMemory> StagefrightMetadataRetriever::getFrameInternal(
    bool preferhw = property_get_bool(
            "media.stagefright.thumbnail.prefer_hw_codecs", false);
    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;
    MediaCodecList::findMatchingCodecs(
            mime,
            false, /* encoder */
            flags,
            format,
            &matchingCodecs);

    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
+23 −0
Original line number 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