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