diff --git a/frameworks/native/audiocapturer/src/audio_capturer.cpp b/frameworks/native/audiocapturer/src/audio_capturer.cpp index 9fab77e4c898624603fdb83f2c6b439e33878aea..faf0baa52ebc730b34b0d42f4cd702fea2a76faf 100644 --- a/frameworks/native/audiocapturer/src/audio_capturer.cpp +++ b/frameworks/native/audiocapturer/src/audio_capturer.cpp @@ -92,6 +92,14 @@ std::unique_ptr AudioCapturer::Create(const AudioCapturerOptions return Create(options, cachePath, appInfo); } +std::shared_ptr AudioCapturer::CreateCapturer(const AudioCapturerOptions &options, + const AppInfo &appInfo) +{ + auto tempUniquePtr = Create(options, "", appInfo); + std::shared_ptr sharedPtr(tempUniquePtr.release()); + return sharedPtr; +} + std::unique_ptr AudioCapturer::Create(const AudioCapturerOptions &capturerOptions, const std::string cachePath, const AppInfo &appInfo) { diff --git a/frameworks/native/audiorenderer/src/audio_renderer.cpp b/frameworks/native/audiorenderer/src/audio_renderer.cpp index 06368d37f7d7d5ae07957308996adafb349b91ad..69f9f4b3eff109866a3f1d6a6d2f73602001434d 100644 --- a/frameworks/native/audiorenderer/src/audio_renderer.cpp +++ b/frameworks/native/audiorenderer/src/audio_renderer.cpp @@ -181,6 +181,14 @@ std::unique_ptr AudioRenderer::Create(const std::string cachePath return Create(cachePath, rendererOptions, appInfo); } +std::shared_ptr AudioRenderer::CreateRenderer(const AudioRendererOptions &rendererOptions, + const AppInfo &appInfo) +{ + auto tempUniquePtr = Create("", rendererOptions, appInfo); + std::shared_ptr sharedPtr(tempUniquePtr.release()); + return sharedPtr; +} + std::unique_ptr AudioRenderer::Create(const std::string cachePath, const AudioRendererOptions &rendererOptions, const AppInfo &appInfo) { diff --git a/interfaces/inner_api/native/audiocapturer/include/audio_capturer.h b/interfaces/inner_api/native/audiocapturer/include/audio_capturer.h index aa82b31ee984db455fdd0e041c7ef7c6f02178ea..0e6c427cbe8b09a83664a0e2f566c8717a1a0b17 100644 --- a/interfaces/inner_api/native/audiocapturer/include/audio_capturer.h +++ b/interfaces/inner_api/native/audiocapturer/include/audio_capturer.h @@ -168,6 +168,7 @@ public: * refer AudioCapturerOptions in audio_info.h. * @return Returns unique pointer to the AudioCapturer object * @since 8 + * @deprecated since 12 */ static std::unique_ptr Create(const AudioCapturerOptions &options); @@ -179,6 +180,7 @@ public: * @param appInfo Originating application's uid and token id can be passed here * @return Returns unique pointer to the AudioCapturer object * @since 9 + * @deprecated since 12 */ static std::unique_ptr Create(const AudioCapturerOptions &options, const AppInfo &appInfo); @@ -194,6 +196,18 @@ public: */ static std::unique_ptr Create(const AudioCapturerOptions &options, const std::string cachePath); + /** + * @brief create capturer instance. + * + * @param options The audio capturer configuration to be used while creating capturer instance. + * refer AudioCapturerOptions in audio_info.h. + * @param appInfo Originating application's uid and token id can be passed here + * @return Returns shared pointer to the AudioCapturer object + * @since 12 + */ + static std::shared_ptr CreateCapturer(const AudioCapturerOptions &options, + const AppInfo &appInfo = AppInfo()); + /** * @brief create capturer instance. * diff --git a/interfaces/inner_api/native/audiorenderer/include/audio_renderer.h b/interfaces/inner_api/native/audiorenderer/include/audio_renderer.h index f369dd10d61063c79a1610680f5a3ccfa29bf916..77b47ddce79768865d54d547a9d8d49386b3ca4e 100644 --- a/interfaces/inner_api/native/audiorenderer/include/audio_renderer.h +++ b/interfaces/inner_api/native/audiorenderer/include/audio_renderer.h @@ -194,6 +194,7 @@ public: * refer AudioRendererOptions in audio_info.h. * @return Returns unique pointer to the AudioRenderer object * @since 8 + * @deprecated since 12 */ static std::unique_ptr Create(const AudioRendererOptions &rendererOptions); @@ -205,6 +206,7 @@ public: * @param appInfo Originating application's uid and token id can be passed here * @return Returns unique pointer to the AudioRenderer object * @since 9 + * @deprecated since 12 */ static std::unique_ptr Create(const AudioRendererOptions &options, const AppInfo &appInfo); @@ -221,6 +223,18 @@ public: static std::unique_ptr Create(const std::string cachePath, const AudioRendererOptions &rendererOptions); + /** + * @brief create renderer instance. + * + * @param rendererOptions The audio renderer configuration to be used while creating renderer instance. + * refer AudioRendererOptions in audio_info.h. + * @param appInfo Originating application's uid and token id can be passed here + * @return Returns shared pointer to the AudioRenderer object + * @since 12 + */ + static std::shared_ptr CreateRenderer(const AudioRendererOptions &rendererOptions, + const AppInfo &appInfo = AppInfo()); + /** * @brief create renderer instance. *