1 /* 2 * Copyright (C) 2010 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 #ifndef ANDROID_EFFECTSFACTORY_H_ 18 #define ANDROID_EFFECTSFACTORY_H_ 19 20 #include <dirent.h> 21 #include <pthread.h> 22 23 #include <cutils/compiler.h> 24 #include <hardware/audio_effect.h> 25 26 #if __cplusplus 27 extern "C" { 28 #endif 29 30 #define EFFECT_LIBRARY_API_VERSION_CURRENT EFFECT_LIBRARY_API_VERSION_3_1 31 32 #define PROPERTY_IGNORE_EFFECTS "ro.audio.ignore_effects" 33 34 typedef struct list_elem_s { 35 void *object; 36 struct list_elem_s *next; 37 } list_elem_t; 38 39 // Structure used for storing effects with their sub effects. 40 // Used in creating gSubEffectList. Here, 41 // object holds the effect desc and the list sub_elem holds the sub effects 42 typedef struct list_sub_elem_s { 43 void *object; 44 list_elem_t *sub_elem; 45 struct list_sub_elem_s *next; 46 } list_sub_elem_t; 47 48 typedef struct lib_entry_s { 49 audio_effect_library_t *desc; 50 char *name; 51 char *path; 52 void *handle; 53 list_elem_t *effects; //list of effect_descriptor_t 54 pthread_mutex_t lock; 55 } lib_entry_t; 56 57 typedef struct effect_entry_s { 58 struct effect_interface_s *itfe; 59 effect_handle_t subItfe; 60 lib_entry_t *lib; 61 } effect_entry_t; 62 63 typedef struct lib_failed_entry_s { 64 char *name; 65 char *path; 66 } lib_failed_entry_t; 67 68 // Structure used to store the lib entry 69 // and the descriptor of the sub effects. 70 // The library entry is to be stored in case of 71 // sub effects as the sub effects are not linked 72 // to the library list - gLibraryList. 73 typedef struct sub_effect_entry_s { 74 lib_entry_t *lib; 75 void *object; 76 } sub_effect_entry_t; 77 78 79 80 //////////////////////////////////////////////////////////////////////////////// 81 // 82 // Function: EffectGetSubEffects 83 // 84 // Description: Returns the descriptors of the sub effects of the effect 85 // whose uuid is pointed to by first argument. 86 // 87 // Input: 88 // pEffectUuid: pointer to the effect uuid. 89 // size: max number of sub_effect_entry_t * in pSube. 90 // 91 // Input/Output: 92 // pSube: address where to return the sub effect structures. 93 // Output: 94 // returned value: 0 successful operation. 95 // -ENODEV factory failed to initialize 96 // -EINVAL invalid pEffectUuid or pDescriptor 97 // -ENOENT no effect with this uuid found 98 // *pDescriptor: updated with the sub effect descriptors. 99 // 100 //////////////////////////////////////////////////////////////////////////////// 101 ANDROID_API 102 int EffectGetSubEffects(const effect_uuid_t *pEffectUuid, 103 sub_effect_entry_t **pSube, 104 size_t size); 105 106 #if __cplusplus 107 } // extern "C" 108 #endif 109 110 111 #endif /*ANDROID_EFFECTSFACTORY_H_*/ 112