image_receiver_mdk.h
Overview
The file declares the APIs used to obtain image data from the native layer.
Library: libimage_receiver_ndk.z.so
File to include: <multimedia/image_framework/image_receiver_mdk.h>
System capability: SystemCapability.Multimedia.Image.Core
Since: 10
Related module: Image
Summary
Structs
| Name | typedef Keyword | Description |
|---|---|---|
| OhosImageReceiverInfo | - | Describes the information about an image receiver. |
| ImageReceiverNative_ | ImageReceiverNative | Defines the data type name of the image receiver at the native layer. |
Functions
Function Description
OH_Image_Receiver_On_Callback()
typedef void (*OH_Image_Receiver_On_Callback)(void)
Description
Defines the callbacks for the image receiver at the native layer.
Since: 10
OH_Image_Receiver_CreateImageReceiver()
int32_t OH_Image_Receiver_CreateImageReceiver(napi_env env, struct OhosImageReceiverInfo info, napi_value* res)
Description
Creates an ImageReceiver object at the application layer.
Since: 10
Parameters
| Name | Description |
|---|---|
| napi_env env | Pointer to the NAPI environment. |
| struct OhosImageReceiverInfo info | Options for setting the ImageReceiver object. |
| napi_value* res | Pointer to the ImageReceiver object at the application layer. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_INVALID_PARAMETER: Obtaining parameters from the surface fails. IMAGE_RESULT_CREATE_SURFACE_FAILED: The surface fails to be created. IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED: The buffer fails to be allocated to the surface. IMAGE_RESULT_GET_SURFACE_FAILED: The surface fails to be obtained. IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT: The media RTSP surface is not supported. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. IMAGE_RESULT_MEDIA_DATA_UNSUPPORT: The media type is not supported. |
OH_Image_Receiver_InitImageReceiverNative()
ImageReceiverNative* OH_Image_Receiver_InitImageReceiverNative(napi_env env, napi_value source)
Description
Initializes an ImageReceiverNative object through an ImageReceiver object.
Since: 10
Parameters
| Name | Description |
|---|---|
| napi_env env | Pointer to the NAPI environment. |
| napi_value source | ImageReceiver object. |
Returns
| Type | Description |
|---|---|
| ImageReceiverNative* | Pointer to the ImageReceiverNative object obtained. If the operation fails, nullptr is returned. |
See also
OH_Image_Receiver_GetReceivingSurfaceId()
int32_t OH_Image_Receiver_GetReceivingSurfaceId(const ImageReceiverNative* native, char* id, size_t len)
Description
Obtains the receiver ID through an ImageReceiverNative object.
Since: 10
Parameters
| Name | Description |
|---|---|
| const ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
| char* id | Pointer to the buffer that stores the ID string obtained. |
| size_t len | Size of the buffer. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_INVALID_PARAMETER: Obtaining parameters from the surface fails. IMAGE_RESULT_GET_SURFACE_FAILED: The surface fails to be obtained. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. IMAGE_RESULT_MEDIA_DATA_UNSUPPORT: The media type is not supported. |
OH_Image_Receiver_ReadLatestImage()
int32_t OH_Image_Receiver_ReadLatestImage(const ImageReceiverNative* native, napi_value* image)
Description
Obtains the latest image through an ImageReceiverNative object.
This function can be called to receive data only after the OH_Image_Receiver_On_Callback callback is triggered. When the ImageNative object created by the Image object returned by this function is no longer needed, call OH_Image_Release to release the object. New data can be received only after the release.
Since: 10
Parameters
| Name | Description |
|---|---|
| const ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
| napi_value* image | Pointer to an Image object at the application layer. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_INVALID_PARAMETER: Obtaining parameters from the surface fails. IMAGE_RESULT_CREATE_SURFACE_FAILED: The surface fails to be created. IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED: The buffer fails to be allocated to the surface. IMAGE_RESULT_GET_SURFACE_FAILED: The surface fails to be obtained. IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT: The media RTSP surface is not supported. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. IMAGE_RESULT_MEDIA_DATA_UNSUPPORT: The media type is not supported. |
OH_Image_Receiver_ReadNextImage()
int32_t OH_Image_Receiver_ReadNextImage(const ImageReceiverNative* native, napi_value* image)
Description
Obtains the next image through an ImageReceiverNative object.
This function can be called to receive data only after the OH_Image_Receiver_On_Callback callback is triggered. When the ImageNative object created by the Image object returned by this function is no longer needed, call OH_Image_Release to release the object. New data can be received only after the release.
Since: 10
Parameters
| Name | Description |
|---|---|
| const ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
| napi_value* image | Pointer to an Image object at the application layer. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_INVALID_PARAMETER: Obtaining parameters from the surface fails. IMAGE_RESULT_CREATE_SURFACE_FAILED: The surface fails to be created. IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED: The buffer fails to be allocated to the surface. IMAGE_RESULT_GET_SURFACE_FAILED: The surface fails to be obtained. IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT: The media RTSP surface is not supported. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. IMAGE_RESULT_MEDIA_DATA_UNSUPPORT: The media type is not supported. |
OH_Image_Receiver_On()
int32_t OH_Image_Receiver_On(const ImageReceiverNative* native, OH_Image_Receiver_On_Callback callback)
Description
Registers an OH_Image_Receiver_On_Callback callback. This callback is triggered whenever a new image is received.
Since: 10
Parameters
| Name | Description |
|---|---|
| const ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
| OH_Image_Receiver_On_Callback callback | OH_Image_Receiver_On_Callback callback to register. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_INVALID_PARAMETER: Obtaining parameters from the surface fails. IMAGE_RESULT_GET_SURFACE_FAILED: The surface fails to be obtained. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. IMAGE_RESULT_MEDIA_DATA_UNSUPPORT: The media type is not supported. |
OH_Image_Receiver_GetSize()
int32_t OH_Image_Receiver_GetSize(const ImageReceiverNative* native, struct OhosImageSize* size)
Description
Obtains the size of the image receiver through an ImageReceiverNative object.
Since: 10
Parameters
| Name | Description |
|---|---|
| const ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
| struct OhosImageSize* size | Pointer to the OhosImageSize object obtained. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. |
OH_Image_Receiver_GetCapacity()
int32_t OH_Image_Receiver_GetCapacity(const ImageReceiverNative* native, int32_t* capacity)
Description
Obtains the capacity of the image receiver through an ImageReceiverNative object.
Since: 10
Parameters
| Name | Description |
|---|---|
| const ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
| int32_t* capacity | Pointer to the capacity obtained. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. |
OH_Image_Receiver_GetFormat()
int32_t OH_Image_Receiver_GetFormat(const ImageReceiverNative* native, int32_t* format)
Description
Obtains the format of the image receiver through an ImageReceiverNative object.
Since: 10
Parameters
| Name | Description |
|---|---|
| const ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
| int32_t* format | Pointer to the format obtained. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_JNI_ENV_ABNORMAL: The JNI environment is abnormal. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. |
OH_Image_Receiver_Release()
int32_t OH_Image_Receiver_Release(ImageReceiverNative* native)
Description
Releases an ImageReceiverNative object.
This function is not used to release an ImageReceiver object.
Since: 10
Parameters
| Name | Description |
|---|---|
| ImageReceiverNative* native | Pointer to an ImageReceiverNative object. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code defined in IRNdkErrCode: IMAGE_RESULT_SUCCESS: The operation is successful. IMAGE_RESULT_BAD_PARAMETER: A parameter is incorrect. IMAGE_RESULT_INVALID_PARAMETER: A parameter is invalid. IMAGE_RESULT_DATA_UNSUPPORT: The image type is not supported. |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 capi-image-nativemodule-oh-pixelmap-hdrmetadatavalue
openharmony 鸿蒙 capi-image-imagepacker-opts-
openharmony 鸿蒙 capi-image-nativemodule-image-region
openharmony 鸿蒙 capi-image-imagepacker-native-
openharmony 鸿蒙 capi-image-imagenative-
openharmony 鸿蒙 capi-image-processing-h
openharmony 鸿蒙 capi-image-ohosimagesourcesupportedformat
openharmony 鸿蒙 capi-image-nativemodule-image-size