1 /* 2 * Copyright (c) 2021-2025 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_CAPTURER_SOURCE_H 17 #define AUDIO_CAPTURER_SOURCE_H 18 19 #include <cstdio> 20 #include <list> 21 22 #include "i_audio_capturer_source.h" 23 24 namespace OHOS { 25 namespace AudioStandard { 26 #define AUDIO_CHANNELCOUNT 2 27 #define AUDIO_SAMPLE_RATE_48K 48000 28 #define DEEP_BUFFER_CAPTURE_PERIOD_SIZE 4096 29 #define INT_32_MAX 0x7fffffff 30 #define PERIOD_SIZE 1024 31 #define PATH_LEN 256 32 #define AUDIO_BUFF_SIZE (16 * 1024) 33 #define PCM_8_BIT 8 34 #define PCM_16_BIT 16 35 36 class AudioCapturerSource : public IAudioCapturerSource { 37 public: 38 static AudioCapturerSource *GetInstance(const std::string &halName = "primary", 39 const SourceType sourceType = SourceType::SOURCE_TYPE_MIC, 40 const char *sourceName = "Built_in_wakeup"); 41 static AudioCapturerSource *GetMicInstance(void); 42 static AudioCapturerSource *GetWakeupInstance(bool isMirror = false); 43 static AudioCapturerSource *Create(CaptureAttr *attr); 44 45 protected: 46 AudioCapturerSource() = default; 47 ~AudioCapturerSource() = default; 48 }; 49 } // namespace AudioStandard 50 } // namespace OHOS 51 #endif // AUDIO_CAPTURER_SOURCE_H 52