rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* MediaTek Inc. (C) 2016. All rights reserved. |
| 2 | * |
| 3 | * Copyright Statement: |
| 4 | * This software/firmware and related documentation ("MediaTek Software") are |
| 5 | * protected under relevant copyright laws. The information contained herein is |
| 6 | * confidential and proprietary to MediaTek Inc. and/or its licensors. Without |
| 7 | * the prior written permission of MediaTek inc. and/or its licensors, any |
| 8 | * reproduction, modification, use or disclosure of MediaTek Software, and |
| 9 | * information contained herein, in whole or in part, shall be strictly |
| 10 | * prohibited. |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * Description: |
| 15 | * Explor all private AudioParamParser APIs |
| 16 | */ |
| 17 | |
| 18 | #include "AudioParamParser.h" |
| 19 | #include <math.h> |
| 20 | |
| 21 | #ifdef WIN32 |
| 22 | #ifdef __cplusplus |
| 23 | #define EXPORT extern "C" __declspec(dllexport) |
| 24 | #else |
| 25 | #define EXPORT __declspec(dllexport) |
| 26 | #endif |
| 27 | #include <process.h> |
| 28 | #include <Windows.h> |
| 29 | #include <direct.h> |
| 30 | #else /* WIN32*/ |
| 31 | #define EXPORT |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | #include <errno.h> |
| 36 | #include <sys/stat.h> |
| 37 | #include <sys/inotify.h> |
| 38 | #include <unistd.h> |
| 39 | #include <utils/Timers.h> |
| 40 | #include <cutils/properties.h> |
| 41 | #if defined(MTK_YOCTO_AUDIO) |
| 42 | #include <signal.h> |
| 43 | #endif |
| 44 | #endif |
| 45 | |
| 46 | #ifdef __linux__ |
| 47 | #define FOLDER "/" |
| 48 | #else |
| 49 | #define FOLDER "\\" |
| 50 | #endif |
| 51 | |
| 52 | #define MAX_PROP_VALUE_LEN (512) |
| 53 | |
| 54 | #define PROPERTY_KEY_APP_LOG_LEVEL "vendor.audio.applog.level" |
| 55 | #define PROPERTY_KEY_XML_DEF_PATH "persist.vendor.audio.tuning.def_path" |
| 56 | |
| 57 | extern FILE *appLogFp; |
| 58 | extern int outputLogToStdout; |
| 59 | |
| 60 | #ifdef WIN32 |
| 61 | #define ERR_LOG(format, ...) \ |
| 62 | if(appDebugLevel <= ERR_LEVEL) \ |
| 63 | utilLog("ERROR[%d,%d](): %s(), " format"\n^^^^\n", _getpid(), GetCurrentThreadId(), __FUNCTION__, __VA_ARGS__) |
| 64 | |
| 65 | #define WARN_LOG(format, ...) \ |
| 66 | if(appDebugLevel <= WARN_LEVEL) \ |
| 67 | utilLog("WARNING[%d,%d]: %s(), " format, _getpid(), GetCurrentThreadId(), __FUNCTION__, __VA_ARGS__) |
| 68 | |
| 69 | #define INFO_LOG(format, ...) \ |
| 70 | if(appDebugLevel <= INFO_LEVEL) \ |
| 71 | utilLog("INFO[%d,%d]: %s(), " format, _getpid(), GetCurrentThreadId(), __FUNCTION__, __VA_ARGS__) |
| 72 | |
| 73 | #define DEBUG_LOG(format, ...) \ |
| 74 | if(appDebugLevel <= DEBUG_LEVEL) \ |
| 75 | utilLog("DEBUG[%d,%d]: %s(), " format, _getpid(), GetCurrentThreadId(), __FUNCTION__, __VA_ARGS__) |
| 76 | |
| 77 | #define MUST_LOG(format, ...) \ |
| 78 | utilLog("INFO[%d,%d]: %s(), " format, _getpid(), GetCurrentThreadId(), __FUNCTION__, __VA_ARGS__) |
| 79 | |
| 80 | #define APP_SIZE_T_FT "%lu" |
| 81 | #define snprintf _snprintf |
| 82 | #else /* WIN32 */ |
| 83 | #undef LOG_TAG |
| 84 | #if defined(SYS_IMPL) |
| 85 | #define LOG_TAG "AudioParamParser-sys" |
| 86 | #else |
| 87 | #define LOG_TAG "AudioParamParser-vnd" |
| 88 | #endif |
| 89 | |
| 90 | #include <utils/Log.h> |
| 91 | |
| 92 | #define ERR_LOG(format, args...) \ |
| 93 | if(appDebugLevel <= ERR_LEVEL) \ |
| 94 | ALOGE("%s(), " format, __FUNCTION__, ##args) |
| 95 | |
| 96 | #define WARN_LOG(format, args...) \ |
| 97 | if(appDebugLevel <= WARN_LEVEL) \ |
| 98 | ALOGW("%s(), " format, __FUNCTION__, ##args) |
| 99 | |
| 100 | #define INFO_LOG(format, args...) \ |
| 101 | if(appDebugLevel <= INFO_LEVEL) \ |
| 102 | ALOGI("%s(), " format, __FUNCTION__, ##args) |
| 103 | |
| 104 | #define DEBUG_LOG(format, args...) \ |
| 105 | if(appDebugLevel <= DEBUG_LEVEL) \ |
| 106 | ALOGD("%s(), " format, __FUNCTION__, ##args) |
| 107 | |
| 108 | #define MUST_LOG(format, args...) \ |
| 109 | ALOGD("%s(), " format, __FUNCTION__, ##args) |
| 110 | |
| 111 | #define APP_SIZE_T_FT "%zu" |
| 112 | #endif |
| 113 | |
| 114 | struct _CategoryPathRetrievedParam { |
| 115 | AudioType *audioType; |
| 116 | xmlNodePtr paramTreeNode; |
| 117 | xmlNodePtr paramUnitPoolNode; |
| 118 | size_t paramIdCounter; |
| 119 | }; |
| 120 | typedef struct _CategoryPathRetrievedParam CategoryPathRetrievedParam; |
| 121 | |
| 122 | typedef void(*CATEGORY_PATH_RETRIEVED_CB_FUN)(const char *categoryPath, const char *fullCategoryPath, CategoryPathRetrievedParam *categoryPathRetrievedParam); |
| 123 | |
| 124 | /* Force adding following category group info and bypass categoryGroup path checking */ |
| 125 | static const char *HARD_CATEGORY_GROUP[][3] = { |
| 126 | /* {AudioTypeName, CategoryTypeName, CategoryGroupName} */ |
| 127 | {"Speech", "Band", "NB"}, |
| 128 | {"Speech", "Band", "WB"}, |
| 129 | {NULL, NULL, NULL} |
| 130 | }; |
| 131 | |
| 132 | /*********************** |
| 133 | * Public API |
| 134 | **********************/ |
| 135 | EXPORT int appSetAudioTypeLoadingList(const char *audioTypeLoadingList[]); |
| 136 | EXPORT const char *appGetAudioTypeLoadingList(void); |
| 137 | |
| 138 | EXPORT void appSetDebugLevel(MSG_LEVEL level); |
| 139 | EXPORT MSG_LEVEL appGetDebugLevel(void); |
| 140 | |
| 141 | EXPORT char **appGetXmlDirFromProperty(void); |
| 142 | |
| 143 | /* appHandle API */ |
| 144 | EXPORT APP_STATUS appHandleInit(AppHandle *appHandle); |
| 145 | EXPORT APP_STATUS appHandleUninit(AppHandle *appHandle); |
| 146 | EXPORT void appHandleRedirectIOToConsole(void); |
| 147 | EXPORT AppHandle *appHandleGetInstance(void); /* Never uninit global instance */ |
| 148 | EXPORT size_t appHandleGetNumOfAudioType(AppHandle *appHandle); |
| 149 | EXPORT AudioType *appHandleGetAudioTypeByIndex(AppHandle *appHandle, size_t index); |
| 150 | EXPORT AudioType *appHandleGetAudioTypeByName(AppHandle *appHandle, const char *name); |
| 151 | EXPORT const char *appHandleGetFeatureOptionValue(AppHandle *appHandle, const char *featureOptionName); |
| 152 | EXPORT int appHandleIsFeatureOptionEnabled(AppHandle *appHandle, const char *featureOptionName); |
| 153 | EXPORT size_t appHandleGetNumOfFeatureOption(AppHandle *appHandle); |
| 154 | EXPORT FeatureOption *appHandleGetFeatureOptionByIndex(AppHandle *appHandle, size_t index); |
| 155 | EXPORT const char *appHandleGetBuildTimeStamp(); |
| 156 | EXPORT APP_STATUS appHandleCompressFiles(const char *srcDir, const char *destFile); |
| 157 | EXPORT APP_STATUS appHandleUncompressFile(const char *srcFile, const char *destDir); |
| 158 | EXPORT void appHandleCustXmlEnableChanged(AppHandle *appHandle, int enable); |
| 159 | |
| 160 | /* Following 4 APIs will acquire app handle write lock automatically */ |
| 161 | EXPORT APP_STATUS appHandleParseXml(AppHandle *appHandle, const char *dir[], const char *cusDir); |
| 162 | EXPORT APP_STATUS appHandleReloadAudioType(AppHandle *appHandle, const char *audioTypeName); |
| 163 | EXPORT void appHandleRegXmlChangedCb(AppHandle *appHandle, NOTIFY_CB_FUN nofiyCallback); |
| 164 | EXPORT void appHandleUnregXmlChangedCb(AppHandle *appHandle, NOTIFY_CB_FUN nofiyCallback); |
| 165 | |
| 166 | /* AudioType API */ |
| 167 | EXPORT APP_STATUS audioTypeIsTuningToolSupportedXmlVer(AudioType *audioType); |
| 168 | EXPORT APP_STATUS audioTypeIsDeviceSupportedXmlVer(AudioType *audioType); |
| 169 | EXPORT size_t audioTypeGetNumOfCategoryType(AudioType *audioType); |
| 170 | EXPORT CategoryType *audioTypeGetCategoryTypeByIndex(AudioType *audioType, size_t idnex); |
| 171 | EXPORT CategoryType *audioTypeGetCategoryTypeByName(AudioType *audioType, const char *categoryTypeName); |
| 172 | EXPORT CategoryType *audioTypeGetCategoryTypeByWording(AudioType *audioType, const char *categoryTypeWording); |
| 173 | EXPORT xmlNode *audioTypeGetCategoryTypeListNode(AudioType *audioType); |
| 174 | EXPORT ParamUnit *audioTypeGetParamUnit(AudioType *audioType, const char *categoryPath); |
| 175 | EXPORT size_t audioTypeGetNumOfParamInfo(AudioType *audioType); |
| 176 | EXPORT ParamInfo *audioTypeGetParamInfoByIndex(AudioType *audioType, size_t index); |
| 177 | EXPORT ParamInfo *audioTypeGetParamInfoByName(AudioType *audioType, const char *paramName); |
| 178 | EXPORT APP_STATUS audioTypeSaveAudioParamXml(AudioType *audioType, const char *saveDir, int clearDirtyBit); |
| 179 | EXPORT int audioTypeReadLock(AudioType *audioType, const char *callerFun); |
| 180 | EXPORT int audioTypeWriteLock(AudioType *audioType, const char *callerFun); |
| 181 | EXPORT int audioTypeUnlock(AudioType *audioType); |
| 182 | EXPORT TreeRoot *audioTypeGetTreeRoot(AudioType *audioType, const char *treeRootName); |
| 183 | |
| 184 | /* Following 3 write APIs will acquire write lock automatically */ |
| 185 | EXPORT APP_STATUS audioTypeSetParamData(AudioType *audioType, const char *categoryPath, ParamInfo *paramName, void *dataPtr, int arraySize); |
| 186 | EXPORT APP_STATUS audioTypeSetFieldData(AudioType *audioType, const char *categoryPath, FieldInfo *fieldInfo, unsigned int val); |
| 187 | EXPORT APP_STATUS audioTypeParamUnitCopy(AudioType *audioType, const char *srcCategoryPath, const char *dstCategoryPath); |
| 188 | |
| 189 | /* CategoryType API */ |
| 190 | EXPORT size_t categoryTypeGetNumOfCategoryGroup(CategoryType *categoryType); |
| 191 | EXPORT CategoryGroup *categoryTypeGetCategoryGroupByIndex(CategoryType *categoryType, size_t index); |
| 192 | EXPORT CategoryGroup *categoryTypeGetCategoryGroupByWording(CategoryType *categoryType, const char *wording); |
| 193 | EXPORT size_t categoryTypeGetNumOfCategory(CategoryType *categoryType); |
| 194 | EXPORT Category *categoryTypeGetCategoryByIndex(CategoryType *categoryType, size_t index); |
| 195 | EXPORT Category *categoryTypeGetCategoryByWording(CategoryType *categoryType, const char *wording); |
| 196 | |
| 197 | /* CategoryGroup API */ |
| 198 | EXPORT size_t categoryGroupGetNumOfCategory(CategoryGroup *categoryGroup); |
| 199 | EXPORT Category *categoryGroupGetCategoryByIndex(CategoryGroup *categoryGroup, size_t index); |
| 200 | EXPORT Category *categoryGroupGetCategoryByWording(CategoryGroup *categoryGroup, const char *index); |
| 201 | |
| 202 | /* CategoryAlias API */ |
| 203 | EXPORT CategoryAlias *categoryAliasCreate(const char *alias, Category *category); |
| 204 | EXPORT void categoryAliasRelease(CategoryAlias *categoryAlias); |
| 205 | |
| 206 | /* ParamInfo API */ |
| 207 | EXPORT size_t paramInfoGetNumOfFieldInfo(ParamInfo *paramInfo); |
| 208 | EXPORT FieldInfo *paramInfoGetFieldInfoByIndex(ParamInfo *paramInfo, size_t index); |
| 209 | EXPORT FieldInfo *paramInfoGetFieldInfoByName(ParamInfo *paramInfo, const char *fieldName); |
| 210 | EXPORT char *paramNewDataStr(Param *param); |
| 211 | EXPORT char *paramNewDataStrWithMode(Param *param, int uArrayHexMode); |
| 212 | |
| 213 | /* ParamUnit API */ |
| 214 | EXPORT size_t paramUnitGetNumOfParam(ParamUnit *paramUnit); |
| 215 | EXPORT Param *paramUnitGetParamByIndex(ParamUnit *paramUnit, size_t index); |
| 216 | EXPORT Param *paramUnitGetParamByName(ParamUnit *paramUnit, const char *paramName); |
| 217 | EXPORT ParamInfo *paramUnitGetParamInfo(ParamUnit *paramUnit, const char *paramInfoName); |
| 218 | EXPORT FieldInfo *paramUnitGetFieldInfo(ParamUnit *paramUnit, const char *paramName, const char *fieldName); |
| 219 | EXPORT APP_STATUS paramUnitGetFieldVal(ParamUnit *paramUnit, const char *paramName, const char *fieldName, unsigned int *val); |
| 220 | |
| 221 | /* Param API */ |
| 222 | EXPORT size_t paramGetArraySizeFromString(const char *str); |
| 223 | EXPORT size_t paramGetNumOfBytes(Param* param); |
| 224 | EXPORT APP_STATUS paramGetFieldVal(Param *param, FieldInfo *fieldInfo, unsigned int *val); |
| 225 | EXPORT APP_STATUS paramSetFieldVal(Param *param, FieldInfo *fieldInfo, unsigned int val); |
| 226 | EXPORT DATA_TYPE paramDataTypeToEnum(const char *dataType); |
| 227 | EXPORT const char *paramDataTypeToStr(DATA_TYPE dataType); |
| 228 | |
| 229 | /* Field API */ |
| 230 | EXPORT APP_STATUS fieldInfoGetCheckListValue(FieldInfo *fieldInfo, const char *checkName, unsigned int *checkVal); |
| 231 | |
| 232 | /* TreeRoot API */ |
| 233 | EXPORT Feature *treeRootGetFeatureByName(TreeRoot *treeRoot, const char *featureName); |
| 234 | EXPORT int featureIsCategoryPathSupport(Feature *feature, const char *categoryPath); |
| 235 | |
| 236 | /* Xml Node related APIs */ |
| 237 | EXPORT xmlNode *findXmlNodeByElemName(xmlNode *node, const char *elemName); |
| 238 | EXPORT xmlChar *xmlNodeGetProp(xmlNode *node, const char *prop); |
| 239 | EXPORT xmlChar *xmlNodeGetWording(xmlNode *node); |
| 240 | |
| 241 | /* Utils APIs */ |
| 242 | EXPORT APP_STATUS utilConvDataStringToNative(DATA_TYPE dataType, const char *paramDataStr, void **paramData, size_t *arraySize); |
| 243 | |
| 244 | /* Unit test */ |
| 245 | EXPORT APP_STATUS unitTest(AppHandle *appHandle); |
| 246 | EXPORT char *utilGetStdin(char *buf, int bufSize); |
| 247 | |
| 248 | /* Following APIs is designed for EM tool integration */ |
| 249 | EXPORT APP_STATUS utilNativeSetField(const char *audioTypeName, const char *categoryPath, const char *paramName, const char *fieldName, const char *fieldValueStr); |
| 250 | EXPORT APP_STATUS utilNativeSetParam(const char *audioTypeName, const char *categoryPath, const char *paramName, const char *paramDataStr); |
| 251 | EXPORT char *utilNativeGetCategory(const char *audioTypeName, const char *categoryTypeName); |
| 252 | EXPORT char *utilNativeGetParam(const char *audioTypeName, const char *categoryPath, const char *paramName); |
| 253 | EXPORT unsigned int utilNativeGetField(const char *audioTypeName, const char *categoryPath, const char *paramName, const char *fieldName); |
| 254 | EXPORT APP_STATUS utilNativeSaveXml(const char *audioTypeName); |
| 255 | EXPORT const char *utilNativeGetChecklist(const char *audioTypeName, const char *paramName, const char *fieldName); |
| 256 | |
| 257 | /*********************** |
| 258 | * Private APIs |
| 259 | **********************/ |
| 260 | /* appHandle API */ |
| 261 | EXPORT APP_STATUS appHandleLoadDirAudioTypeInfo(AppHandle *appHandle); |
| 262 | EXPORT APP_STATUS appHandleLoadAllAudioTypeXml(AppHandle *appHandle); |
| 263 | EXPORT APP_STATUS appHandleLoadAudioTypeXml(AppHandle *appHandle, AudioType *audioType); |
| 264 | EXPORT APP_STATUS appHandleReleaseAllAudioTypeXml(AppHandle *appHandle); |
| 265 | EXPORT int appHandleIsValidAudioType(AppHandle *appHandle, const char *audioType); |
| 266 | EXPORT AudioType *appHandleAddAudioType(AppHandle *appHandle, const char *audioType); |
| 267 | EXPORT AudioType *appHandleGetAudioType(AppHandle *appHandle, size_t index); |
| 268 | EXPORT void appHandleReleaseAudioTypeHash(AppHandle *appHandle); |
| 269 | EXPORT APP_STATUS appHandleLoadDirFeatureOptionsInfo(AppHandle *appHandle); |
| 270 | EXPORT void appHandleReleaseFeatureOptionsHash(AppHandle *appHandle); |
| 271 | EXPORT void appHandleDumpAudioTypeList(AppHandle *appHandle); |
| 272 | EXPORT char *appHandleGetAudioTypeFilePath(AppHandle *appHandle, const char *audioType, const char *posfix); |
| 273 | EXPORT char *appHandleGetPreloadAudioTypeFilePath(AppHandle *appHandle, const char *audioType, const char *posfix); |
| 274 | EXPORT APP_STATUS appHandleLoadAllAudioTypeHash(AppHandle *appHandle); |
| 275 | EXPORT int appHandleWriteLock(AppHandle *appHandle, const char *callerFun); |
| 276 | EXPORT int appHandleReadLock(AppHandle *appHandle, const char *callerFun); |
| 277 | EXPORT int appHandleUnlock(AppHandle *appHandle); |
| 278 | EXPORT int appHandleInstWriteLock(const char *callerFun); |
| 279 | EXPORT int appHandleInstUnlock(void); |
| 280 | EXPORT int appHandleIsNodeFeatureOptionEnabled(AppHandle *appHandle, xmlNode *node, int defaultValue); |
| 281 | EXPORT void appHandleRemoveAudioTypeByFeatureOptions(AppHandle *appHandle); |
| 282 | EXPORT void appHandleReviseXmlDocByFeatureOptions(AppHandle *appHandle); |
| 283 | EXPORT APP_STATUS appHandleGetAudioTypeSupportedVerInfo(const char *audioTypeName, int *paramUnitDescVerMaj, int *paramUnitDescVerMin, int *audioParamVerMaj, int *audioParamVerMin); |
| 284 | EXPORT void appHandleShowAudioTypeSupportedVerInfo(AppHandle *appHandle); |
| 285 | EXPORT void appHandleReloadCustXml(AppHandle *appHandle); |
| 286 | EXPORT void appHandleNotifyAllCallbacks(AppHandle *appHandle, const char *audioTypeName); |
| 287 | EXPORT void *appHandleThreadLoop(void *arg); |
| 288 | EXPORT void *reloadCustXmlThreadLoop(void *arg); |
| 289 | |
| 290 | /* AudioType API */ |
| 291 | EXPORT AudioType *audioTypeCreate(AppHandle *appHandle, const char *audioTypeName); |
| 292 | EXPORT void audioTypeRelease(AudioType *audioType); |
| 293 | EXPORT void audioTypeReleaseAudioParam(AudioType *audioType); |
| 294 | EXPORT void audioTypeDump(AudioType *audioType); |
| 295 | EXPORT APP_STATUS audioTypeParseTabName(AudioType *audioType); |
| 296 | EXPORT APP_STATUS audioTypeLoadStage1Hash(AudioType *audioType); |
| 297 | EXPORT APP_STATUS audioTypeLoadStage2Hash(AudioType *audioType); |
| 298 | EXPORT APP_STATUS audioTypeLoadParamTreeHash(AudioType *audioType); |
| 299 | EXPORT APP_STATUS audioTypeLoadParamTreeView(AudioType *audioType); |
| 300 | EXPORT APP_STATUS audioTypeLoadParamUnitHash(AudioType *audioType); |
| 301 | EXPORT Param *audioTypeGetParamHash(AudioType *audioType, xmlNode *paramUnitNode); |
| 302 | EXPORT xmlNode *audioTypeGetParamUnitDescNode(AudioType *audioType); |
| 303 | EXPORT xmlNode *audioTypeGetParamUnitNode(AudioType *audioType); |
| 304 | EXPORT APP_STATUS audioTypeParseXmlVer(AudioType *audioType); |
| 305 | EXPORT APP_STATUS audioTypeLoadParamFieldInfoHash(AudioType *audioType); |
| 306 | EXPORT APP_STATUS audioTypeLoadCategoryTypeHash(AudioType *audioType); |
| 307 | EXPORT size_t audioTypeGetNumOfParamTree(AudioType *audioType); |
| 308 | EXPORT APP_STATUS audioTypeValidCategoryGroupName(AudioType *audioType, const char *name); |
| 309 | EXPORT int audioTypeIsHardCategoryGroup(AudioType *audioType, const char *categoryName); |
| 310 | EXPORT APP_STATUS audioTypeSetupAudioParamNode(AudioType *audioType, xmlNodePtr audioParamNode); |
| 311 | |
| 312 | /* CategoryType API */ |
| 313 | EXPORT CategoryType *categoryTypeCreate(const char *name, const char *wording, AudioType *audioType, int visible); |
| 314 | EXPORT void categoryTypeRelease(CategoryType *categoryType); |
| 315 | EXPORT size_t categoryTypeGetNumOfAllCategory(CategoryType *categoryType); |
| 316 | EXPORT Category *categoryTypeGetAllCategoryByIndex(CategoryType *categoryType, size_t index); |
| 317 | EXPORT CategoryAlias *categoryTypeGetCategoryByAlias(CategoryType *categoryType, const char *alias); |
| 318 | EXPORT Category *categoryTypeGetCategoryByName(CategoryType *categoryType, const char *name); |
| 319 | |
| 320 | /* CategoryGroup API */ |
| 321 | EXPORT CategoryGroup *categoryGroupCreate(const char *categoryGroupName, const char *categoryGroupWording, CategoryType *categoryType, int visible); |
| 322 | EXPORT void categoryGroupRelease(CategoryGroup *categoryGroup); |
| 323 | |
| 324 | /* Category API */ |
| 325 | EXPORT Category *categoryCreate(const char *name, const char *wording, CATEGORY_PARENT_TYPE parentTypeIsCategoryType, void *parent, int visible); |
| 326 | EXPORT void categoryRelease(Category *category); |
| 327 | |
| 328 | /* ParamTree API */ |
| 329 | EXPORT ParamTree *paramTreeCreate(int paramId, const char *categoryPath); |
| 330 | EXPORT void paramTreeRelease(ParamTree *paramTree); |
| 331 | EXPORT size_t paramTreeGetNumOfParam(ParamTree *paramTree); |
| 332 | |
| 333 | /* ParamUnit API */ |
| 334 | EXPORT ParamUnit *paramUnitCreate(AudioType *audioType, int id, Param *param); |
| 335 | EXPORT ParamUnit *paramUnitClone(ParamUnit *paramUnit); |
| 336 | EXPORT void paramUnitRelease(ParamUnit *paramUnit); |
| 337 | |
| 338 | /* ParamInfo API */ |
| 339 | EXPORT ParamInfo *paramInfoCreate(const char *name, DATA_TYPE dataType, AudioType *audioType); |
| 340 | EXPORT void paramInfoRelease(ParamInfo *paramInfo); |
| 341 | |
| 342 | /* FieldInfo API */ |
| 343 | EXPORT FieldInfo *fieldInfoCreate(const char *fieldName, unsigned int arrayIndex, int startBit, int endBit, const char *checkList, ParamInfo *paramInfo); |
| 344 | EXPORT void fieldInfoRelease(FieldInfo *paramInfo); |
| 345 | |
| 346 | /* Param API */ |
| 347 | EXPORT Param *paramCreate(const char *paramName, ParamInfo *paramInfo, const char *paramValue); |
| 348 | EXPORT void paramRelease(Param *param); |
| 349 | EXPORT APP_STATUS paramSetupDataInfoByStr(Param *param, const char *str); |
| 350 | EXPORT APP_STATUS paramSetupDataInfoByVal(Param *param, void *data, int arraySize); |
| 351 | EXPORT Param *paramHashClone(Param *paramHash); |
| 352 | |
| 353 | /* ParamTreeView API */ |
| 354 | EXPORT ParamTreeView *paramTreeViewCreate(AudioType *audioType, int verMaj, int verMin); |
| 355 | EXPORT void paramTreeViewRelease(ParamTreeView *paramTreeView); |
| 356 | EXPORT TreeRoot *treeRootCreate(const char *name, xmlNode *treeRootNode, ParamTreeView *paramTreeView); |
| 357 | EXPORT void treeRootRelease(TreeRoot *treeRoot); |
| 358 | EXPORT Feature *featureCreate(const char *name, AudioType *audioType, FieldInfo *switchFieldInfo, const char *featureOption); |
| 359 | EXPORT void featureRelease(Feature *feature); |
| 360 | EXPORT CategoryPath *categoryPathCreate(Feature *feature, const char *path); |
| 361 | EXPORT void categoryPathRelease(CategoryPath *categoryPath); |
| 362 | EXPORT APP_STATUS categoryPathValidation(CategoryPath *categoryPath); |
| 363 | EXPORT FeatureField *featureFieldCreate(FieldInfo *fieldInfo); |
| 364 | EXPORT void featureFieldRelease(FeatureField *featureField); |
| 365 | |
| 366 | /* Feature Options API */ |
| 367 | EXPORT FeatureOption *featureOptionCreate(const char *name, const char *value); |
| 368 | EXPORT void featureOptionRelease(FeatureOption *featureOption); |
| 369 | |
| 370 | /* Utils API */ |
| 371 | EXPORT char *utilConvDataToString(DATA_TYPE dataType, void *data, int arraySize, int uArrayHexMode); |
| 372 | EXPORT UT_string *utilNormalizeCategoryPathForAudioType(const char *categoryPath, AudioType *audioType); |
| 373 | EXPORT UT_string *utilNormalizeCategoryGroupPathForAudioType(const char *categoryPath, AudioType *audioType); |
| 374 | EXPORT int utilFindUnusedParamId(AudioType *audioType); |
| 375 | EXPORT void utilUsleep(unsigned int usec); |
| 376 | EXPORT void utilLog(char *str, ...); |
| 377 | EXPORT void utilLogClose(void); |
| 378 | EXPORT FieldInfo *utilXmlNodeGetFieldInfo(AppHandle *appHandle, xmlNode *node, const char *audioTypeAttrName, const char *paramAttrName, const char *fieldAttrName); |
| 379 | EXPORT void appDumpXmlDoc(xmlDoc *doc); |
| 380 | EXPORT void redirectIOToConsole(void); |
| 381 | EXPORT void utilMkdir(const char *dir); |
| 382 | EXPORT void utilShowParamValue(Param *param); |
| 383 | EXPORT char *utilStrtok(char *str, const char *delim, char **saveptr); |
| 384 | EXPORT char *utilGenCheckList(int bits); |
| 385 | EXPORT int utilCompNormalizeCategoryPath(AudioType *audioType, const char *srcCategoryPath, const char *dstCategoryPath); |
| 386 | EXPORT int isCustXmlEnable(void); |
| 387 | EXPORT void utilShellExecute(const char *prog, const char *params); |
| 388 | EXPORT int utilIsAudioTypeInLoadingList(const char *audioType); |
| 389 | EXPORT int utilIsUIAudioType(const char *audioType); |
| 390 | EXPORT void utilDumpAudioTypeLoadingList(const char *audioTypeLoadingList[]); |
| 391 | |
| 392 | #if defined(SYS_IMPL) |
| 393 | EXPORT APP_STATUS registerAudioParameterChangedCallback(AppHandle *appHandle); |
| 394 | EXPORT APP_STATUS unregisterAudioParameterChangedCallback(AppHandle *appHandle); |
| 395 | #endif |
| 396 | |
| 397 | #ifndef WIN32 |
| 398 | EXPORT void signalHandler(int sig, siginfo_t *info, void *ucontext); |
| 399 | EXPORT char *audioSystemGetParameters(const char *str); |
| 400 | EXPORT void audioSystemSetParameters(const char *str); |
| 401 | #endif |
| 402 | |
| 403 | /* Unit Test */ |
| 404 | EXPORT void testDebugLevel(void); |
| 405 | EXPORT void testHashParamTree(void); |
| 406 | EXPORT void testHashParamUnit(void); |
| 407 | EXPORT void testHashParam(void); |
| 408 | EXPORT APP_STATUS testReadWriteParam(AppHandle *appHandle); |
| 409 | EXPORT APP_STATUS testMemoryLeak(AppHandle *appHandle); |
| 410 | EXPORT APP_STATUS testAudioTypeLock(AppHandle *appHandle); |
| 411 | EXPORT APP_STATUS testAppHandleInitUninit(void); |
| 412 | EXPORT void inotifyTest(const char *path); |
| 413 | EXPORT void notifyCbTest(AppHandle *appHandle); |
| 414 | |
| 415 | #ifndef WIN32 |
| 416 | #ifdef __cplusplus |
| 417 | } |
| 418 | #endif |
| 419 | #endif |