1 /* 2 * Copyright (c) 2022 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 "audio_internal.h" 21 #include "v1_0/audio_types.h" 22 23 #define AUDIO_PRIMARY_ID_MIN 0 24 #define AUDIO_PRIMARY_ID_MAX 10 25 26 #define AUDIO_PRIMARY_EXT_ID_MIN 11 27 #define AUDIO_PRIMARY_EXT_ID_MAX 20 28 29 #define AUDIO_USB_ID_MIN 21 30 #define AUDIO_USB_ID_MAX 30 31 32 #define AUDIO_A2DP_ID_MIN 31 33 #define AUDIO_A2DP_ID_MAX 40 34 35 enum AudioAdapterType { 36 AUDIO_ADAPTER_PRIMARY = 0, /* internel sound card */ 37 AUDIO_ADAPTER_PRIMARY_EXT, /* extern sound card */ 38 AUDIO_ADAPTER_USB, /* usb sound card */ 39 AUDIO_ADAPTER_A2DP, /* blue tooth sound card */ 40 AUDIO_ADAPTER_MAX, /* Invalid value. */ 41 }; 42 43 enum AudioAdapterType MatchAdapterType(const char *adapterName, uint32_t portId); 44 struct AudioAdapterDescriptor *AudioAdapterGetConfigDescs(void); 45 int32_t AudioAdapterGetAdapterNum(void); 46 int32_t AudioAdaptersForUser(struct AudioAdapterDescriptor *descs, const uint32_t *size); 47 int32_t AudioAdapterExist(const char *adapterName); 48 int32_t InitPortForCapabilitySub(struct AudioPort portIndex, struct AudioPortCapability *capabilityIndex); 49 int32_t AddElementToList(char *keyValueList, int32_t listLenth, const char *key, void *value); 50 int32_t GetErrorReason(int reason, char *reasonDesc); 51 int32_t GetCurrentTime(char *time); 52 int32_t FormatToBits(enum AudioFormat format, uint32_t *formatBits); 53 int32_t AudioSetExtraParams(const char *keyValueList, int32_t *count, struct ExtraParams *mExtraParams, int32_t *sumOk); 54 int32_t SetDescParam( 55 struct AudioMmapBufferDescripter *desc, FILE *fp, int32_t reqSize, int64_t *fileSize, int32_t *flags); 56 bool ReleaseAudioManagerObjectComm(struct IAudioManager *object); 57 58 #endif 59