• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# native_audio_stream_manager.h
2
3## Overview
4
5The file declares the functions related to an audio stream manager.
6
7You can call the functions to create an audio stream manager and set and manage audio streams.
8
9**File to include**: <ohaudio/native_audio_stream_manager.h>
10
11**Library**: libohaudio.so
12
13**System capability**: SystemCapability.Multimedia.Audio.Core
14
15**Since**: 19
16
17**Related module**: [OHAudio](capi-ohaudio.md)
18
19## Summary
20
21### Structs
22
23| Name| typedef Keyword| Description|
24| -- | -- | -- |
25| [OH_AudioStreamManager](capi-ohaudio-oh-audiostreammanager.md) | OH_AudioStreamManager | Describes an audio stream manager, which is used to manage audio streams.|
26
27### Functions
28
29| Name| Description|
30| -- | -- |
31| [OH_AudioCommon_Result OH_AudioManager_GetAudioStreamManager(OH_AudioStreamManager **streamManager)](#oh_audiomanager_getaudiostreammanager) | Obtains the handle to the audio stream manager.|
32| [OH_AudioCommon_Result OH_AudioStreamManager_GetDirectPlaybackSupport(OH_AudioStreamManager *audioStreamManager, OH_AudioStreamInfo *streamInfo,OH_AudioStream_Usage usage, OH_AudioStream_DirectPlaybackMode *directPlaybackMode)](#oh_audiostreammanager_getdirectplaybacksupport) | Obtains the direct playback mode supported by an audio stream.|
33| [OH_AudioCommon_Result OH_AudioStreamManager_IsAcousticEchoCancelerSupported(OH_AudioStreamManager *streamManager,OH_AudioStream_SourceType sourceType,bool *supported)](#oh_audiostreammanager_isacousticechocancelersupported) | Checks whether the specified audio source type supports echo cancellation.|
34| [bool OH_AudioStreamManager_IsFastPlaybackSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_Usage usage)](#oh_audiostreammanager_isfastplaybacksupported) | Checks whether the current device supports low-latency playback for the specified audio stream information and usage scenario.|
35| [bool OH_AudioStreamManager_IsFastRecordingSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_SourceType source)](#oh_audiostreammanager_isfastrecordingsupported) | Checks whether the current device supports low-latency recording for the specified audio stream information and usage scenario.|
36
37## Function Description
38
39### OH_AudioManager_GetAudioStreamManager()
40
41```
42OH_AudioCommon_Result OH_AudioManager_GetAudioStreamManager(OH_AudioStreamManager **streamManager)
43```
44
45**Description**
46
47Obtains the handle to the audio stream manager.
48
49**Since**: 19
50
51
52**Parameters**
53
54| Name| Description|
55| -- | -- |
56| [OH_AudioStreamManager](capi-ohaudio-oh-audiostreammanager.md) **streamManager | Double pointer to the audio stream manager.|
57
58**Returns**
59
60| Type| Description|
61| -- | -- |
62| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS = 0**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_SYSTEM = 6800301**: The system status is incorrect.|
63
64### OH_AudioStreamManager_GetDirectPlaybackSupport()
65
66```
67OH_AudioCommon_Result OH_AudioStreamManager_GetDirectPlaybackSupport(OH_AudioStreamManager *audioStreamManager, OH_AudioStreamInfo *streamInfo,OH_AudioStream_Usage usage, OH_AudioStream_DirectPlaybackMode *directPlaybackMode)
68```
69
70**Description**
71
72Obtains the direct playback mode supported by an audio stream.
73
74**Since**: 19
75
76
77**Parameters**
78
79| Name| Description|
80| -- | -- |
81| [OH_AudioStreamManager](capi-ohaudio-oh-audiostreammanager.md) *audioStreamManager | Handle to the audio stream manager. The handle is obtained by calling [OH_AudioManager_GetAudioStreamManager](capi-native-audio-stream-manager-h.md#oh_audiomanager_getaudiostreammanager).|
82| [OH_AudioStreamInfo](capi-ohaudio-oh-audiostreaminfo.md) *streamInfo | Pointer to the audio stream information.|
83| [OH_AudioStream_Usage](capi-native-audiostream-base-h.md#oh_audiostream_usage) usage | Usage scenario of the audio stream.|
84| [OH_AudioStream_DirectPlaybackMode](capi-native-audiostream-base-h.md#oh_audiostream_directplaybackmode) *directPlaybackMode | Pointer to [OH_AudioStream_DirectPlaybackMode](capi-native-audiostream-base-h.md#oh_audiostream_directplaybackmode), which is used to receive the direct playback mode supported.|
85
86**Returns**
87
88| Type| Description|
89| -- | -- |
90| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS = 0**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM = 6800101**:<br>1. The **audioStreamManager** parameter is nullptr.<br>2. The **streamInfo** parameter is nullptr.<br>3. The **usage** parameter is invalid.<br>4. The **directPlaybackMode** parameter is nullptr. |
91
92### OH_AudioStreamManager_IsAcousticEchoCancelerSupported()
93
94```
95OH_AudioCommon_Result OH_AudioStreamManager_IsAcousticEchoCancelerSupported(OH_AudioStreamManager *streamManager,OH_AudioStream_SourceType sourceType,bool *supported)
96```
97
98**Description**
99
100Checks whether the specified audio source type supports echo cancellation.
101
102**Since**: 20
103
104
105**Parameters**
106
107| Name| Description|
108| -- | -- |
109| [OH_AudioStreamManager](capi-ohaudio-oh-audiostreammanager.md) *streamManager | Handle to the audio stream manager. The handle is obtained by calling [OH_AudioManager_GetAudioStreamManager](capi-native-audio-stream-manager-h.md#oh_audiomanager_getaudiostreammanager).|
110| [OH_AudioStream_SourceType](capi-native-audiostream-base-h.md#oh_audiostream_sourcetype) sourceType | Usage scenario ([OH_AudioStream_SourceType](capi-native-audiostream-base-h.md#oh_audiostream_sourcetype)) of the audio input stream.|
111| bool *supported | Pointer to the check result.|
112
113**Returns**
114
115| Type| Description|
116| -- | -- |
117| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS = 0**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM = 6800101**:<br>1. The **audioStreamManager** parameter is nullptr.<br>2. The **sourceType** parameter is invalid.<br>3. The **supported** parameter is nullptr. |
118
119### OH_AudioStreamManager_IsFastPlaybackSupported()
120
121```
122bool OH_AudioStreamManager_IsFastPlaybackSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_Usage usage)
123```
124
125**Description**
126
127Checks whether the current device supports low-latency playback for the specified audio stream information and usage scenario.
128
129**Since**: 20
130
131
132**Parameters**
133
134| Name| Description|
135| -- | -- |
136| [OH_AudioStreamManager](capi-ohaudio-oh-audiostreammanager.md) *streamManager | Handle to the audio stream manager. The handle is obtained by calling [OH_AudioManager_GetAudioStreamManager](capi-native-audio-stream-manager-h.md#oh_audiomanager_getaudiostreammanager).|
137| [OH_AudioStreamInfo](capi-ohaudio-oh-audiostreaminfo.md) *streamInfo | Pointer to the audio stream information.|
138| [OH_AudioStream_Usage](capi-native-audiostream-base-h.md#oh_audiostream_usage) usage | Usage scenario of the audio stream.|
139
140**Returns**
141
142| Type| Description|
143| -- | -- |
144| bool | Check result. The value **true** is returned if low-latency playback is supported, and **false** is returned otherwise.|
145
146### OH_AudioStreamManager_IsFastRecordingSupported()
147
148```
149bool OH_AudioStreamManager_IsFastRecordingSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_SourceType source)
150```
151
152**Description**
153
154Checks whether the current device supports low-latency recording for the specified audio stream information and usage scenario.
155
156**Since**: 20
157
158
159**Parameters**
160
161| Name| Description|
162| -- | -- |
163| [OH_AudioStreamManager](capi-ohaudio-oh-audiostreammanager.md) *streamManager | Handle to the audio stream manager. The handle is obtained by calling [OH_AudioManager_GetAudioStreamManager](capi-native-audio-stream-manager-h.md#oh_audiomanager_getaudiostreammanager).|
164| [OH_AudioStreamInfo](capi-ohaudio-oh-audiostreaminfo.md) *streamInfo | Pointer to the audio stream information.|
165| [OH_AudioStream_SourceType](capi-native-audiostream-base-h.md#oh_audiostream_sourcetype) source | Usage scenario of the audio stream.|
166
167**Returns**
168
169| Type| Description|
170| -- | -- |
171| bool | Check result. The value **true** is returned if low-latency recording is supported, and **false** is returned otherwise.|
172