From f4f344f9ca5f7a85ea4259d388acd1586410f4d6 Mon Sep 17 00:00:00 2001 From: hwzhangchuang Date: Sun, 25 Jun 2023 11:48:19 +0800 Subject: [PATCH 1/3] add histreamer ability query Signed-off-by: hwzhangchuang --- audiohandler/BUILD.gn | 2 ++ audiohandler/src/daudio_handler.cpp | 12 +++++++++++- common/include/daudio_constants.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/audiohandler/BUILD.gn b/audiohandler/BUILD.gn index 4de65870..ef3b950c 100644 --- a/audiohandler/BUILD.gn +++ b/audiohandler/BUILD.gn @@ -19,6 +19,7 @@ ohos_shared_library("distributed_audio_handler") { include_dirs = [ "//third_party/json/include", "${fwk_common_path}/utils/include", + "${fwk_utils_path}/include", "${mediastandardfwk_path}/audiomanager/include", "${mediastandardfwk_path}/audiocommon/include", "${mediastandardfwk_path}/audiocapturer/include", @@ -40,6 +41,7 @@ ohos_shared_library("distributed_audio_handler") { "c_utils:utils", "multimedia_image_framework:image_native", "player_framework:media_client", + "distributed_hardware_fwk:distributedhardwareutils" ] defines = [ diff --git a/audiohandler/src/daudio_handler.cpp b/audiohandler/src/daudio_handler.cpp index 3b05a3b0..314b2a48 100644 --- a/audiohandler/src/daudio_handler.cpp +++ b/audiohandler/src/daudio_handler.cpp @@ -22,6 +22,7 @@ #include "nlohmann/json.hpp" #include "string_ex.h" +#include "histreamer_query_tool.h" #include "daudio_constants.h" #include "daudio_errorcode.h" #include "daudio_log.h" @@ -69,7 +70,7 @@ int32_t DAudioHandler::Initialize() std::vector DAudioHandler::Query() { - DHLOGD("Query distributed hardware information."); + DHLOGI("Query distributed hardware information."); auto audioSrv = AudioStandard::AudioSystemManager::GetInstance(); std::vector dhItemVec; if (audioSrv == nullptr) { @@ -94,6 +95,15 @@ std::vector DAudioHandler::Query() } infoJson["INTERRUPT_GROUP_ID"] = dev->interruptGroupId_; infoJson["VOLUME_GROUP_ID"] = dev->volumeGroupId_; + + std::string audioEncoders = HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::AUDIO_ENCODER); + DHLOGI("DScreen QueryAudioEncoderAbility info: %s", audioEncoders.c_str()); + infoJson[KEY_HISTREAMER_AUDIO_ENCODER] = audioEncoders; + + std::string audioDecoders = HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::AUDIO_DECODER); + DHLOGI("DScreen QueryAudioDecoderAbility info: %s", audioDecoders.c_str()); + infoJson[KEY_HISTREAMER_AUDIO_DECODER] = audioDecoders; + DHItem dhItem; dhItem.dhId = std::to_string(dhId); dhItem.attrs = infoJson.dump(); diff --git a/common/include/daudio_constants.h b/common/include/daudio_constants.h index 5b84d568..1b6c86b1 100644 --- a/common/include/daudio_constants.h +++ b/common/include/daudio_constants.h @@ -84,6 +84,9 @@ const std::string NAME = "name"; const std::string KEY_CODECTYPE = "codecType"; const std::string KEY_DEVICE_TYPE = "deviceType"; +const std::string KEY_HISTREAMER_AUDIO_ENCODER = "histmAudEnc"; +const std::string KEY_HISTREAMER_AUDIO_DECODER = "histmAudDec"; + const std::string HDF_EVENT_RESULT_SUCCESS = "DH_SUCCESS"; const std::string HDF_EVENT_RESULT_FAILED = "DH_FAILED"; -- Gitee From 197593015e01cf6aabea4c672cafc2257cb3ad2e Mon Sep 17 00:00:00 2001 From: hwzhangchuang Date: Sun, 25 Jun 2023 14:32:17 +0800 Subject: [PATCH 2/3] patch Signed-off-by: hwzhangchuang --- audiohandler/src/daudio_handler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/audiohandler/src/daudio_handler.cpp b/audiohandler/src/daudio_handler.cpp index 314b2a48..094f6d78 100644 --- a/audiohandler/src/daudio_handler.cpp +++ b/audiohandler/src/daudio_handler.cpp @@ -96,11 +96,13 @@ std::vector DAudioHandler::Query() infoJson["INTERRUPT_GROUP_ID"] = dev->interruptGroupId_; infoJson["VOLUME_GROUP_ID"] = dev->volumeGroupId_; - std::string audioEncoders = HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::AUDIO_ENCODER); + std::string audioEncoders = + HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::AUDIO_ENCODER); DHLOGI("DScreen QueryAudioEncoderAbility info: %s", audioEncoders.c_str()); infoJson[KEY_HISTREAMER_AUDIO_ENCODER] = audioEncoders; - std::string audioDecoders = HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::AUDIO_DECODER); + std::string audioDecoders = + HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::AUDIO_DECODER); DHLOGI("DScreen QueryAudioDecoderAbility info: %s", audioDecoders.c_str()); infoJson[KEY_HISTREAMER_AUDIO_DECODER] = audioDecoders; -- Gitee From bd431a7297600e2aa6b0de09aa7e7ba9d0b8cd74 Mon Sep 17 00:00:00 2001 From: hwzhangchuang Date: Sun, 25 Jun 2023 15:03:19 +0800 Subject: [PATCH 3/3] patch Signed-off-by: hwzhangchuang --- audiohandler/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audiohandler/BUILD.gn b/audiohandler/BUILD.gn index ef3b950c..a18d3e1a 100644 --- a/audiohandler/BUILD.gn +++ b/audiohandler/BUILD.gn @@ -39,9 +39,9 @@ ohos_shared_library("distributed_audio_handler") { "audio_framework:audio_capturer", "audio_framework:audio_client", "c_utils:utils", + "distributed_hardware_fwk:distributedhardwareutils", "multimedia_image_framework:image_native", "player_framework:media_client", - "distributed_hardware_fwk:distributedhardwareutils" ] defines = [ -- Gitee