From 3d20fcef190f5a8a77ee5ef94c27d73192747d74 Mon Sep 17 00:00:00 2001 From: zhaona45 Date: Sun, 27 Apr 2025 11:23:05 +0800 Subject: [PATCH] Add static interface for querying encoding and decoding range Signed-off-by: zhaona45 Change-Id: I2b9de7aaf431103775442b9c159df3b7c6002b66 --- .../image_framework/include/image/image_common.h | 10 ++++++++++ .../include/image/image_packer_native.h | 12 ++++++++++++ .../include/image/image_source_native.h | 12 ++++++++++++ multimedia/image_framework/libimage_packer.ndk.json | 4 ++++ multimedia/image_framework/libimage_source.ndk.json | 4 ++++ 5 files changed, 42 insertions(+) diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index d17f95a5d..cee6e0d54 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -203,6 +203,11 @@ typedef enum { * @since 15 */ IMAGE_SOURCE_UNSUPPORTED_OPTIONS = 7700203, + /** + * @error Invalid parameter. + * @since 19 + */ + IMAGE_SOURCE_INVALID_PARAMETER = 7700204, /** decode failed */ IMAGE_DECODE_FAILED = 7700301, /** @@ -210,6 +215,11 @@ typedef enum { * @since 15 */ IMAGE_SOURCE_ALLOC_FAILED = 7700302, + /** + * @error Invalid parameter for ImagePacker. + * @since 19 + */ + IMAGE_PACKER_INVALID_PARAMETER = 7800202, /** encode failed */ IMAGE_ENCODE_FAILED = 7800301, } Image_ErrorCode; diff --git a/multimedia/image_framework/include/image/image_packer_native.h b/multimedia/image_framework/include/image/image_packer_native.h index 0a1498f3a..bd5262892 100644 --- a/multimedia/image_framework/include/image/image_packer_native.h +++ b/multimedia/image_framework/include/image/image_packer_native.h @@ -466,6 +466,18 @@ Image_ErrorCode OH_ImagePackerNative_PackToFileFromPixelmapSequence(OH_ImagePack */ Image_ErrorCode OH_ImagePackerNative_Release(OH_ImagePackerNative *imagePacker); +/** + * @brief Obtains the supported image formats that can be encoded. + * + * @param supportedFormats Double pointer to an array of the supported image formats. + * @param length Pointer to the length of the array. + * @return One of the following result codes. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_PACKER_INVALID_PARAMETER} if supportedFormats or length is empty. + * @since 20 + */ +Image_ErrorCode OH_ImagePackerNative_GetSupportedFormats(Image_MimeType **supportedFormats, size_t *length); + #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index faa192067..a5583a7e9 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -610,6 +610,18 @@ Image_ErrorCode OH_DecodingOptionsForPicture_SetDesiredAuxiliaryPictures(OH_Deco * @since 13 */ Image_ErrorCode OH_DecodingOptionsForPicture_Release(OH_DecodingOptionsForPicture *options); + +/** + * @brief Obtains the supported image formats that can be decoded. + * + * @param supportedFormats Double pointer to an array of the supported image formats. + * @param length Pointer to the length of the array. + * @return One of the following result codes. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_SOURCE_INVALID_PARAMETER} if supportedFormats or length is empty. + * @since 20 + */ +Image_ErrorCode OH_ImageSourceNative_GetSupportedFormats(Image_MimeType **supportedFormats, size_t *length); #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/libimage_packer.ndk.json b/multimedia/image_framework/libimage_packer.ndk.json index 5684b6584..d3d3ef694 100644 --- a/multimedia/image_framework/libimage_packer.ndk.json +++ b/multimedia/image_framework/libimage_packer.ndk.json @@ -118,5 +118,9 @@ { "first_introduced": "12", "name": "OH_ImagePackerNative_Release" + }, + { + "first_introduced": "20", + "name": "OH_ImagePackerNative_GetSupportedFormats" } ] \ No newline at end of file diff --git a/multimedia/image_framework/libimage_source.ndk.json b/multimedia/image_framework/libimage_source.ndk.json index ca6fab1a3..96557567e 100644 --- a/multimedia/image_framework/libimage_source.ndk.json +++ b/multimedia/image_framework/libimage_source.ndk.json @@ -154,5 +154,9 @@ { "first_introduced": "13", "name": "OH_DecodingOptionsForPicture_Release" + }, + { + "first_introduced": "20", + "name": "OH_ImageSourceNative_GetSupportedFormats" } ] \ No newline at end of file -- Gitee