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