17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci/**
177777dab0Sopenharmony_ci * @addtogroup OHAudio
187777dab0Sopenharmony_ci * @{
197777dab0Sopenharmony_ci *
207777dab0Sopenharmony_ci * @brief Provide the definition of the C interface for the audio module.
217777dab0Sopenharmony_ci *
227777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Audio.Core
237777dab0Sopenharmony_ci *
247777dab0Sopenharmony_ci * @since 10
257777dab0Sopenharmony_ci * @version 1.0
267777dab0Sopenharmony_ci */
277777dab0Sopenharmony_ci
287777dab0Sopenharmony_ci/**
297777dab0Sopenharmony_ci * @file native_audiostreambuilder.h
307777dab0Sopenharmony_ci *
317777dab0Sopenharmony_ci * @brief Declare audio stream builder related interfaces.
327777dab0Sopenharmony_ci *
337777dab0Sopenharmony_ci * @library libohaudio.so
347777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Audio.Core
357777dab0Sopenharmony_ci * @kit AudioKit
367777dab0Sopenharmony_ci * @since 10
377777dab0Sopenharmony_ci * @version 1.0
387777dab0Sopenharmony_ci */
397777dab0Sopenharmony_ci
407777dab0Sopenharmony_ci#ifndef NATIVE_AUDIOSTREAM_BUILDER_H
417777dab0Sopenharmony_ci#define NATIVE_AUDIOSTREAM_BUILDER_H
427777dab0Sopenharmony_ci
437777dab0Sopenharmony_ci#include "native_audiostream_base.h"
447777dab0Sopenharmony_ci#include "native_audiorenderer.h"
457777dab0Sopenharmony_ci#ifdef __cplusplus
467777dab0Sopenharmony_ciextern "C" {
477777dab0Sopenharmony_ci#endif
487777dab0Sopenharmony_ci
497777dab0Sopenharmony_ci/**
507777dab0Sopenharmony_ci * Create a stremBuilder can be used to open a renderer or capturer client.
517777dab0Sopenharmony_ci *
527777dab0Sopenharmony_ci * OH_AudioStreamBuilder_Destroy() must be called when you are done using the builder.
537777dab0Sopenharmony_ci *
547777dab0Sopenharmony_ci * @since 10
557777dab0Sopenharmony_ci *
567777dab0Sopenharmony_ci * @param builder The builder reference to the created result.
577777dab0Sopenharmony_ci * @param type The stream type to be created. {@link #AUDIOSTREAM_TYPE_RENDERER} or {@link #AUDIOSTREAM_TYPE_CAPTURER}
587777dab0Sopenharmony_ci * @return Function result code:
597777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
607777dab0Sopenharmony_ci */
617777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_Create(OH_AudioStreamBuilder** builder, OH_AudioStream_Type type);
627777dab0Sopenharmony_ci
637777dab0Sopenharmony_ci/**
647777dab0Sopenharmony_ci * Destroy a streamBulder.
657777dab0Sopenharmony_ci *
667777dab0Sopenharmony_ci * This function must be called when you are done using the builder.
677777dab0Sopenharmony_ci *
687777dab0Sopenharmony_ci * @since 10
697777dab0Sopenharmony_ci *
707777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
717777dab0Sopenharmony_ci * @return Function result code:
727777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
737777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of builder is nullptr.
747777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_ILLEGAL_STATE} Execution status exception.
757777dab0Sopenharmony_ci */
767777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_Destroy(OH_AudioStreamBuilder* builder);
777777dab0Sopenharmony_ci
787777dab0Sopenharmony_ci/*
797777dab0Sopenharmony_ci * Set the channel count of the capturer client
807777dab0Sopenharmony_ci *
817777dab0Sopenharmony_ci * @since 10
827777dab0Sopenharmony_ci *
837777dab0Sopenharmony_ci * @param capturer Reference created by OH_AudioStreamBuilder
847777dab0Sopenharmony_ci * @param channelCount Pointer to a variable that will be set for the channel count.
857777dab0Sopenharmony_ci * @return Function result code:
867777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
877777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
887777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
897777dab0Sopenharmony_ci *                                                 2.The param of rate invalid.
907777dab0Sopenharmony_ci */
917777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetSamplingRate(OH_AudioStreamBuilder* builder, int32_t rate);
927777dab0Sopenharmony_ci
937777dab0Sopenharmony_ci/*
947777dab0Sopenharmony_ci * Set the channel count of the stream client
957777dab0Sopenharmony_ci *
967777dab0Sopenharmony_ci * @since 10
977777dab0Sopenharmony_ci *
987777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
997777dab0Sopenharmony_ci * @param channelCount The channel count.
1007777dab0Sopenharmony_ci * @return Function result code:
1017777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
1027777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
1037777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
1047777dab0Sopenharmony_ci *                                                 2.The param of channelCount invalid.
1057777dab0Sopenharmony_ci */
1067777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetChannelCount(OH_AudioStreamBuilder* builder, int32_t channelCount);
1077777dab0Sopenharmony_ci
1087777dab0Sopenharmony_ci/*
1097777dab0Sopenharmony_ci * Set the sample format of the stream client
1107777dab0Sopenharmony_ci *
1117777dab0Sopenharmony_ci * @since 10
1127777dab0Sopenharmony_ci *
1137777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
1147777dab0Sopenharmony_ci * @param format Sample data format.
1157777dab0Sopenharmony_ci * @return Function result code:
1167777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
1177777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of builder is nullptr.
1187777dab0Sopenharmony_ci */
1197777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetSampleFormat(OH_AudioStreamBuilder* builder,
1207777dab0Sopenharmony_ci    OH_AudioStream_SampleFormat format);
1217777dab0Sopenharmony_ci
1227777dab0Sopenharmony_ci/*
1237777dab0Sopenharmony_ci * Set the encoding type of the stream client
1247777dab0Sopenharmony_ci *
1257777dab0Sopenharmony_ci * @since 10
1267777dab0Sopenharmony_ci *
1277777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
1287777dab0Sopenharmony_ci * @param encodingType Encoding type for the stream client, {@link #AUDIOSTREAM_ENCODING_PCM}
1297777dab0Sopenharmony_ci * @return Function result code:
1307777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
1317777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of builder is nullptr.
1327777dab0Sopenharmony_ci */
1337777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetEncodingType(OH_AudioStreamBuilder* builder,
1347777dab0Sopenharmony_ci    OH_AudioStream_EncodingType encodingType);
1357777dab0Sopenharmony_ci
1367777dab0Sopenharmony_ci/*
1377777dab0Sopenharmony_ci * Set the latency mode of the stream client
1387777dab0Sopenharmony_ci *
1397777dab0Sopenharmony_ci * @since 10
1407777dab0Sopenharmony_ci *
1417777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
1427777dab0Sopenharmony_ci * @param latencyMode Latency mode for the stream client.
1437777dab0Sopenharmony_ci * @return Function result code:
1447777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
1457777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of builder is nullptr.
1467777dab0Sopenharmony_ci */
1477777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetLatencyMode(OH_AudioStreamBuilder* builder,
1487777dab0Sopenharmony_ci    OH_AudioStream_LatencyMode latencyMode);
1497777dab0Sopenharmony_ci
1507777dab0Sopenharmony_ci/**
1517777dab0Sopenharmony_ci * @brief Set the channel layout to the stream client
1527777dab0Sopenharmony_ci *
1537777dab0Sopenharmony_ci * @since 12
1547777dab0Sopenharmony_ci *
1557777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
1567777dab0Sopenharmony_ci * @param channelLayout is the layout of the speaker.
1577777dab0Sopenharmony_ci * @return Function result code:
1587777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
1597777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of builder is nullptr.
1607777dab0Sopenharmony_ci */
1617777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetChannelLayout(OH_AudioStreamBuilder* builder,
1627777dab0Sopenharmony_ci    OH_AudioChannelLayout channelLayout);
1637777dab0Sopenharmony_ci
1647777dab0Sopenharmony_ci/*
1657777dab0Sopenharmony_ci * Set the renderer information of the stream client
1667777dab0Sopenharmony_ci *
1677777dab0Sopenharmony_ci * @since 10
1687777dab0Sopenharmony_ci *
1697777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
1707777dab0Sopenharmony_ci * @param usage Set the stream usage for the renderer client.
1717777dab0Sopenharmony_ci * @return Function result code:
1727777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
1737777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
1747777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
1757777dab0Sopenharmony_ci *                                                 2.The param of usage invalid.
1767777dab0Sopenharmony_ci */
1777777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetRendererInfo(OH_AudioStreamBuilder* builder,
1787777dab0Sopenharmony_ci    OH_AudioStream_Usage usage);
1797777dab0Sopenharmony_ci
1807777dab0Sopenharmony_ci/*
1817777dab0Sopenharmony_ci * Set the capturer information of the stream client
1827777dab0Sopenharmony_ci *
1837777dab0Sopenharmony_ci * @since 10
1847777dab0Sopenharmony_ci *
1857777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
1867777dab0Sopenharmony_ci * @param sourceType Set the source type for the capturer client.
1877777dab0Sopenharmony_ci * @return Function result code:
1887777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
1897777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
1907777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
1917777dab0Sopenharmony_ci *                                                 2.The param of sourceType invalid.
1927777dab0Sopenharmony_ci */
1937777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInfo(OH_AudioStreamBuilder* builder,
1947777dab0Sopenharmony_ci    OH_AudioStream_SourceType sourceType);
1957777dab0Sopenharmony_ci
1967777dab0Sopenharmony_ci/*
1977777dab0Sopenharmony_ci * Set the callbacks for the renderer client
1987777dab0Sopenharmony_ci *
1997777dab0Sopenharmony_ci * @since 10
2007777dab0Sopenharmony_ci *
2017777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
2027777dab0Sopenharmony_ci * @param callbacks Callbacks to the functions that will process renderer stream.
2037777dab0Sopenharmony_ci * @param userData Pointer to an application data structure that will be passed to the callback functions.
2047777dab0Sopenharmony_ci * @return Function result code:
2057777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
2067777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
2077777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
2087777dab0Sopenharmony_ci *                                                 2.StreamType invalid.
2097777dab0Sopenharmony_ci */
2107777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetRendererCallback(OH_AudioStreamBuilder* builder,
2117777dab0Sopenharmony_ci    OH_AudioRenderer_Callbacks callbacks, void* userData);
2127777dab0Sopenharmony_ci
2137777dab0Sopenharmony_ci/**
2147777dab0Sopenharmony_ci * @brief Set the callback when the output device of an audio renderer changed.
2157777dab0Sopenharmony_ci *
2167777dab0Sopenharmony_ci * @since 11
2177777dab0Sopenharmony_ci *
2187777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
2197777dab0Sopenharmony_ci * @param callback Callback to the function that will process this device change event.
2207777dab0Sopenharmony_ci * @param userData Pointer to an application data structure that will be passed to the callback functions.
2217777dab0Sopenharmony_ci * @return Function result code:
2227777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
2237777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
2247777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
2257777dab0Sopenharmony_ci *                                                 2.StreamType invalid.
2267777dab0Sopenharmony_ci */
2277777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback(OH_AudioStreamBuilder* builder,
2287777dab0Sopenharmony_ci    OH_AudioRenderer_OutputDeviceChangeCallback callback, void* userData);
2297777dab0Sopenharmony_ci
2307777dab0Sopenharmony_ci/**
2317777dab0Sopenharmony_ci * @brief Set the privacy of audio render.
2327777dab0Sopenharmony_ci *
2337777dab0Sopenharmony_ci * @since 12
2347777dab0Sopenharmony_ci *
2357777dab0Sopenharmony_ci * @param builder Builder provided by OH_AudioStreamBuilder_Create()
2367777dab0Sopenharmony_ci * @param privacy Privacy type.
2377777dab0Sopenharmony_ci * @return Function result code:
2387777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
2397777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
2407777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
2417777dab0Sopenharmony_ci *                                                 2.StreamType invalid.
2427777dab0Sopenharmony_ci */
2437777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetRendererPrivacy(OH_AudioStreamBuilder* builder,
2447777dab0Sopenharmony_ci    OH_AudioStream_PrivacyType privacy);
2457777dab0Sopenharmony_ci
2467777dab0Sopenharmony_ci/*
2477777dab0Sopenharmony_ci * Set the callbacks for the capturer client
2487777dab0Sopenharmony_ci *
2497777dab0Sopenharmony_ci * @since 10
2507777dab0Sopenharmony_ci *
2517777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
2527777dab0Sopenharmony_ci * @param callbacks Callbacks to the functions that will process capturer stream.
2537777dab0Sopenharmony_ci * @param userData Pointer to an application data structure that will be passed to the callback functions.
2547777dab0Sopenharmony_ci * @return Function result code:
2557777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
2567777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
2577777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
2587777dab0Sopenharmony_ci *                                                 2.StreamType invalid.
2597777dab0Sopenharmony_ci */
2607777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerCallback(OH_AudioStreamBuilder* builder,
2617777dab0Sopenharmony_ci    OH_AudioCapturer_Callbacks callbacks, void* userData);
2627777dab0Sopenharmony_ci
2637777dab0Sopenharmony_ci/*
2647777dab0Sopenharmony_ci * Create the audio renderer client.
2657777dab0Sopenharmony_ci *
2667777dab0Sopenharmony_ci * @since 10
2677777dab0Sopenharmony_ci *
2687777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
2697777dab0Sopenharmony_ci * @param audioRenderer Pointer to a viriable to receive the stream client.
2707777dab0Sopenharmony_ci * @return Function result code:
2717777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
2727777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
2737777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
2747777dab0Sopenharmony_ci *                                                 2.StreamType invalid;
2757777dab0Sopenharmony_ci *                                                 3.Create OHAudioRenderer failed.
2767777dab0Sopenharmony_ci */
2777777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_GenerateRenderer(OH_AudioStreamBuilder* builder,
2787777dab0Sopenharmony_ci    OH_AudioRenderer** audioRenderer);
2797777dab0Sopenharmony_ci
2807777dab0Sopenharmony_ci/*
2817777dab0Sopenharmony_ci * Create the audio capturer client.
2827777dab0Sopenharmony_ci *
2837777dab0Sopenharmony_ci * @since 10
2847777dab0Sopenharmony_ci *
2857777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
2867777dab0Sopenharmony_ci * @param audioCapturer Pointer to a viriable to receive the stream client.
2877777dab0Sopenharmony_ci * @return Function result code:
2887777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
2897777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
2907777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
2917777dab0Sopenharmony_ci *                                                 2.StreamType invalid;
2927777dab0Sopenharmony_ci *                                                 3.Create OHAudioRenderer failed.
2937777dab0Sopenharmony_ci */
2947777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_GenerateCapturer(OH_AudioStreamBuilder* builder,
2957777dab0Sopenharmony_ci    OH_AudioCapturer** audioCapturer);
2967777dab0Sopenharmony_ci
2977777dab0Sopenharmony_ci/*
2987777dab0Sopenharmony_ci * Set the data frame size for each callback, use this function if the application requires a specific number
2997777dab0Sopenharmony_ci * of frames for processing.
3007777dab0Sopenharmony_ci * The frame size should be at least the size device process at one time, and less than half the internal
3017777dab0Sopenharmony_ci * buffer capacity.
3027777dab0Sopenharmony_ci *
3037777dab0Sopenharmony_ci * @since 11
3047777dab0Sopenharmony_ci *
3057777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
3067777dab0Sopenharmony_ci * @param frameSize  The data frame size for each callback.
3077777dab0Sopenharmony_ci * @return Function result code:
3087777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
3097777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of builder is nullptr.
3107777dab0Sopenharmony_ci */
3117777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetFrameSizeInCallback(OH_AudioStreamBuilder* builder,
3127777dab0Sopenharmony_ci    int32_t frameSize);
3137777dab0Sopenharmony_ci
3147777dab0Sopenharmony_ci/**
3157777dab0Sopenharmony_ci * @brief Set the callback of writing metadata to the renderer client
3167777dab0Sopenharmony_ci *
3177777dab0Sopenharmony_ci * @since 12
3187777dab0Sopenharmony_ci *
3197777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
3207777dab0Sopenharmony_ci * @param callback Callback to the functions that will write audio data with metadata to the renderer.
3217777dab0Sopenharmony_ci * @param userData Pointer to an application data structure that will be passed to the callback functions.
3227777dab0Sopenharmony_ci * @return Function result code:
3237777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
3247777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
3257777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
3267777dab0Sopenharmony_ci *                                                 2.StreamType invalid.
3277777dab0Sopenharmony_ci */
3287777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetWriteDataWithMetadataCallback(OH_AudioStreamBuilder* builder,
3297777dab0Sopenharmony_ci    OH_AudioRenderer_WriteDataWithMetadataCallback callback, void* userData);
3307777dab0Sopenharmony_ci
3317777dab0Sopenharmony_ci/**
3327777dab0Sopenharmony_ci * @brief Set the interrupt mode of the stream client
3337777dab0Sopenharmony_ci *
3347777dab0Sopenharmony_ci * @since 12
3357777dab0Sopenharmony_ci *
3367777dab0Sopenharmony_ci * @param builder Reference provided by OH_AudioStreamBuilder_Create()
3377777dab0Sopenharmony_ci * @param mode The audio interrupt mode
3387777dab0Sopenharmony_ci * @return Function result code:
3397777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_SUCCESS} If the execution is successful.
3407777dab0Sopenharmony_ci *         {@link AUDIOSTREAM_ERROR_INVALID_PARAM}:
3417777dab0Sopenharmony_ci *                                                 1.The param of builder is nullptr;
3427777dab0Sopenharmony_ci *                                                 2.The param of mode invalid;
3437777dab0Sopenharmony_ci *                                                 3.StreamType invalid.
3447777dab0Sopenharmony_ci */
3457777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetRendererInterruptMode(OH_AudioStreamBuilder* builder,
3467777dab0Sopenharmony_ci    OH_AudioInterrupt_Mode mode);
3477777dab0Sopenharmony_ci
3487777dab0Sopenharmony_ci/**
3497777dab0Sopenharmony_ci * @brief Set the callback of writing data to renderer client.
3507777dab0Sopenharmony_ci *
3517777dab0Sopenharmony_ci * This function is similar with {@link OH_AudioStreamBuilder_SetRendererCallback}. Only the last callback set by
3527777dab0Sopenharmony_ci * OH_AudioStreamBuilder_SetRendererCallback or this function will become effective.
3537777dab0Sopenharmony_ci *
3547777dab0Sopenharmony_ci * @param builder Builder provided by OH_AudioStreamBuilder_Create()
3557777dab0Sopenharmony_ci * @param callback Callback to functions that will write audio data to renderer client.
3567777dab0Sopenharmony_ci * @param userData Pointer to an application data structure that will be passed to the callback functions.
3577777dab0Sopenharmony_ci * @return Result code.
3587777dab0Sopenharmony_ci *     {@link AUDIOSTREAM_SUCCESS} Success.
3597777dab0Sopenharmony_ci *     {@link AUDIOSTREAM_ERROR_INVALID_PARAM} Parameter is invalid, e.g. builder is nullptr, e.t.c.
3607777dab0Sopenharmony_ci * @since 12
3617777dab0Sopenharmony_ci */
3627777dab0Sopenharmony_ciOH_AudioStream_Result OH_AudioStreamBuilder_SetRendererWriteDataCallback(OH_AudioStreamBuilder* builder,
3637777dab0Sopenharmony_ci    OH_AudioRenderer_OnWriteDataCallback callback, void* userData);
3647777dab0Sopenharmony_ci#ifdef __cplusplus
3657777dab0Sopenharmony_ci}
3667777dab0Sopenharmony_ci#endif
3677777dab0Sopenharmony_ci
3687777dab0Sopenharmony_ci#endif // NATIVE_AUDIOSTREAM_BUILDER_H
369