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