1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AUDIO_ADAPTER_INFO_COMMON_H 17 #define AUDIO_ADAPTER_INFO_COMMON_H 18 19 #include <stdio.h> 20 #include <dlfcn.h> 21 #include <sys/stat.h> 22 #include <sys/types.h> 23 #include <fcntl.h> 24 #include <stdlib.h> 25 #include <errno.h> 26 #include <string.h> 27 #include <time.h> 28 #include "securec.h" 29 #include "audio_types.h" 30 #include "audio_internal.h" 31 32 #ifdef LOG_DOMAIN 33 #undef LOG_DOMAIN 34 #endif 35 #define LOG_DOMAIN 0xD000105 36 37 namespace OHOS::HDI::Audio_Bluetooth { 38 struct AudioAdapterDescriptor *AudioAdapterGetConfigOut(void); 39 struct AudioAdapterDescriptor *AudioAdapterGetConfigDescs(void); 40 int32_t AudioAdapterGetAdapterNum(void); 41 int32_t AudioAdaptersForUser(struct AudioAdapterDescriptor **descs, int *size); 42 int32_t AudioAdapterExist(const char *adapterName); 43 int32_t HdmiPortInit(struct AudioPort portIndex, struct AudioPortCapability *capabilityIndex); 44 int32_t KeyValueListToMap(const char *keyValueList, struct ParamValMap mParamValMap[], int32_t *count); 45 int32_t AddElementToList(char *keyValueList, int32_t listLenth, const char *key, void *value); 46 int32_t GetErrorReason(int reason, char* reasonDesc); 47 int32_t CheckAttrRoute(long param); 48 int32_t CheckAttrChannel(unsigned long param); 49 int32_t TransferRoute(const char *value, int32_t *route); 50 int32_t TransferFormat(const char *value, int32_t *format); 51 int32_t TransferChannels(const char *value, uint32_t *channels); 52 int32_t TransferFrames(const char *value, uint64_t *frames); 53 int32_t TransferSampleRate(const char *value, uint32_t *sampleRate); 54 int32_t FormatToBits(AudioFormat format, uint32_t *formatBits); 55 int32_t BitsToFormat(AudioFormat *format, long formatBits); 56 int32_t SetExtParam(const char *key, const char *value, struct ExtraParams *mExtraParams); 57 int32_t AudioSetExtraParams(const char *keyValueList, int32_t *count, 58 struct ExtraParams *mExtraParams, int32_t *sumOk); 59 } 60 #endif 61