14a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov/*
24a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * Copyright (C) 2016 The Android Open Source Project
34a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov *
44a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * Licensed under the Apache License, Version 2.0 (the "License");
54a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * you may not use this file except in compliance with the License.
64a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * You may obtain a copy of the License at
74a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov *
84a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov *      http://www.apache.org/licenses/LICENSE-2.0
94a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov *
104a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * Unless required by applicable law or agreed to in writing, software
114a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * distributed under the License is distributed on an "AS IS" BASIS,
124a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * See the License for the specific language governing permissions and
144a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov * limitations under the License.
154a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov */
164a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
174a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov#include <media/EffectsFactoryApi.h>
184a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
194a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov#include "EffectHalLocal.h"
204a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov#include "EffectsFactoryHalLocal.h"
214a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
224a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovnamespace android {
234a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
244a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov// static
254a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovsp<EffectsFactoryHalInterface> EffectsFactoryHalInterface::create() {
264a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    return new EffectsFactoryHalLocal();
274a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov}
284a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
294a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov// static
304a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovbool EffectsFactoryHalInterface::isNullUuid(const effect_uuid_t *pEffectUuid) {
314a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    return EffectIsNullUuid(pEffectUuid);
324a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov}
334a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
344a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovstatus_t EffectsFactoryHalLocal::queryNumberEffects(uint32_t *pNumEffects) {
354a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    return EffectQueryNumberEffects(pNumEffects);
364a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov}
374a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
384a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovstatus_t EffectsFactoryHalLocal::getDescriptor(
394a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov        uint32_t index, effect_descriptor_t *pDescriptor) {
404a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    return EffectQueryEffect(index, pDescriptor);
414a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov}
424a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
434a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovstatus_t EffectsFactoryHalLocal::getDescriptor(
444a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov        const effect_uuid_t *pEffectUuid, effect_descriptor_t *pDescriptor) {
454a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    return EffectGetDescriptor(pEffectUuid, pDescriptor);
464a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov}
474a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
484a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovstatus_t EffectsFactoryHalLocal::createEffect(
494a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov        const effect_uuid_t *pEffectUuid, int32_t sessionId, int32_t ioId,
504a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov        sp<EffectHalInterface> *effect) {
514a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    effect_handle_t handle;
524a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    int result = EffectCreate(pEffectUuid, sessionId, ioId, &handle);
534a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    if (result == 0) {
544a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov        *effect = new EffectHalLocal(handle);
554a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    }
564a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    return result;
574a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov}
584a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
594a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganovstatus_t EffectsFactoryHalLocal::dumpEffects(int fd) {
604a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov    return EffectDumpEffects(fd);
614a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov}
624a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov
634a3d5c23f79189eb7ab9f31c440c7da5b15947a2Mikhail Naganov} // namespace android
64