From 6834c2f9c5399bf56076ee17fe74fbd0462bb660 Mon Sep 17 00:00:00 2001 From: whoselittlelion Date: Tue, 12 Sep 2023 14:38:53 +0800 Subject: [PATCH 1/3] fix:add offload stream Signed-off-by: whoselittlelion --- audio/v1_0/AudioTypes.idl | 17 +++++++++++++++++ audio/v1_0/IAudioRender.idl | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/audio/v1_0/AudioTypes.idl b/audio/v1_0/AudioTypes.idl index a9ea9ab0..263b4f25 100644 --- a/audio/v1_0/AudioTypes.idl +++ b/audio/v1_0/AudioTypes.idl @@ -73,6 +73,7 @@ enum AudioCategory { AUDIO_IN_RINGTONE = 2, /**< Ringtone */ AUDIO_IN_CALL = 3, /**< Call */ AUDIO_MMAP_NOIRQ = 4, /**< Mmap mode */ + AUDIO_OFFLOAD = 5, /**< Offload */ }; /** @@ -83,6 +84,8 @@ enum AudioFormat { AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16-bit PCM */ AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24-bit PCM */ AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32-bit PCM */ + AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< FLOAT PCM */ + AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3 */ AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main */ AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC */ AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD */ @@ -350,6 +353,19 @@ enum AudioInputType { AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< Assigned voice recognition input type */ }; +/** + * @brief Defines audio offload attributes. + */ +struct AudioOffloadInfo +{ + unsigned int sampleRate; /**< Audio sampling rate */ + unsigned int channelCount; /**< Number of audio channels */ + unsigned int bitRate; /**< bitRate of compressed audio data */ + unsigned int bitWidth; /**< bitwidth of audio data */ + unsigned int offloadBufferSize; /**< buffersize for offload audio data */ + unsigned long duration; /** audio duration, unit is nanosecond*/ +}; + /** * @brief Defines audio sampling attributes. */ @@ -370,6 +386,7 @@ struct AudioSampleAttributes { unsigned int silenceThreshold; /**< Audio capture buffer threshold. */ int streamId; /**< Audio Identifier of render or capture */ int sourceType; /**< Audio sourceType of render or capture */ + AudioOffloadInfo offloadInfo; /**< offload info for offload stream */ }; /** diff --git a/audio/v1_0/IAudioRender.idl b/audio/v1_0/IAudioRender.idl index 14b9d39c..3e980f03 100644 --- a/audio/v1_0/IAudioRender.idl +++ b/audio/v1_0/IAudioRender.idl @@ -462,4 +462,13 @@ interface IAudioRender { * @see IsSupportsPauseAndResume */ IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + + /** + * @brief Set offload buffer size. + * + * @param handle Indicates the audio handle. + * @param size Indicates the buffer size which contains the audio data. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + SetBufferSize([in] unsigned int size); } -- Gitee From 78b6bd8806cf22e1b219290296345c177b5fd2e2 Mon Sep 17 00:00:00 2001 From: whoselittlelion Date: Wed, 13 Sep 2023 13:24:34 +0000 Subject: [PATCH 2/3] update audio/v1_0/AudioTypes.idl. Signed-off-by: whoselittlelion --- audio/v1_0/AudioTypes.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/v1_0/AudioTypes.idl b/audio/v1_0/AudioTypes.idl index 263b4f25..6edf2a8f 100644 --- a/audio/v1_0/AudioTypes.idl +++ b/audio/v1_0/AudioTypes.idl @@ -386,7 +386,7 @@ struct AudioSampleAttributes { unsigned int silenceThreshold; /**< Audio capture buffer threshold. */ int streamId; /**< Audio Identifier of render or capture */ int sourceType; /**< Audio sourceType of render or capture */ - AudioOffloadInfo offloadInfo; /**< offload info for offload stream */ + struct AudioOffloadInfo offloadInfo; /**< offload info for offload stream */ }; /** -- Gitee From b50a0da4d7aaa66a6ca8cab2bf7a684c4b911889 Mon Sep 17 00:00:00 2001 From: whoselittlelion Date: Thu, 14 Sep 2023 12:05:03 +0000 Subject: [PATCH 3/3] update audio/v1_0/AudioTypes.idl. Signed-off-by: whoselittlelion --- audio/v1_0/AudioTypes.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/audio/v1_0/AudioTypes.idl b/audio/v1_0/AudioTypes.idl index 6edf2a8f..4ca318aa 100644 --- a/audio/v1_0/AudioTypes.idl +++ b/audio/v1_0/AudioTypes.idl @@ -362,6 +362,7 @@ struct AudioOffloadInfo unsigned int channelCount; /**< Number of audio channels */ unsigned int bitRate; /**< bitRate of compressed audio data */ unsigned int bitWidth; /**< bitwidth of audio data */ + enum AudioFormat format; /**< Audio data format. */ unsigned int offloadBufferSize; /**< buffersize for offload audio data */ unsigned long duration; /** audio duration, unit is nanosecond*/ }; -- Gitee