• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <media/EffectsFactoryApi.h>
18 
19 #include "EffectHalLocal.h"
20 #include "EffectsFactoryHalLocal.h"
21 
22 namespace android {
23 
24 // static
create()25 sp<EffectsFactoryHalInterface> EffectsFactoryHalInterface::create() {
26     return new EffectsFactoryHalLocal();
27 }
28 
29 // static
isNullUuid(const effect_uuid_t * pEffectUuid)30 bool EffectsFactoryHalInterface::isNullUuid(const effect_uuid_t *pEffectUuid) {
31     return EffectIsNullUuid(pEffectUuid);
32 }
33 
queryNumberEffects(uint32_t * pNumEffects)34 status_t EffectsFactoryHalLocal::queryNumberEffects(uint32_t *pNumEffects) {
35     return EffectQueryNumberEffects(pNumEffects);
36 }
37 
getDescriptor(uint32_t index,effect_descriptor_t * pDescriptor)38 status_t EffectsFactoryHalLocal::getDescriptor(
39         uint32_t index, effect_descriptor_t *pDescriptor) {
40     return EffectQueryEffect(index, pDescriptor);
41 }
42 
getDescriptor(const effect_uuid_t * pEffectUuid,effect_descriptor_t * pDescriptor)43 status_t EffectsFactoryHalLocal::getDescriptor(
44         const effect_uuid_t *pEffectUuid, effect_descriptor_t *pDescriptor) {
45     return EffectGetDescriptor(pEffectUuid, pDescriptor);
46 }
47 
createEffect(const effect_uuid_t * pEffectUuid,int32_t sessionId,int32_t ioId,sp<EffectHalInterface> * effect)48 status_t EffectsFactoryHalLocal::createEffect(
49         const effect_uuid_t *pEffectUuid, int32_t sessionId, int32_t ioId,
50         sp<EffectHalInterface> *effect) {
51     effect_handle_t handle;
52     int result = EffectCreate(pEffectUuid, sessionId, ioId, &handle);
53     if (result == 0) {
54         *effect = new EffectHalLocal(handle);
55     }
56     return result;
57 }
58 
dumpEffects(int fd)59 status_t EffectsFactoryHalLocal::dumpEffects(int fd) {
60     return EffectDumpEffects(fd);
61 }
62 
63 } // namespace android
64