mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-27 08:51:29 +00:00
!1005 NativeImage对外暴露NativeWindowBuffer需求
Merge pull request !1005 from 马靖涛/20240712
This commit is contained in:
commit
7c77af2e4f
@ -10,5 +10,13 @@
|
||||
{ "name": "OH_NativeImage_SetOnFrameAvailableListener" },
|
||||
{ "name": "OH_NativeImage_UnsetOnFrameAvailableListener" },
|
||||
{ "name": "OH_NativeImage_Destroy" },
|
||||
{ "name": "OH_NativeImage_GetTransformMatrixV2" }
|
||||
{ "name": "OH_NativeImage_GetTransformMatrixV2" },
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NativeImage_AcquireNativeWindowBuffer"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NativeImage_ReleaseNativeWindowBuffer"
|
||||
}
|
||||
]
|
@ -48,6 +48,11 @@ extern "C" {
|
||||
struct OH_NativeImage;
|
||||
typedef struct OH_NativeImage OH_NativeImage;
|
||||
typedef struct NativeWindow OHNativeWindow;
|
||||
/**
|
||||
* @brief define the new type name OHNativeWindowBuffer for struct NativeWindowBuffer.
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct NativeWindowBuffer OHNativeWindowBuffer;
|
||||
/**
|
||||
* @brief The callback function of frame available.
|
||||
*
|
||||
@ -217,6 +222,50 @@ void OH_NativeImage_Destroy(OH_NativeImage** image);
|
||||
*/
|
||||
int32_t OH_NativeImage_GetTransformMatrixV2(OH_NativeImage* image, float matrix[16]);
|
||||
|
||||
/**
|
||||
* @brief Acquire an <b>OHNativeWindowBuffer</b> through an <b>OH_NativeImage</b> instance for content consumer.\n
|
||||
* This method can not be used at the same time with <b>OH_NativeImage_UpdateSurfaceImage</b>.\n
|
||||
* This method will create an <b>OHNativeWindowBuffer</b>.\n
|
||||
* When using <b>OHNativeWindowBuffer</b>, need to increase its reference count
|
||||
* by <b>OH_NativeWindow_NativeObjectReference</b>.\n
|
||||
* When the <b>OHNativeWindowBuffer</b> is used up, its reference count needs to be decremented
|
||||
* by <b>OH_NativeWindow_NativeObjectUnreference</b>.\n
|
||||
* This interface needs to be used in conjunction with <b>OH_NativeImage_ReleaseNativeWindowBuffer<\b>,
|
||||
* otherwise memory leaks will occur.\n
|
||||
* When the fenceFd is used up, you need to close it.\n
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeImage
|
||||
* @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
|
||||
* @param nativeWindowBuffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> point.
|
||||
* @param fenceFd Indicates the pointer to a file descriptor handle.
|
||||
* @return {@link NATIVE_ERROR_OK} 0 - Success.
|
||||
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image, nativeWindowBuffer, fenceFd is NULL.
|
||||
* {@link NATIVE_ERROR_NO_BUFFER} 40601000 - No buffer for consume.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t OH_NativeImage_AcquireNativeWindowBuffer(OH_NativeImage* image,
|
||||
OHNativeWindowBuffer** nativeWindowBuffer, int* fenceFd);
|
||||
|
||||
/**
|
||||
* @brief Release the <b>OHNativeWindowBuffer</b> to the buffer queue through an
|
||||
* <b>OH_NativeImage</b> instance for reuse.\n
|
||||
* The fenceFd will be close by system.\n
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeImage
|
||||
* @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
|
||||
* @param nativeWindowBuffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> instance.
|
||||
* @param fenceFd Indicates a file descriptor handle, which is used for timing synchronization.
|
||||
* @return {@link NATIVE_ERROR_OK} 0 - Success.
|
||||
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image, nativeWindowBuffer is NULL.
|
||||
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - nativeWindowBuffer state invalid.
|
||||
* {@link NATIVE_ERROR_BUFFER_NOT_IN_CACHE} 41210000 - nativeWindowBuffer not in cache.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t OH_NativeImage_ReleaseNativeWindowBuffer(OH_NativeImage* image,
|
||||
OHNativeWindowBuffer* nativeWindowBuffer, int fenceFd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -72,6 +72,10 @@ typedef enum OHNativeErrorCode {
|
||||
NATIVE_ERROR_BUFFER_QUEUE_FULL = 41209000,
|
||||
/** @error buffer is not in the cache queue */
|
||||
NATIVE_ERROR_BUFFER_NOT_IN_CACHE = 41210000,
|
||||
/** @error the consumer is disconnected */
|
||||
NATIVE_ERROR_CONSUMER_DISCONNECTED = 41211000,
|
||||
/** @error the consumer not register listener */
|
||||
NATIVE_ERROR_CONSUMER_NO_LISTENER_REGISTERED = 41212000,
|
||||
/** @error the current device or platform does not support it */
|
||||
NATIVE_ERROR_UNSUPPORTED = 50102000,
|
||||
/** @error unknown error, please check log */
|
||||
|
Loading…
Reference in New Issue
Block a user