diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index 93cf3c73b8283624d6c89d69eabb1b19ec95a0fc..4871902ab9be96e0ab990ca6db0dabd02f61badc 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -127,6 +127,8 @@ typedef enum { IMAGE_TOO_LARGE = 7600103, /** @error DMA memory does not exist */ IMAGE_DMA_NOT_EXIST = 7600173, + /** @error DMA operation failed */ + IMAGE_DMA_OPERATION_FAILED = 7600174, /** unsupported operations */ IMAGE_UNSUPPORTED_OPERATION = 7600201, /** unsupported metadata */ diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index b37820226f373ce3515d7548e063102bc717bd82..d4ffa1454f8b5e814b6025cd0145960ed46e4037 100644 --- a/multimedia/image_framework/include/image/pixelmap_native.h +++ b/multimedia/image_framework/include/image/pixelmap_native.h @@ -51,6 +51,14 @@ extern "C" { struct OH_PixelmapNative; typedef struct OH_PixelmapNative OH_PixelmapNative; +/** + * @brief Define a native buffer type, used for retrieving a native buffer. + * + * @since 12 + */ +struct OH_NativeBuffer; +typedef struct OH_NativeBuffer OH_NativeBuffer; + /** * @brief Define a pixelmap alpha type. * @@ -797,6 +805,20 @@ Image_ErrorCode OH_PixelmapNative_GetMetadata(OH_PixelmapNative *pixelmap, OH_Pi Image_ErrorCode OH_PixelmapNative_SetMetadata(OH_PixelmapNative *pixelmap, OH_Pixelmap_HdrMetadataKey key, OH_Pixelmap_HdrMetadataValue *value); +/** + * @brief Get the native buffer from the PixelMap. + * + * @param pixelmap The PixelMap to get the native buffer from. + * @param nativeBuffer The native buffer to retrieve. + * @return Returns {@link Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - if invalid parameter, pixelmap or nativeBuffer is null. + * returns {@link Image_ErrorCode} IMAGE_DMA_NOT_EXIST - if DMA memory dose not exist. + * returns {@link Image_ErrorCode} IMAGE_DMA_OPERATION_FAILED - if operations related to DMA memory has failed. + * @see OH_PixelmapNative + * @since 12 + */ +Image_ErrorCode OH_PixelmapNative_GetNativeBuffer(OH_PixelmapNative *pixelmap, OH_NativeBuffer **nativeBuffer); + #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/libpixelmap.ndk.json b/multimedia/image_framework/libpixelmap.ndk.json index 248078f3e500e6414e5af5fc534ae070afab3e7f..78c1a0235d6d86d169095bfc13425d017930353d 100644 --- a/multimedia/image_framework/libpixelmap.ndk.json +++ b/multimedia/image_framework/libpixelmap.ndk.json @@ -155,6 +155,10 @@ "first_introduced": "12", "name": "OH_PixelmapNative_SetMetadata" }, + { + "first_introduced": "12", + "name": "OH_PixelmapNative_GetNativeBuffer" + }, { "first_introduced": "12", "name": "OH_PixelmapNative_ConvertPixelmapNativeToNapi"