diff --git a/multimedia/audio_framework/audio_manager/native_audio_stream_manager.h b/multimedia/audio_framework/audio_manager/native_audio_stream_manager.h new file mode 100644 index 0000000000000000000000000000000000000000..4e7ae2b86508bbee3abce79d92591846cb924c0e --- /dev/null +++ b/multimedia/audio_framework/audio_manager/native_audio_stream_manager.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OHAudio + * @{ + * + * @brief Provide the definition of the C interface for the audio module. + * + * @syscap SystemCapability.Multimedia.Audio.Core + * + * @since 12 + * @version 1.0 + */ + +/** + * @file native_audio_stream_manager.h + * + * @brief Declare audio stream manager related interfaces. + * + * This file interface is used for the creation of audioStreamManager + * as well as the audio stream settings and management. + * + * @library libohaudio.so + * @syscap SystemCapability.Multimedia.Audio.Core + * @kit AudioKit + * @since 16 + * @version 1.0 + */ + +#ifndef NATIVE_AUDIO_STREAM_MANAGER_H +#define NATIVE_AUDIO_STREAM_MANAGER_H + +#include "native_audiostream_base.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Declaring the audio stream manager. + * The handle of audio stream manager used for audio stream settings and management. + * + * @since 16 + */ +typedef struct OH_AudioStreamManager OH_AudioStreamManager; + +/** + * @brief Query the audio stream manager handle. + * which should be set as the first parameter in stream management releated functions. + * + * @param audioStreamManager the {@link OH_AudioStreamManager} + * handle returned by {@link OH_AudioManager_GetAudioStreamManager}. + * @return Function result code: + * {@link AUDIOCOMMON_RESULT_SUCCESS} If the execution is successful. + * @since 16 + */ +OH_AudioCommon_Result OH_AudioManager_GetAudioStreamManager(OH_AudioStreamManager **audioStreamManager); + +/** + * @brief Gets if playback is supported with current active device according to the input audio format. + * + * @param audioStreamManager the {@link OH_AudioStreamManager} + * handle returned by {@link OH_AudioManager_GetAudioStreamManager}. + * @param usage the {@link OH_AudioStream_Usage}. + * @param encodingType the {@link OH_AudioStream_EncodingType}. + * @param format the {@link @OH_AudioStream_SampleFormat}. + * @param channelCount the channel count. + * @param smplingRate the sampling rate. + * @param supported query result. + * @return Function result code: + * {@link AUDIOCOMMON_RESULT_SUCCESS} If the execution is successful. + * {@link AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM}: + * 1.The param of audioRoutingManager is nullptr; + * 2.The param of supported is nullptr. + * @return Function result code: + * {@link AUDIOCOMMON_RESULT_SUCCESS} If the execution is successful. + * {@link AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM}: + * 1.The param of audioStreamManager is nullptr; + * 2.The param of usage invalid; + * 3.The param of encodingType invalid; + * 4.The param of format invalid; + * 2.The param of channelCount invalid; + * 2.The param of samplingRate invalid; + * @since 16 + */ +OH_AudioCommon_Result OH_AudioStreamManager_IsPlaybackSupported( + OH_AudioStreamManager *audioStreamManager, OH_AudioStream_Usage usage, + OH_AudioStream_EncodingType encodingType, OH_AudioStream_SampleFormat format, + int32_t channelCount, int32_t samplingRate, bool *supported); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AUDIO_STREAM_MANAGER_H +/** @} */ diff --git a/multimedia/audio_framework/common/native_audio_device_base.h b/multimedia/audio_framework/common/native_audio_device_base.h index bb8f3f9f8dff0a12658355f9a3820b0ca982b3c9..48ae2664363b23f879592bc6d7986110c9539f56 100644 --- a/multimedia/audio_framework/common/native_audio_device_base.h +++ b/multimedia/audio_framework/common/native_audio_device_base.h @@ -143,6 +143,27 @@ typedef enum { */ AUDIO_DEVICE_TYPE_REMOTE_CAST = 24, + /** + * @brief Accessory device, such as the microphone on remote control. + * + * @since 16 + */ + AUDIO_DEVICE_TYPE_ACCESSORY = 26, + + /** + * @brief HDMI device, such as HDMI, ARC, eARC. + * + * @since 16 + */ + AUDIO_DEVICE_TYPE_HDMI = 27, + + /** + * @brief Line connected digital output device, such as s/pdif. + * + * @since 16 + */ + AUDIO_DEVICE_TYPE_LINE_DIGITAL = 28, + /** * @brief Default device type. */ diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index 894bc4fd429bea1c77b2254b36700ecb42d51858..2c66db780587ef13902d0f3f1cfe868cdeb58273 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -152,6 +152,12 @@ typedef enum { * @since 12 */ AUDIOSTREAM_ENCODING_TYPE_AUDIOVIVID = 1, + /** + * AC3 encoding type. + * + * @since 16 + */ + AUDIOSTREAM_ENCODING_TYPE_AC3 = 2, } OH_AudioStream_EncodingType; /**