1 /*
2  * Copyright (C) 2017 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_EFFECTSFACTORYSTATE_H_
18 #define ANDROID_EFFECTSFACTORYSTATE_H_
19 
20 #include "EffectsFactory.h"
21 
22 #if __cplusplus
23 extern "C" {
24 #endif
25 
26 /** @file Contains the state shared with configuration loader of the Effect factory.
27  *        This global state should probably be refactor in a structure
28  *        provided by the config loader on EffectsFactory init.
29  *        This header also contains some helper functions to work on the state.
30  */
31 
32 extern list_elem_t *gLibraryList; // list of lib_entry_t: all currently loaded libraries
33 // list of effects skipped because of duplicate uuid or invalid version
34 extern list_elem_t *gSkippedEffects;
35 // list of effect_descriptor and list of sub effects : all currently loaded
36 // It does not contain effects without sub effects.
37 extern list_sub_elem_t *gSubEffectList;
38 extern pthread_mutex_t gLibLock; // controls access to gLibraryList
39 
40 extern list_elem_t *gLibraryFailedList;  //list of lib_failed_entry_t: libraries failed to load
41 
42 
43 
44 int findEffect(const effect_uuid_t *type,
45                const effect_uuid_t *uuid,
46                lib_entry_t **lib,
47                effect_descriptor_t **desc);
48 
49 int stringToUuid(const char *str, effect_uuid_t *uuid);
50 /** Used to log UUIDs */
51 int uuidToString(const effect_uuid_t *uuid, char *str, size_t maxLen);
52 
53 /** Used for debuging. */
54 void dumpEffectDescriptor(effect_descriptor_t *desc, char *str, size_t len, int indent);
55 
56 #if __cplusplus
57 } // extern "C"
58 #endif
59 
60 #endif // ANDROID_EFFECTSFACTORYSTATE_H_
61