From dcd388aff613eefae7e3cba9e15b985f29297326 Mon Sep 17 00:00:00 2001 From: baosiyuan Date: Wed, 18 Jun 2025 16:19:40 +0800 Subject: [PATCH] fix codecheck Signed-off-by: baosiyuan Change-Id: If4441778639a63e456cf0f07b628b04444f39084 --- .../include/image/image_common.h | 5 ++ .../include/image/image_receiver_native.h | 33 ++++++++++++ .../include/image/image_source_native.h | 54 +++++++++---------- .../libimage_receiver.ndk.json | 8 +++ .../image_framework/libimage_source.ndk.json | 16 +++--- 5 files changed, 81 insertions(+), 35 deletions(-) diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index 0b4542a34..e43088bdb 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -234,6 +234,11 @@ typedef enum { IMAGE_PACKER_INVALID_PARAMETER = 7800202, /** encode failed */ IMAGE_ENCODE_FAILED = 7800301, + /** + * @error Invalid parameter for ImageReceiver. + * @since 20 + */ + IMAGE_RECEIVER_INVALID_PARAMETER = 7900201, } Image_ErrorCode; /** diff --git a/multimedia/image_framework/include/image/image_receiver_native.h b/multimedia/image_framework/include/image/image_receiver_native.h index 09fef3b1b..55bcd734f 100644 --- a/multimedia/image_framework/include/image/image_receiver_native.h +++ b/multimedia/image_framework/include/image/image_receiver_native.h @@ -76,6 +76,13 @@ typedef struct OH_ImageReceiverOptions OH_ImageReceiverOptions; */ typedef void (*OH_ImageReceiver_OnCallback)(OH_ImageReceiverNative *receiver); +/** + * @brief Defines the callbacks for the ImageArrive event. + * + * @since 20 + */ +typedef void (*OH_ImageReceiver_ImageArriveCallback)(OH_ImageReceiverNative *receiver, void *userData); + /** * @brief Creates an OH_ImageReceiverOptions object at the application layer. * @@ -223,6 +230,32 @@ Image_ErrorCode OH_ImageReceiverNative_On(OH_ImageReceiverNative* receiver, OH_I */ Image_ErrorCode OH_ImageReceiverNative_Off(OH_ImageReceiverNative* receiver); +/** + * Registers an {@link OH_ImageReceiver_ImageArriveCallback} callback. + * + * @param receiver Pointer to an OH_ImageReceiverNative object that processes the callback. + * @param callback OH_ImageReceiver_ImageArriveCallback to register. + * @param userData Pointer to the user data passed to the callback. + * @return Result code. {@link Image_ErrorCode} IMAGE_SUCCESS is returned if the operation is successful. + * {@link Image_ErrorCode} IMAGE_RECEIVER_INVALID_PARAMETER is returned if receiver or callback is null. + * @since 20 + */ +Image_ErrorCode OH_ImageReceiverNative_OnImageArrive(OH_ImageReceiverNative *receiver, + OH_ImageReceiver_ImageArriveCallback callback, void *userData); + +/** + * Unregisters an {@link OH_ImageReceiver_ImageArriveCallback} callback. + * + * @param receiver Pointer to an OH_ImageReceiverNative object that processes the callback. + * @param callback OH_ImageReceiver_ImageArriveCallback callback to unregister. + * @return {@link Image_ErrorCode} IMAGE_SUCCESS - Operation succeeded. + * {@link Image_ErrorCode} IMAGE_RECEIVER_INVALID_PARAMETER - receiver is empty or callback is not + * registered. + * @since 20 +*/ +Image_ErrorCode OH_ImageReceiverNative_OffImageArrive(OH_ImageReceiverNative *receiver, + OH_ImageReceiver_ImageArriveCallback callback); + /** * @brief Obtains the size of the image receiver through an {@link OH_ImageReceiverNative} object. * diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index 3513d6095..134849e52 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -182,11 +182,11 @@ Image_ErrorCode OH_ImageSourceInfo_GetDynamicRange(OH_ImageSource_Info *info, bo * @param info Pointer to the OH_ImageSource_Info struct. * @param mimeType Pointer to the MIME type of the image source. * @return Returns one of the following result codes: - * {@link IMAGE_SUCCESS}: The execution is successful. - * {@link IMAGE_SOURCE_INVALID_PARAMETER}: info or mimeType is a null pointer. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_SOURCE_INVALID_PARAMETER} if info or mimetype is a null pointer. * @since 20 */ -Image_ErrorCode OH_ImageSourceInfo_GetMimeType(OH_ImageSource_Info *info, Image_MimeType *mimeType); +Image_ErrorCode OH_ImageSourceInfo_GetMimeType(OH_ImageSource_Info *info, Image_MimeType *mimetype); /** * @brief delete OH_ImageSource_Info pointer. @@ -374,30 +374,6 @@ Image_ErrorCode OH_DecodingOptions_GetCropAndScaleStrategy(OH_DecodingOptions *o Image_ErrorCode OH_DecodingOptions_SetDesiredDynamicRange(OH_DecodingOptions *options, int32_t desiredDynamicRange); -/** - * @brief Sets the crop region for the decoding options. - * - * @param options Pointer to the decoding options. - * @param cropRegion The target region will be cropped from the image. - * @return Returns one of the following result codes: - * {@link IMAGE_SUCCESS} if the execution is successful. - * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer. - * @since 19 - */ -Image_ErrorCode OH_DecodingOptions_SetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion); - -/** - * @brief Gets the crop region for the decoding options. - * - * @param options Pointer to the decoding options. - * @param cropRegion The target region will be cropped from the image. - * @return Returns one of the following result codes: - * {@link IMAGE_SUCCESS} if the execution is successful. - * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer. - * @since 19 - */ -Image_ErrorCode OH_DecodingOptions_GetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion); - /** * @brief Obtains the color space set in the decoding options. * @@ -422,6 +398,30 @@ Image_ErrorCode OH_DecodingOptions_GetDesiredColorSpace(OH_DecodingOptions *opti */ Image_ErrorCode OH_DecodingOptions_SetDesiredColorSpace(OH_DecodingOptions *options, int32_t colorSpace); +/** + * @brief Sets the crop region for the decoding options. + * + * @param options Pointer to the decoding options. + * @param cropRegion The target region will be cropped from the image. + * @return Returns one of the following result codes: + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer. + * @since 19 + */ +Image_ErrorCode OH_DecodingOptions_SetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion); + +/** + * @brief Gets the crop region for the decoding options. + * + * @param options Pointer to the decoding options. + * @param cropRegion The target region will be cropped from the image. + * @return Returns one of the following result codes: + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer. + * @since 19 + */ +Image_ErrorCode OH_DecodingOptions_GetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion); + /** * @brief delete OH_DecodingOptions pointer. * diff --git a/multimedia/image_framework/libimage_receiver.ndk.json b/multimedia/image_framework/libimage_receiver.ndk.json index 95058723f..2ff42d643 100644 --- a/multimedia/image_framework/libimage_receiver.ndk.json +++ b/multimedia/image_framework/libimage_receiver.ndk.json @@ -47,6 +47,14 @@ "first_introduced": "12", "name": "OH_ImageReceiverNative_Off" }, + { + "first_introduced": "20", + "name": "OH_ImageReceiverNative_OnImageArrive" + }, + { + "first_introduced": "20", + "name": "OH_ImageReceiverNative_OffImageArrive" + }, { "first_introduced": "12", "name": "OH_ImageReceiverNative_GetSize" diff --git a/multimedia/image_framework/libimage_source.ndk.json b/multimedia/image_framework/libimage_source.ndk.json index e95669459..eb5ccb7ae 100644 --- a/multimedia/image_framework/libimage_source.ndk.json +++ b/multimedia/image_framework/libimage_source.ndk.json @@ -83,14 +83,6 @@ "first_introduced": "18", "name": "OH_DecodingOptions_GetCropAndScaleStrategy" }, - { - "first_introduced": "19", - "name": "OH_DecodingOptions_SetCropRegion" - }, - { - "first_introduced": "19", - "name": "OH_DecodingOptions_GetCropRegion" - }, { "first_introduced": "20", "name": "OH_DecodingOptions_GetDesiredColorSpace" @@ -99,6 +91,14 @@ "first_introduced": "20", "name": "OH_DecodingOptions_SetDesiredColorSpace" }, + { + "first_introduced": "19", + "name": "OH_DecodingOptions_SetCropRegion" + }, + { + "first_introduced": "19", + "name": "OH_DecodingOptions_GetCropRegion" + }, { "first_introduced": "12", "name": "OH_DecodingOptions_Release" -- Gitee