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 /* 17 * @addtogroup Audio 18 * @{ 19 * 20 * @brief Test audio-related APIs, including custom data types and functions for loading drivers, 21 * accessing a driver ADM interface lib. 22 * 23 * @since 1.0 24 * @version 1.0 25 */ 26 27 /* 28 * @file audio_adm_fuzzer_common.h 29 * 30 * @brief Declares APIs for operations related to the audio ADM interface lib. 31 * 32 * @since 1.0 33 * @version 1.0 34 */ 35 36 #ifndef AUDIO_ADM_FUZZER_COMMON_H 37 #define AUDIO_ADM_FUZZER_COMMON_H 38 39 40 #include <cstring> 41 #include <cstdint> 42 #include <iostream> 43 44 #include "hdf_log.h" 45 #include "audio_adapter.h" 46 #include "audio_internal.h" 47 #include "audio_types.h" 48 49 namespace OHOS { 50 namespace Audio { 51 using namespace std; 52 const string ADAPTER_NAME = "primary"; 53 const string BIND_CONTROL = "control"; 54 const string BIND_RENDER = "render"; 55 const string BIND_CAPTURE = "capture"; 56 const int BUFFER_LENTH = 1024 * 16; 57 const int CHANNELCOUNT = 2; 58 const int DEEP_BUFFER_RENDER_PERIOD_SIZE = 4096; 59 const int G_PERIODSIZE = 4096; 60 const int G_PERIODCOUNT = 8; 61 const int G_BYTERATE = 48000; 62 const int G_BUFFERFRAMESIZE = 0; 63 const int G_BUFFERSIZE1 = 128; 64 const int G_SILENCETHRESHOLE = 0; 65 const int G_PORTID = 0; 66 const int MOVE_LEFT_NUM = 8; 67 const int SAMPLERATE = 48000; 68 const int STOP_THRESHOLD = 32; 69 const int START_THRESHOLD = 8; 70 const uint32_t INT_32_MAX = 0x7fffffff; 71 72 enum AudioPCMBit { 73 PCM_8_BIT = 8, 74 PCM_16_BIT = 16, 75 PCM_24_BIT = 24, 76 PCM_32_BIT = 32, 77 }; 78 79 int32_t InitRenderFramepara(struct AudioFrameRenderMode& frameRenderMode); 80 81 int32_t InitHwCaptureFramepara(struct AudioFrameCaptureMode& frameCaptureMode); 82 83 int32_t InitHwRenderMode(struct AudioHwRenderMode& renderMode); 84 85 int32_t InitHwCaptureMode(struct AudioHwCaptureMode& captureMode); 86 87 int32_t InitHwRender(struct AudioHwRender *&hwRender); 88 89 int32_t InitHwCapture(struct AudioHwCapture *&hwCapture); 90 91 int32_t BindServiceAndHwRender(struct AudioHwRender *&hwRender); 92 93 int32_t BindServiceAndHwCapture(struct AudioHwCapture *&hwCapture); 94 } 95 } 96 #endif // AUDIO_LIB_COMMON_H 97 98