status_t MediaCodecList::addTypeFromAttributes(const char **attrs) { const char *name = NULL; size_t i = 0; while (attrs[i] != NULL) { if (!strcmp(attrs[i], "name")) { if (attrs[i + 1] == NULL) { return -EINVAL; } name = attrs[i + 1]; ++i; } else { return -EINVAL; } ++i; } if (name == NULL) { return -EINVAL; } status_t ret = mCurrentInfo->addMime(name); if (ret != OK) { return ret; } // The next step involves trying to load the codec, which may // fail. Handle this gracefully (by not reporting such mime). if (initializeCapabilities(name) != OK) { mCurrentInfo->removeMime(name); } return OK; }
status_t MediaCodecList::addMediaCodecFromAttributes( bool encoder, const char **attrs) { const char *name = NULL; const char *type = NULL; size_t i = 0; while (attrs[i] != NULL) { if (!strcmp(attrs[i], "name")) { if (attrs[i + 1] == NULL) { return -EINVAL; } name = attrs[i + 1]; ++i; } else if (!strcmp(attrs[i], "type")) { if (attrs[i + 1] == NULL) { return -EINVAL; } type = attrs[i + 1]; ++i; } else { return -EINVAL; } ++i; } if (name == NULL) { 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. // However, keep mCurrentInfo object around until parsing // of full codec info is completed. if (initializeCapabilities(type) == OK) { mCodecInfos.push_back(mCurrentInfo); } return OK; }
status_t MediaCodecList::addMediaCodecFromAttributes( bool encoder, const char **attrs) { const char *name = NULL; const char *type = NULL; size_t i = 0; while (attrs[i] != NULL) { if (!strcmp(attrs[i], "name")) { if (attrs[i + 1] == NULL) { return -EINVAL; } name = attrs[i + 1]; ++i; } else if (!strcmp(attrs[i], "type")) { if (attrs[i + 1] == NULL) { return -EINVAL; } type = attrs[i + 1]; ++i; } else { return -EINVAL; } ++i; } if (name == NULL) { return -EINVAL; } 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. // However, keep mCurrentInfo object around until parsing // of full codec info is completed. if (initializeCapabilities(type) == OK) { mCodecInfos.push_back(mCurrentInfo); } return OK; }