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

Commit 70fcaeaa authored by Manikanta Kanamarlapudi's avatar Manikanta Kanamarlapudi Committed by Steve Kondik
Browse files

libstagefright: use appropriate hevc decoder on 8916 and 8939

8916 supports HEVC s/w decoder and 8939 supports h/w decoder.
Based on media.swhevccodectype property value, Add appropriate
HEVC decoder to the MediaCodecList.

Change-Id: I06a522fee4e54a75555f2b55e03addcace643d9d
parent b46c5ec2
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -198,9 +198,6 @@ uint32_t ExtendedCodec::getComponentQuirks(

const char* ExtendedCodec::overrideComponentName(
        uint32_t quirks, const sp<MetaData> &meta, const char *mime, bool isEncoder) {
    char value[PROPERTY_VALUE_MAX] = {0};
    int sw_codectype = 0;
    int enableSwHevc = 0;

    const char* componentName = FFMPEGSoftCodec::overrideComponentName(quirks, meta, mime, isEncoder);

@@ -218,23 +215,11 @@ const char* ExtendedCodec::overrideComponentName(
       }
    }

    if (!isEncoder && !strncasecmp(mime, MEDIA_MIMETYPE_VIDEO_HEVC, strlen(MEDIA_MIMETYPE_VIDEO_HEVC))) {
        sw_codectype = property_get("media.swhevccodectype", value, NULL);
        enableSwHevc = atoi(value);
        if (sw_codectype && enableSwHevc) {
           componentName = "OMX.qcom.video.decoder.hevcswvdec";
        }
    }

    
    return componentName;
}

void ExtendedCodec::overrideComponentName(
        uint32_t quirks, const sp<AMessage> &msg, AString* componentName, AString* mime, int32_t isEncoder) {
    char value[PROPERTY_VALUE_MAX] = {0};
    int sw_codectype = 0;
    int enableSwHevc = 0;

    FFMPEGSoftCodec::overrideComponentName(quirks, msg, componentName, mime, isEncoder);

@@ -251,15 +236,6 @@ void ExtendedCodec::overrideComponentName(
          }
       }
    }

    if (!isEncoder && (!strncasecmp(mime->c_str(), MEDIA_MIMETYPE_VIDEO_HEVC, strlen(MEDIA_MIMETYPE_VIDEO_HEVC)) ||
            !strncmp(componentName->c_str(), "OMX.qcom.video.decoder.hevc", strlen("OMX.qcom.video.decoder.hevc")))) {
        sw_codectype = property_get("media.swhevccodectype", value, NULL);
        enableSwHevc = atoi(value);
        if (sw_codectype && enableSwHevc) {
           componentName->setTo("OMX.qcom.video.decoder.hevcswvdec");
        }
    }
}

void ExtendedCodec::overrideMimeType(
+13 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "MediaCodecList"
#include <utils/Log.h>
#include <cutils/properties.h>

#include <binder/IServiceManager.h>

@@ -481,6 +482,18 @@ status_t MediaCodecList::addMediaCodecFromAttributes(
        return -EINVAL;
    }

    if (!encoder && !strncmp(name, "OMX.qcom.video.decoder.hevc", strlen("OMX.qcom.video.decoder.hevc"))) {
        char value[PROPERTY_VALUE_MAX] = {0};
        int sw_codectype = 0;
        int enableSwHevc = 0;

        sw_codectype = property_get("media.swhevccodectype", value, NULL);
        enableSwHevc = atoi(value);
        if (sw_codectype && enableSwHevc) {
           name = "OMX.qcom.video.decoder.hevcswvdec";
        }
    }

    mCurrentInfo = new MediaCodecInfo(name, encoder, type);
    // The next step involves trying to load the codec, which may
    // fail.  Only list the codec if this succeeds.