• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-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 MULTIMEDIA_AUDIO_COMMON_H
17 #define MULTIMEDIA_AUDIO_COMMON_H
18 #include "audio_info.h"
19 #include "audio_system_manager.h"
20 #include "cj_common_ffi.h"
21 #include "multimedia_audio_ffi.h"
22 #include "securec.h"
23 
24 namespace OHOS {
25 namespace AudioStandard {
26 const size_t MAX_MEM_MALLOC_SIZE = 50 * 1024 * 1024;
27 AudioVolumeType GetNativeAudioVolumeType(int32_t volumeType);
28 void Convert2AudioCapturerOptions(AudioCapturerOptions& opions, const CAudioCapturerOptions& cOptions);
29 char* MallocCString(const std::string& origin);
30 void Convert2CAudioCapturerInfo(CAudioCapturerInfo& cInfo, const AudioCapturerInfo& capturerInfo);
31 void Convert2CAudioStreamInfo(CAudioStreamInfo& cInfo, const AudioStreamInfo& streamInfo);
32 void Convert2CAudioCapturerChangeInfo(
33     CAudioCapturerChangeInfo& cInfo, const AudioCapturerChangeInfo& changeInfo, int32_t* errorCode);
34 void Convert2CArrDeviceDescriptor(CArrDeviceDescriptor& devices,
35     const std::vector<std::shared_ptr<AudioDeviceDescriptor>>& deviceDescriptors, int32_t* errorCode);
36 void Convert2CDeviceDescriptor(CDeviceDescriptor* device, const AudioDeviceDescriptor& deviceInfo, int32_t* errorCode);
37 void Convert2CArrDeviceDescriptorByDeviceInfo(
38     CArrDeviceDescriptor& devices, const AudioDeviceDescriptor& deviceInfo, int32_t* errorCode);
39 void ConvertAudioDeviceDescriptor2DeviceInfo(
40     AudioDeviceDescriptor& deviceInfo, std::shared_ptr<AudioDeviceDescriptor> audioDeviceDescriptor);
41 void FreeCDeviceDescriptor(CDeviceDescriptor& device);
42 void FreeCArrDeviceDescriptor(CArrDeviceDescriptor& devices);
43 void FreeCArrAudioCapturerChangeInfo(CArrAudioCapturerChangeInfo& infos);
44 void FreeCArrAudioRendererChangeInfo(CArrAudioRendererChangeInfo& infos);
45 void Convert2AudioRendererOptions(AudioRendererOptions& opions, const CAudioRendererOptions& cOptions);
46 void Convert2AudioRendererInfo(CAudioRendererInfo& cInfo, const AudioRendererInfo& rendererInfo);
47 void Convert2CAudioRendererChangeInfo(
48     CAudioRendererChangeInfo& cInfo, const AudioRendererChangeInfo& changeInfo, int32_t* errorCode);
49 } // namespace AudioStandard
50 } // namespace OHOS
51 #endif // MULTIMEDIA_AUDIO_COMMON_H
52