diff --git a/frameworks/innerkitsimpl/codec/src/image_packer.cpp b/frameworks/innerkitsimpl/codec/src/image_packer.cpp index 26636a64dc911470fa2b595592318d2aee662002..487bb06ab4c7bfd888256564fcc650f67b2b79b9 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 2fb653019ece75574a80b01e8ed2b7ce573652df..4f2b724aa7d2c6326870c4c8ca35558ed720350b 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", + ] } }