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