bool PluginEffectLoader::isEffectSupported(const QString &name) const { if (EffectPluginFactory *effectFactory = factory(findEffect(name))) { return effectFactory->isSupported(); } return false; }
int EffectCreate(effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, effect_interface_t *pInterface) { list_elem_t *e = gLibraryList; lib_entry_t *l = NULL; effect_descriptor_t *d = NULL; effect_interface_t itfe; effect_entry_t *fx; int found = 0; int ret; if (uuid == NULL || pInterface == NULL) { return -EINVAL; } LOGV("EffectCreate() UUID: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n", uuid->timeLow, uuid->timeMid, uuid->timeHiAndVersion, uuid->clockSeq, uuid->node[0], uuid->node[1],uuid->node[2], uuid->node[3],uuid->node[4],uuid->node[5]); ret = init(); if (ret < 0) { LOGW("EffectCreate() init error: %d", ret); return ret; } pthread_mutex_lock(&gLibLock); ret = findEffect(uuid, &l, &d); if (ret < 0){ goto exit; } // create effect in library ret = l->createFx(uuid, sessionId, ioId, &itfe); if (ret != 0) { LOGW("EffectCreate() library %s: could not create fx %s, error %d", l->path, d->name, ret); goto exit; } // add entry to effect list fx = (effect_entry_t *)malloc(sizeof(effect_entry_t)); fx->subItfe = itfe; fx->itfe = (struct effect_interface_s *)&gInterface; fx->lib = l; e = (list_elem_t *)malloc(sizeof(list_elem_t)); e->object = fx; e->next = gEffectList; gEffectList = e; *pInterface = (effect_interface_t)fx; LOGV("EffectCreate() created entry %p with sub itfe %p in library %s", *pInterface, itfe, l->path); exit: pthread_mutex_unlock(&gLibLock); return ret; }
bool PluginEffectLoader::loadEffect(const QString &name) { const auto info = findEffect(name); if (!info.isValid()) { return false; } return loadEffect(info, LoadEffectFlag::Load); }
bool ScriptedEffectLoader::loadEffect(const QString &name) { auto effect = findEffect(name); if (!effect.isValid()) { return false; } return loadEffect(effect, LoadEffectFlag::Load); }
CEffect* EffectManager::createCEffect(string key, int parentID, int targetID) { if (findEffect(key)){ CEffect* effect = m_effectlist[key]->clone(); effect->setParent(parentID); if (targetID == -1) effect->setTarget(parentID); else effect->setTarget(targetID); return effect; } log("EffectManager->createCEffect() : CEffect [%s] Not Found !", key.c_str()); return nullptr; }
int EffectGetDescriptor(effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) { lib_entry_t *l = NULL; effect_descriptor_t *d = NULL; int ret = init(); if (ret < 0) { return ret; } if (pDescriptor == NULL || uuid == NULL) { return -EINVAL; } pthread_mutex_lock(&gLibLock); ret = findEffect(uuid, &l, &d); if (ret == 0) { memcpy(pDescriptor, d, sizeof(effect_descriptor_t)); } pthread_mutex_unlock(&gLibLock); return ret; }
int EffectGetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) { lib_entry_t *l = NULL; effect_descriptor_t *d = NULL; int ret = init(); if (ret < 0) { return ret; } if (pDescriptor == NULL || uuid == NULL) { return -EINVAL; } pthread_mutex_lock(&gLibLock); ret = findEffect(NULL, uuid, &l, &d); if (ret == 0) { *pDescriptor = *d; } pthread_mutex_unlock(&gLibLock); return ret; }
bool PluginEffectLoader::hasEffect(const QString &name) const { const auto info = findEffect(name); return info.isValid(); }
bool ScriptedEffectLoader::hasEffect(const QString &name) const { return findEffect(name).isValid(); }
int EffectCreate(const effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, effect_handle_t *pHandle) { list_elem_t *e = gLibraryList; lib_entry_t *l = NULL; effect_descriptor_t *d = NULL; effect_handle_t itfe; effect_entry_t *fx; int found = 0; int ret; if (uuid == NULL || pHandle == NULL) { return -EINVAL; } ALOGV("EffectCreate() UUID: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n", uuid->timeLow, uuid->timeMid, uuid->timeHiAndVersion, uuid->clockSeq, uuid->node[0], uuid->node[1],uuid->node[2], uuid->node[3],uuid->node[4],uuid->node[5]); ret = init(); if (ret < 0) { ALOGW("EffectCreate() init error: %d", ret); return ret; } pthread_mutex_lock(&gLibLock); ret = findEffect(NULL, uuid, &l, &d); if (ret < 0){ // Sub effects are not associated with the library->effects, // so, findEffect will fail. Search for the effect in gSubEffectList. ret = findSubEffect(uuid, &l, &d); if (ret < 0 ) { goto exit; } } // create effect in library ret = l->desc->create_effect(uuid, sessionId, ioId, &itfe); if (ret != 0) { ALOGW("EffectCreate() library %s: could not create fx %s, error %d", l->name, d->name, ret); goto exit; } // add entry to effect list fx = (effect_entry_t *)malloc(sizeof(effect_entry_t)); if (!fx) { ALOGE("failed to allocate effect_entry"); ret = -ENOMEM; goto exit; } fx->subItfe = itfe; if ((*itfe)->process_reverse != NULL) { fx->itfe = (struct effect_interface_s *)&gInterfaceWithReverse; ALOGV("EffectCreate() gInterfaceWithReverse"); } else { fx->itfe = (struct effect_interface_s *)&gInterface; ALOGV("EffectCreate() gInterface"); } fx->lib = l; e = (list_elem_t *)malloc(sizeof(list_elem_t)); if (!e) { ret = -ENOMEM; goto exit; } e->object = fx; e->next = gEffectList; gEffectList = e; *pHandle = (effect_handle_t)fx; ALOGV("EffectCreate() created entry %p with sub itfe %p in library %s", *pHandle, itfe, l->name); exit: pthread_mutex_unlock(&gLibLock); return ret; }