From ab4d7edf63fcbd15e008581f1d08b84c56bdfc4d Mon Sep 17 00:00:00 2001 From: chenzhaohui Date: Wed, 25 Dec 2024 15:08:24 +0800 Subject: [PATCH] heif encode for device query Signed-off-by: chenzhaohui Change-Id: I5acb0b8d594cb0c7a4cbb17115cc6b64f0f61df8 --- .../innerkitsimpl/codec/src/image_packer.cpp | 21 ++++++++----------- interfaces/innerkits/BUILD.gn | 5 ++++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frameworks/innerkitsimpl/codec/src/image_packer.cpp b/frameworks/innerkitsimpl/codec/src/image_packer.cpp index 26636a64d..487bb06ab 100644 --- a/frameworks/innerkitsimpl/codec/src/image_packer.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_packer.cpp @@ -30,6 +30,8 @@ #include "include/jpeg_encoder.h" #endif #ifdef HEIF_HW_ENCODE_ENABLE +#include "image/v2_0/icodec_image.h" +#include "image/v2_0/codec_image_type.h" #include "v3_0/codec_types.h" #include "v3_0/icodec_component_manager.h" #endif @@ -64,24 +66,19 @@ static bool IsEncodeSecureMode(const std::string &name) static bool IsSupportHeifEncode() { #ifdef HEIF_HW_ENCODE_ENABLE - sptr manager = - HDI::Codec::V3_0::ICodecComponentManager::Get(false); - if (manager == nullptr) { + sptr image = + HDI::Codec::Image::V2_0::ICodecImage::Get(false); + if (image == nullptr) { return false; } - int32_t compCnt = 0; - int32_t ret = manager->GetComponentNum(compCnt); - if (ret != HDF_SUCCESS || compCnt <= 0) { - return false; - } - std::vector capList(compCnt); - ret = manager->GetComponentCapabilityList(capList, compCnt); + std::vector capList; + int32_t ret = image->GetImageCapability(capList); if (ret != HDF_SUCCESS || capList.empty()) { return false; } for (const auto& cap : capList) { - if (cap.role == HDI::Codec::V3_0::MEDIA_ROLETYPE_VIDEO_HEVC && - cap.type == HDI::Codec::V3_0::VIDEO_ENCODER && !IsEncodeSecureMode(cap.compName)) { + if (cap.role == HDI::Codec::Image::V2_0::CODEC_IMAGE_HEIF && + cap.type == HDI::Codec::Image::V2_0::CODEC_IMAGE_TYPE_ENCODER && !IsEncodeSecureMode(cap.name)) { return true; } } diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index 2fb653019..4f2b724aa 100644 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -269,7 +269,10 @@ if (use_clang_android) { } if (enable_heif_hw_encode) { defines += [ "HEIF_HW_ENCODE_ENABLE" ] - external_deps += [ "drivers_interface_codec:libcodec_proxy_3.0" ] + external_deps += [ + "drivers_interface_codec:libcodec_proxy_3.0", + "drivers_interface_codec:libimage_proxy_2.0", + ] } } -- Gitee