From f669437ecc48c8a5f8500d8a8c1560ad0ddfce7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=B9=94=E5=BC=82?= Date: Wed, 21 Aug 2024 18:19:00 +0800 Subject: [PATCH] =?UTF-8?q?cherry=20pick=20311a101=20from=20https://gitee.?= =?UTF-8?q?com/chen-qiao-yi/interface=5Fsdk=5Fc/pulls/1263=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20GetNativeBuffer=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈乔异 --- .../include/image/image_common.h | 2 ++ .../include/image/pixelmap_native.h | 22 +++++++++++++++++++ .../image_framework/libpixelmap.ndk.json | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index 93cf3c73b..4871902ab 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 b37820226..d4ffa1454 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 248078f3e..78c1a0235 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" -- Gitee