diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index 0b4542a347967ea7254e842bdf425106cde184f3..e43088bdb5b18b3a6dd4dc082e0ba5dad777e6bb 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 09fef3b1bf4b489e1d845f9f49922c2b175ccf33..8c4c7e85d0822408531282f37678f8d1c2c8f250 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 callback 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 3513d60959df52b6e53895076f465ee4b1359334..e4b854960bff37d0cb23938a7dea951847d472d0 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -180,13 +180,13 @@ Image_ErrorCode OH_ImageSourceInfo_GetDynamicRange(OH_ImageSource_Info *info, bo * @brief Obtains the MIME type of an image source. * * @param info Pointer to the OH_ImageSource_Info struct. - * @param mimeType Pointer to the MIME type of the image source. + * @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 95058723f5c2455b4ffd8eb1c03ccd6f1a6d1ee9..2ff42d64319862310faa9044a89b6aae267067b6 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 e95669459f45398227a1c26c25a9bef11af8a926..eb5ccb7aec8fa2a29c3009431bbe7b87cf4d3131 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"