1e41f4b71Sopenharmony_ci# VideoProcessing 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Overview 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciThe VideoProcessing module provides the APIs for video processing. It provides video processing capabilities, including color space conversion, metadata generation, and video scaling. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci**Since**: 12 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci## Summary 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci### Files 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci| Name| Description| 17e41f4b71Sopenharmony_ci| -------- | -------- | 18e41f4b71Sopenharmony_ci| [video_processing.h](video__processing_8h.md) | Declares the video processing functions.| 19e41f4b71Sopenharmony_ci| [video_processing_types.h](video__processing__types_8h.md) | Declares the video processing types.| 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci### Structs 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci| Name| Description| 25e41f4b71Sopenharmony_ci| -------- | -------- | 26e41f4b71Sopenharmony_ci| struct [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) | Describes the color space information of video processing.| 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci### Types 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci| Name| Description| 32e41f4b71Sopenharmony_ci| -------- | -------- | 33e41f4b71Sopenharmony_ci| typedef struct [OH_VideoProcessing](#oh_videoprocessing-1) [OH_VideoProcessing](#oh_videoprocessing) | Defines a struct for the video processing object.| 34e41f4b71Sopenharmony_ci| typedef struct NativeWindow [OHNativeWindow](#ohnativewindow) | Defines a struct for the NativeWindow object.| 35e41f4b71Sopenharmony_ci| typedef struct [OH_AVFormat](#oh_avformat-1) [OH_AVFormat](#oh_avformat) | Defines a struct for the OH_AVFormat object.| 36e41f4b71Sopenharmony_ci| typedef struct [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) [VideoProcessing_ColorSpaceInfo](#videoprocessing_colorspaceinfo) | Defines a struct for the color space information of video processing.| 37e41f4b71Sopenharmony_ci| typedef enum [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel-1) [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel) | Defines an enum for the quality levels for detail enhancement.| 38e41f4b71Sopenharmony_ci| typedef enum [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) [VideoProcessing_ErrorCode](#videoprocessing_errorcode) | Defines an enum for the video processing error codes.| 39e41f4b71Sopenharmony_ci| typedef enum [VideoProcessing_State](#videoprocessing_state-1) [VideoProcessing_State](#videoprocessing_state) | Defines an enum for the video processing states.| 40e41f4b71Sopenharmony_ci| typedef struct [VideoProcessing_Callback](#videoprocessing_callback) [VideoProcessing_Callback](#videoprocessing_callback) | Defines a struct for the video processing callback object.| 41e41f4b71Sopenharmony_ci| typedef void(\* [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror)) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [VideoProcessing_ErrorCode](#videoprocessing_errorcode) error, void \*userData) | Defines a pointer to the callback function for reporting an error during video processing.| 42e41f4b71Sopenharmony_ci| typedef void(\* [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate)) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [VideoProcessing_State](#videoprocessing_state) state, void \*userData) | Defines a pointer to the callback function for reporting the video processing state.| 43e41f4b71Sopenharmony_ci| typedef void(\* [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer)) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, uint32_t index, void \*userData) | Defines a pointer to the callback function for reporting the data filled in the output buffer.| 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci### Enums 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci| Name| Description| 49e41f4b71Sopenharmony_ci| -------- | -------- | 50e41f4b71Sopenharmony_ci| [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel-1) {<br>VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_NONE,<br>VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_LOW,<br>VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_MEDIUM,<br>VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_HIGH } | Enumerates the quality levels for detail enhancement.| 51e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) {<br>VIDEO_PROCESSING_SUCCESS,<br>VIDEO_PROCESSING_ERROR_INVALID_PARAMETER = 401,<br>VIDEO_PROCESSING_ERROR_UNKNOWN = 29210001,<br>VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED,<br>VIDEO_PROCESSING_ERROR_CREATE_FAILED,<br>VIDEO_PROCESSING_ERROR_PROCESS_FAILED,<br>VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING,<br>VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED,<br>VIDEO_PROCESSING_ERROR_NO_MEMORY,<br>VIDEO_PROCESSING_ERROR_INVALID_INSTANCE,<br>VIDEO_PROCESSING_ERROR_INVALID_VALUE<br>} | Enumerates the video processing error codes.| 52e41f4b71Sopenharmony_ci| [VideoProcessing_State](#videoprocessing_state-1) {<br>VIDEO_PROCESSING_STATE_RUNNING,<br>VIDEO_PROCESSING_STATE_STOPPED } | Enumerates the video processing states.| 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci### Functions 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci| Name| Description| 58e41f4b71Sopenharmony_ci| -------- | -------- | 59e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) (void) | Initializes the global video processing environment.| 60e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment) (void) | Releases the global video processing environment.| 61e41f4b71Sopenharmony_ci| bool [OH_VideoProcessing_IsColorSpaceConversionSupported](#oh_videoprocessing_iscolorspaceconversionsupported) (const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*sourceVideoInfo, const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*destinationVideoInfo) | Checks whether color space conversion is supported during video processing.| 62e41f4b71Sopenharmony_ci| bool [OH_VideoProcessing_IsMetadataGenerationSupported](#oh_videoprocessing_ismetadatagenerationsupported) (const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*sourceVideoInfo) | Checks whether metadata generation is supported during video processing.| 63e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Create](#oh_videoprocessing_create) ([OH_VideoProcessing](#oh_videoprocessing) \*\*videoProcessor, int type) | Creates a video processing instance.| 64e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Destroy](#oh_videoprocessing_destroy) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor) | Destroys a video processing instance.| 65e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_RegisterCallback](#oh_videoprocessing_registercallback) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, const [VideoProcessing_Callback](#videoprocessing_callback) \*callback, void \*userData) | Registers a callback for video processing.| 66e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_SetSurface](#oh_videoprocessing_setsurface) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, const [OHNativeWindow](#ohnativewindow) \*window) | Sets an output surface for video processing.| 67e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_GetSurface](#oh_videoprocessing_getsurface) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [OHNativeWindow](#ohnativewindow) \*\*window) | Obtains a surface for video processing.| 68e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, const [OH_AVFormat](#oh_avformat) \*parameter) | Sets video processing parameters.| 69e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [OH_AVFormat](#oh_avformat) \*parameter) | Obtains video processing parameters.| 70e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Start](#oh_videoprocessing_start) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor) | Starts video processing.| 71e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor) | Stops video processing.| 72e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_RenderOutputBuffer](#oh_videoprocessing_renderoutputbuffer) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, uint32_t index) | Renders and processes the buffer, and then outputs it.| 73e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_Create](#oh_videoprocessingcallback_create) ([VideoProcessing_Callback](#videoprocessing_callback) \*\*callback) | Creates a video processing callback object.| 74e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_Destroy](#oh_videoprocessingcallback_destroy) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback) | Destroys a video processing callback object.| 75e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnError](#oh_videoprocessingcallback_bindonerror) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror) onError) | Binds the callback function [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror) to a video processing callback object.| 76e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnState](#oh_videoprocessingcallback_bindonstate) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) onState) | Binds the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) to a video processing callback object.| 77e41f4b71Sopenharmony_ci| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnNewOutputBuffer](#oh_videoprocessingcallback_bindonnewoutputbuffer) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) onNewOutputBuffer) | Binds the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) to a video processing callback object.| 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci### Variables 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci| Name| Description| 83e41f4b71Sopenharmony_ci| -------- | -------- | 84e41f4b71Sopenharmony_ci| const int32_t [VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION](#video_processing_type_color_space_conversion) | Instance created for color space conversion during video processing.| 85e41f4b71Sopenharmony_ci| const int32_t [VIDEO_PROCESSING_TYPE_METADATA_GENERATION](#video_processing_type_metadata_generation) | Instance created for metadata generation during video processing.| 86e41f4b71Sopenharmony_ci| const int32_t [VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER](#video_processing_type_detail_enhancer) | Instance for detail enhancement during video processing.| 87e41f4b71Sopenharmony_ci| const char \* [VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL](#video_detail_enhancer_parameter_key_quality_level) | Pointer to the quality level of video detail enhancement.| 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci## Type Description 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ci### OH_AVFormat 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci``` 96e41f4b71Sopenharmony_citypedef struct OH_AVFormatOH_AVFormat 97e41f4b71Sopenharmony_ci``` 98e41f4b71Sopenharmony_ci 99e41f4b71Sopenharmony_ci**Description** 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ciDefines a struct for the OH_AVFormat object. 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ci**Since**: 12 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci### OH_VideoProcessing 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci``` 109e41f4b71Sopenharmony_citypedef struct OH_VideoProcessingOH_VideoProcessing 110e41f4b71Sopenharmony_ci``` 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci**Description** 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ciDefines a struct for the video processing object. 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ciDefine a null pointer to **OH_VideoProcessing**. Before [OH_VideoProcessing_Create](#oh_videoprocessing_create) is called to create a video processing instance, the pointer must be null. You can create different video processing instances with different processing types. 117e41f4b71Sopenharmony_ci 118e41f4b71Sopenharmony_ci**Since**: 12 119e41f4b71Sopenharmony_ci 120e41f4b71Sopenharmony_ci 121e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_OnError 122e41f4b71Sopenharmony_ci 123e41f4b71Sopenharmony_ci``` 124e41f4b71Sopenharmony_citypedef void(* OH_VideoProcessingCallback_OnError) (OH_VideoProcessing *videoProcessor, VideoProcessing_ErrorCode error, void *userData) 125e41f4b71Sopenharmony_ci``` 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ci**Description** 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ciDefines a pointer to the callback function for reporting an error during video processing. 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ciThe following error codes are defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING**: unsupported processing. For example, conversion between the color space types for input and output is not supported. 134e41f4b71Sopenharmony_ci 135e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_VALUE**: invalid video attribute. For example, the video color space is invalid. 136e41f4b71Sopenharmony_ci 137e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_NO_MEMORY**: out of memory. 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_PROCESS_FAILED**: An error occurs during the processing. 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_ci**Since**: 12 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci**Parameters** 144e41f4b71Sopenharmony_ci 145e41f4b71Sopenharmony_ci| Name| Description| 146e41f4b71Sopenharmony_ci| -------- | -------- | 147e41f4b71Sopenharmony_ci| videoProcessor | Pointer to the video processing instance.| 148e41f4b71Sopenharmony_ci| error | Error code reported.| 149e41f4b71Sopenharmony_ci| userData | Pointer to user-defined data.| 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_OnNewOutputBuffer 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_ci``` 155e41f4b71Sopenharmony_citypedef void(* OH_VideoProcessingCallback_OnNewOutputBuffer) (OH_VideoProcessing *videoProcessor, uint32_t index, void *userData) 156e41f4b71Sopenharmony_ci``` 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci**Description** 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ciDefines a pointer to the callback function for reporting the data filled in the output buffer. 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ciAfter data is filled in each new output buffer, the index of the buffer is reported. Call [OH_VideoProcessing_RenderOutputBuffer](#oh_videoprocessing_renderoutputbuffer) to process rendering based on the index and output the buffer. If this callback function is not registered, the data filled in the output buffer is not reported. Instead, the data is directly processed, rendered, and output. 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ci**Since**: 12 165e41f4b71Sopenharmony_ci 166e41f4b71Sopenharmony_ci**Parameters** 167e41f4b71Sopenharmony_ci 168e41f4b71Sopenharmony_ci| Name| Description| 169e41f4b71Sopenharmony_ci| -------- | -------- | 170e41f4b71Sopenharmony_ci| videoProcessor | Pointer to the video processing instance.| 171e41f4b71Sopenharmony_ci| index | Index of the output buffer.| 172e41f4b71Sopenharmony_ci| userData | Pointer to user-defined data.| 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ci 175e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_OnState 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci``` 178e41f4b71Sopenharmony_citypedef void(* OH_VideoProcessingCallback_OnState) (OH_VideoProcessing *videoProcessor, VideoProcessing_State state, void *userData) 179e41f4b71Sopenharmony_ci``` 180e41f4b71Sopenharmony_ci 181e41f4b71Sopenharmony_ci**Description** 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ciDefines a pointer to the callback function for reporting the video processing state. 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_ciAfter [OH_VideoProcessing_Start](#oh_videoprocessing_start) is called, the video processing state changes to VIDEO_PROCESSING_STATE_RUNNING. After [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) is called and all buffers finishes processing, the state changes to VIDEO_PROCESSING_STATE_STOPPED. For details, see [VideoProcessing_State](#videoprocessing_state). 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci**Since**: 12 188e41f4b71Sopenharmony_ci 189e41f4b71Sopenharmony_ci**Parameters** 190e41f4b71Sopenharmony_ci 191e41f4b71Sopenharmony_ci| Name| Description| 192e41f4b71Sopenharmony_ci| -------- | -------- | 193e41f4b71Sopenharmony_ci| videoProcessor | Pointer to the video processing instance.| 194e41f4b71Sopenharmony_ci| state | Video processing state. For details, see [VideoProcessing_State](#videoprocessing_state).| 195e41f4b71Sopenharmony_ci| userData | Pointer to user-defined data.| 196e41f4b71Sopenharmony_ci 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ci### OHNativeWindow 199e41f4b71Sopenharmony_ci 200e41f4b71Sopenharmony_ci``` 201e41f4b71Sopenharmony_citypedef struct NativeWindow OHNativeWindow 202e41f4b71Sopenharmony_ci``` 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ci**Description** 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ciDefines a struct for the NativeWindow object. 207e41f4b71Sopenharmony_ci 208e41f4b71Sopenharmony_ci**Since**: 12 209e41f4b71Sopenharmony_ci 210e41f4b71Sopenharmony_ci 211e41f4b71Sopenharmony_ci### VideoDetailEnhancer_QualityLevel 212e41f4b71Sopenharmony_ci 213e41f4b71Sopenharmony_ci``` 214e41f4b71Sopenharmony_citypedef enum VideoDetailEnhancer_QualityLevelVideoDetailEnhancer_QualityLevel 215e41f4b71Sopenharmony_ci``` 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ci**Description** 218e41f4b71Sopenharmony_ci 219e41f4b71Sopenharmony_ciDefines an enum for the quality levels for detail enhancement. 220e41f4b71Sopenharmony_ci 221e41f4b71Sopenharmony_ciFor details about the enumerated values, see [VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL](#video_detail_enhancer_parameter_key_quality_level). For details about how to set the quality level, see the development guide. 222e41f4b71Sopenharmony_ci 223e41f4b71Sopenharmony_ci**See also**: [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) and [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) 224e41f4b71Sopenharmony_ci 225e41f4b71Sopenharmony_ci**Since**: 12 226e41f4b71Sopenharmony_ci 227e41f4b71Sopenharmony_ci 228e41f4b71Sopenharmony_ci### VideoProcessing_Callback 229e41f4b71Sopenharmony_ci 230e41f4b71Sopenharmony_ci``` 231e41f4b71Sopenharmony_citypedef struct VideoProcessing_CallbackVideoProcessing_Callback 232e41f4b71Sopenharmony_ci``` 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci**Description** 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ciDefines a struct for the video processing callback object. 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ciDefine a null pointer to **VideoProcessing_Callback**. Before [OH_VideoProcessingCallback_Create](#oh_videoprocessingcallback_create) is called to create a video processing callback object, the pointer must be null. The callback object is registered by calling [OH_VideoProcessing_RegisterCallback](#oh_videoprocessing_registercallback). 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ci**Since**: 12 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ci 243e41f4b71Sopenharmony_ci### VideoProcessing_ColorSpaceInfo 244e41f4b71Sopenharmony_ci 245e41f4b71Sopenharmony_ci``` 246e41f4b71Sopenharmony_citypedef struct VideoProcessing_ColorSpaceInfoVideoProcessing_ColorSpaceInfo 247e41f4b71Sopenharmony_ci``` 248e41f4b71Sopenharmony_ci 249e41f4b71Sopenharmony_ci**Description** 250e41f4b71Sopenharmony_ci 251e41f4b71Sopenharmony_ciDefines a struct for the color space information of video processing. 252e41f4b71Sopenharmony_ci 253e41f4b71Sopenharmony_ci**See also**: [OH_VideoProcessing_IsColorSpaceConversionSupported](#oh_videoprocessing_iscolorspaceconversionsupported) 254e41f4b71Sopenharmony_ci 255e41f4b71Sopenharmony_ci**Since**: 12 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ci 258e41f4b71Sopenharmony_ci### VideoProcessing_ErrorCode 259e41f4b71Sopenharmony_ci 260e41f4b71Sopenharmony_ci``` 261e41f4b71Sopenharmony_citypedef enum VideoProcessing_ErrorCodeVideoProcessing_ErrorCode 262e41f4b71Sopenharmony_ci``` 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ci**Description** 265e41f4b71Sopenharmony_ci 266e41f4b71Sopenharmony_ciDefines an enum for the video processing error codes. 267e41f4b71Sopenharmony_ci 268e41f4b71Sopenharmony_ci**Since**: 12 269e41f4b71Sopenharmony_ci 270e41f4b71Sopenharmony_ci 271e41f4b71Sopenharmony_ci### VideoProcessing_State 272e41f4b71Sopenharmony_ci 273e41f4b71Sopenharmony_ci``` 274e41f4b71Sopenharmony_citypedef enum VideoProcessing_StateVideoProcessing_State 275e41f4b71Sopenharmony_ci``` 276e41f4b71Sopenharmony_ci 277e41f4b71Sopenharmony_ci**Description** 278e41f4b71Sopenharmony_ci 279e41f4b71Sopenharmony_ciDefines an enum for the video processing states. 280e41f4b71Sopenharmony_ci 281e41f4b71Sopenharmony_ciThe video processing state is reported through the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate). 282e41f4b71Sopenharmony_ci 283e41f4b71Sopenharmony_ci**Since**: 12 284e41f4b71Sopenharmony_ci 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_ci## Enum Description 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ci 289e41f4b71Sopenharmony_ci### VideoDetailEnhancer_QualityLevel 290e41f4b71Sopenharmony_ci 291e41f4b71Sopenharmony_ci``` 292e41f4b71Sopenharmony_cienum VideoDetailEnhancer_QualityLevel 293e41f4b71Sopenharmony_ci``` 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci**Description** 296e41f4b71Sopenharmony_ci 297e41f4b71Sopenharmony_ciEnumerates the quality levels for detail enhancement. 298e41f4b71Sopenharmony_ci 299e41f4b71Sopenharmony_ciFor details about the enumerated values, see [VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL](#video_detail_enhancer_parameter_key_quality_level). For details about how to set the quality level, see the development guide. 300e41f4b71Sopenharmony_ci 301e41f4b71Sopenharmony_ci**See also**: [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) and [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) 302e41f4b71Sopenharmony_ci 303e41f4b71Sopenharmony_ci**Since**: 12 304e41f4b71Sopenharmony_ci 305e41f4b71Sopenharmony_ci| Value| Description| 306e41f4b71Sopenharmony_ci| -------- | -------- | 307e41f4b71Sopenharmony_ci| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_NONE | No detail enhancement.| 308e41f4b71Sopenharmony_ci| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_LOW | Low-quality detail enhancement, which features fast speed. This is the default value.| 309e41f4b71Sopenharmony_ci| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_MEDIUM | Medium-quality detail enhancement, which features moderate speed.| 310e41f4b71Sopenharmony_ci| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_HIGH | High-quality detail enhancement, which features slow speed.| 311e41f4b71Sopenharmony_ci 312e41f4b71Sopenharmony_ci 313e41f4b71Sopenharmony_ci### VideoProcessing_ErrorCode 314e41f4b71Sopenharmony_ci 315e41f4b71Sopenharmony_ci``` 316e41f4b71Sopenharmony_cienum VideoProcessing_ErrorCode 317e41f4b71Sopenharmony_ci``` 318e41f4b71Sopenharmony_ci 319e41f4b71Sopenharmony_ci**Description** 320e41f4b71Sopenharmony_ci 321e41f4b71Sopenharmony_ciEnumerates the video processing error codes. 322e41f4b71Sopenharmony_ci 323e41f4b71Sopenharmony_ci**Since**: 12 324e41f4b71Sopenharmony_ci 325e41f4b71Sopenharmony_ci| Value| Description| 326e41f4b71Sopenharmony_ci| -------- | -------- | 327e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_SUCCESS | The processing is successful.| 328e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_INVALID_PARAMETER | An input parameter is invalid. This error code is returned in the following cases:<br>1 - The input or output video buffer is either invalid or empty.<br>2 - The provided parameter is invalid or missing.<br>3 - The requested processing type is invalid.| 329e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_UNKNOWN | An unknown error occurs. For example, the GPU computing or memcpy fails.| 330e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED | The global video processing environment, for example, the GPU environment, fails to be initialized.| 331e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_CREATE_FAILED | Creating the video processing instance fails. For example, the total number of instances exceeds the upper limit.| 332e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_PROCESS_FAILED | The processing fails. For example, the processing times out.| 333e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING | The processing type is not supported. You can call OH_VideoProcessing_Is*XXX*Supported to check whether a specific processing type is supported.| 334e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED | The operation is not allowed. For example, the function is called in an incorrect running state.| 335e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_NO_MEMORY | Insufficient memory.| 336e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_INVALID_INSTANCE | The video processing instance is invalid, for example, a null instance.| 337e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_ERROR_INVALID_VALUE | The input value is invalid. This error code is returned in the following cases:<br>1 - The width and height of the video buffer are inappropriate or the color space is incorrect.<br>2 - The parameter contains an invalid value. For example, the quality level of detail enhancement is incorrect.| 338e41f4b71Sopenharmony_ci 339e41f4b71Sopenharmony_ci 340e41f4b71Sopenharmony_ci### VideoProcessing_State 341e41f4b71Sopenharmony_ci 342e41f4b71Sopenharmony_ci``` 343e41f4b71Sopenharmony_cienum VideoProcessing_State 344e41f4b71Sopenharmony_ci``` 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ci**Description** 347e41f4b71Sopenharmony_ci 348e41f4b71Sopenharmony_ciEnumerates the video processing states. 349e41f4b71Sopenharmony_ci 350e41f4b71Sopenharmony_ciThe video processing state is reported through the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate). 351e41f4b71Sopenharmony_ci 352e41f4b71Sopenharmony_ci**Since**: 12 353e41f4b71Sopenharmony_ci 354e41f4b71Sopenharmony_ci| Value| Description| 355e41f4b71Sopenharmony_ci| -------- | -------- | 356e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_STATE_RUNNING | Video processing is in progress.| 357e41f4b71Sopenharmony_ci| VIDEO_PROCESSING_STATE_STOPPED | Video processing stopped.| 358e41f4b71Sopenharmony_ci 359e41f4b71Sopenharmony_ci 360e41f4b71Sopenharmony_ci## Function Description 361e41f4b71Sopenharmony_ci 362e41f4b71Sopenharmony_ci 363e41f4b71Sopenharmony_ci### OH_VideoProcessing_Create() 364e41f4b71Sopenharmony_ci 365e41f4b71Sopenharmony_ci``` 366e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_Create (OH_VideoProcessing ** videoProcessor, int type ) 367e41f4b71Sopenharmony_ci``` 368e41f4b71Sopenharmony_ci 369e41f4b71Sopenharmony_ci**Description** 370e41f4b71Sopenharmony_ci 371e41f4b71Sopenharmony_ciCreates a video processing instance. 372e41f4b71Sopenharmony_ci 373e41f4b71Sopenharmony_ci**Since**: 12 374e41f4b71Sopenharmony_ci 375e41f4b71Sopenharmony_ci**Parameters** 376e41f4b71Sopenharmony_ci 377e41f4b71Sopenharmony_ci| Name| Description| 378e41f4b71Sopenharmony_ci| -------- | -------- | 379e41f4b71Sopenharmony_ci| videoProcessor | Double pointer to the video processing instance created. Before any input, **\*videoProcessor** must be a null pointer.| 380e41f4b71Sopenharmony_ci| type | Video processing type. The processing type of an instance cannot be changed.| 381e41f4b71Sopenharmony_ci 382e41f4b71Sopenharmony_ci**Returns** 383e41f4b71Sopenharmony_ci 384e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 385e41f4b71Sopenharmony_ci 386e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the video processing instance is created successfully. 387e41f4b71Sopenharmony_ci 388e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** if the video processing type is not supported. 389e41f4b71Sopenharmony_ci For example, if metadata generation is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** is returned. 390e41f4b71Sopenharmony_ci 391e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_CREATE_FAILED** if the video processing instance fails to be created. 392e41f4b71Sopenharmony_ci 393e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or the pointer to the instance is not null. 394e41f4b71Sopenharmony_ci 395e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the video processing type is invalid. 396e41f4b71Sopenharmony_ci 397e41f4b71Sopenharmony_ci 398e41f4b71Sopenharmony_ci### OH_VideoProcessing_DeinitializeEnvironment() 399e41f4b71Sopenharmony_ci 400e41f4b71Sopenharmony_ci``` 401e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_DeinitializeEnvironment (void ) 402e41f4b71Sopenharmony_ci``` 403e41f4b71Sopenharmony_ci 404e41f4b71Sopenharmony_ci**Description** 405e41f4b71Sopenharmony_ci 406e41f4b71Sopenharmony_ciReleases the global video processing environment. 407e41f4b71Sopenharmony_ci 408e41f4b71Sopenharmony_ciBefore calling this API, you must call [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) to initialize the environment. Generally, this function is called when the main process is about to exit. Do not call this function when a video processing instance is running. 409e41f4b71Sopenharmony_ci 410e41f4b71Sopenharmony_ci**Since**: 12 411e41f4b71Sopenharmony_ci 412e41f4b71Sopenharmony_ci**Returns** 413e41f4b71Sopenharmony_ci 414e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 415e41f4b71Sopenharmony_ci 416e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. 417e41f4b71Sopenharmony_ci 418e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if a video processing instance is not destroyed or [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) is not called to initialize the environment. 419e41f4b71Sopenharmony_ci 420e41f4b71Sopenharmony_ci 421e41f4b71Sopenharmony_ci### OH_VideoProcessing_Destroy() 422e41f4b71Sopenharmony_ci 423e41f4b71Sopenharmony_ci``` 424e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_Destroy (OH_VideoProcessing * videoProcessor) 425e41f4b71Sopenharmony_ci``` 426e41f4b71Sopenharmony_ci 427e41f4b71Sopenharmony_ci**Description** 428e41f4b71Sopenharmony_ci 429e41f4b71Sopenharmony_ciDestroys a video processing instance. 430e41f4b71Sopenharmony_ci 431e41f4b71Sopenharmony_ciBefore destroying the instance, call [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) to stop it. 432e41f4b71Sopenharmony_ci 433e41f4b71Sopenharmony_ci**Since**: 12 434e41f4b71Sopenharmony_ci 435e41f4b71Sopenharmony_ci**Parameters** 436e41f4b71Sopenharmony_ci 437e41f4b71Sopenharmony_ci| Name| Description| 438e41f4b71Sopenharmony_ci| -------- | -------- | 439e41f4b71Sopenharmony_ci| videoProcessor | Pointer to the video processing instance. You are advised to set the pointer to a null pointer after the instance is destroyed.| 440e41f4b71Sopenharmony_ci 441e41f4b71Sopenharmony_ci**Returns** 442e41f4b71Sopenharmony_ci 443e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 444e41f4b71Sopenharmony_ci 445e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the instance is destroyed. 446e41f4b71Sopenharmony_ci 447e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 448e41f4b71Sopenharmony_ci 449e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the instance is still running. 450e41f4b71Sopenharmony_ci 451e41f4b71Sopenharmony_ci 452e41f4b71Sopenharmony_ci### OH_VideoProcessing_GetParameter() 453e41f4b71Sopenharmony_ci 454e41f4b71Sopenharmony_ci``` 455e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_GetParameter (OH_VideoProcessing * videoProcessor, OH_AVFormat * parameter ) 456e41f4b71Sopenharmony_ci``` 457e41f4b71Sopenharmony_ci 458e41f4b71Sopenharmony_ci**Description** 459e41f4b71Sopenharmony_ci 460e41f4b71Sopenharmony_ciObtains video processing parameters. 461e41f4b71Sopenharmony_ci 462e41f4b71Sopenharmony_ci**Since**: 12 463e41f4b71Sopenharmony_ci 464e41f4b71Sopenharmony_ci**Parameters** 465e41f4b71Sopenharmony_ci 466e41f4b71Sopenharmony_ci| Name| Description| 467e41f4b71Sopenharmony_ci| -------- | -------- | 468e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 469e41f4b71Sopenharmony_ci| parameter | Pointer to the video processing parameters.| 470e41f4b71Sopenharmony_ci 471e41f4b71Sopenharmony_ci**Returns** 472e41f4b71Sopenharmony_ci 473e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 474e41f4b71Sopenharmony_ci 475e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the parameters are obtained. 476e41f4b71Sopenharmony_ci 477e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 478e41f4b71Sopenharmony_ci 479e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the parameter is empty. 480e41f4b71Sopenharmony_ci 481e41f4b71Sopenharmony_ci 482e41f4b71Sopenharmony_ci### OH_VideoProcessing_GetSurface() 483e41f4b71Sopenharmony_ci 484e41f4b71Sopenharmony_ci``` 485e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_GetSurface (OH_VideoProcessing * videoProcessor, OHNativeWindow ** window ) 486e41f4b71Sopenharmony_ci``` 487e41f4b71Sopenharmony_ci 488e41f4b71Sopenharmony_ci**Description** 489e41f4b71Sopenharmony_ci 490e41f4b71Sopenharmony_ciObtains a surface for video processing. 491e41f4b71Sopenharmony_ci 492e41f4b71Sopenharmony_ciAn input surface must be created before video processing starts, and it must be destroyed by calling [OH_NativeWindow_DestroyNativeWindow](../apis-arkgraphics2d/_native_window.md#oh_nativewindow_destroynativewindow) when it is no longer needed. 493e41f4b71Sopenharmony_ci 494e41f4b71Sopenharmony_ci**Since**: 12 495e41f4b71Sopenharmony_ci 496e41f4b71Sopenharmony_ci**Parameters** 497e41f4b71Sopenharmony_ci 498e41f4b71Sopenharmony_ci| Name| Description| 499e41f4b71Sopenharmony_ci| -------- | -------- | 500e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 501e41f4b71Sopenharmony_ci| window | Double pointer to the input surface. For example, the input surface pointer can point to an output surface of the video decoder.| 502e41f4b71Sopenharmony_ci 503e41f4b71Sopenharmony_ci**Returns** 504e41f4b71Sopenharmony_ci 505e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 506e41f4b71Sopenharmony_ci 507e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. 508e41f4b71Sopenharmony_ci 509e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 510e41f4b71Sopenharmony_ci 511e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the window is a null pointer or the pointer to the window is not null. 512e41f4b71Sopenharmony_ci 513e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the surface fails to be created, an input surface has been created, or the video processing instance is running. 514e41f4b71Sopenharmony_ci 515e41f4b71Sopenharmony_ci 516e41f4b71Sopenharmony_ci### OH_VideoProcessing_InitializeEnvironment() 517e41f4b71Sopenharmony_ci 518e41f4b71Sopenharmony_ci``` 519e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_InitializeEnvironment (void ) 520e41f4b71Sopenharmony_ci``` 521e41f4b71Sopenharmony_ci 522e41f4b71Sopenharmony_ci**Description** 523e41f4b71Sopenharmony_ci 524e41f4b71Sopenharmony_ciInitializes the global video processing environment. 525e41f4b71Sopenharmony_ci 526e41f4b71Sopenharmony_ciThis function is optional. It is called only once when the main process is started to initialize the global video processing environment. This reduces the duration for running [OH_VideoProcessing_Create](#oh_videoprocessing_create). The global video processing environment must be released by calling [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment). For details about how and when to release the environment, see [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment). 527e41f4b71Sopenharmony_ci 528e41f4b71Sopenharmony_ci**Since**: 12 529e41f4b71Sopenharmony_ci 530e41f4b71Sopenharmony_ci**Returns** 531e41f4b71Sopenharmony_ci 532e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 533e41f4b71Sopenharmony_ci 534e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the initialization is successful. 535e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED** if the initialization fails. 536e41f4b71Sopenharmony_ci 537e41f4b71Sopenharmony_ciIf the operation fails, check whether the GPU works properly. 538e41f4b71Sopenharmony_ci 539e41f4b71Sopenharmony_ci 540e41f4b71Sopenharmony_ci### OH_VideoProcessing_IsColorSpaceConversionSupported() 541e41f4b71Sopenharmony_ci 542e41f4b71Sopenharmony_ci``` 543e41f4b71Sopenharmony_cibool OH_VideoProcessing_IsColorSpaceConversionSupported (const VideoProcessing_ColorSpaceInfo * sourceVideoInfo, const VideoProcessing_ColorSpaceInfo * destinationVideoInfo ) 544e41f4b71Sopenharmony_ci``` 545e41f4b71Sopenharmony_ci 546e41f4b71Sopenharmony_ci**Description** 547e41f4b71Sopenharmony_ci 548e41f4b71Sopenharmony_ciChecks whether color space conversion is supported during video processing. 549e41f4b71Sopenharmony_ci 550e41f4b71Sopenharmony_ci**Since**: 12 551e41f4b71Sopenharmony_ci 552e41f4b71Sopenharmony_ci**Parameters** 553e41f4b71Sopenharmony_ci 554e41f4b71Sopenharmony_ci| Name| Description| 555e41f4b71Sopenharmony_ci| -------- | -------- | 556e41f4b71Sopenharmony_ci| sourceVideoInfo | Pointer to the color space information of the input video.| 557e41f4b71Sopenharmony_ci| destinationVideoInfo | Pointer to the color space information of the output video.| 558e41f4b71Sopenharmony_ci 559e41f4b71Sopenharmony_ci**Returns** 560e41f4b71Sopenharmony_ci 561e41f4b71Sopenharmony_ciReturns **true** if color space conversion is supported; returns **false** otherwise. 562e41f4b71Sopenharmony_ci 563e41f4b71Sopenharmony_ci 564e41f4b71Sopenharmony_ci### OH_VideoProcessing_IsMetadataGenerationSupported() 565e41f4b71Sopenharmony_ci 566e41f4b71Sopenharmony_ci``` 567e41f4b71Sopenharmony_cibool OH_VideoProcessing_IsMetadataGenerationSupported (const VideoProcessing_ColorSpaceInfo * sourceVideoInfo) 568e41f4b71Sopenharmony_ci``` 569e41f4b71Sopenharmony_ci 570e41f4b71Sopenharmony_ci**Description** 571e41f4b71Sopenharmony_ci 572e41f4b71Sopenharmony_ciChecks whether metadata generation is supported during video processing. 573e41f4b71Sopenharmony_ci 574e41f4b71Sopenharmony_ci**Since**: 12 575e41f4b71Sopenharmony_ci 576e41f4b71Sopenharmony_ci**Parameters** 577e41f4b71Sopenharmony_ci 578e41f4b71Sopenharmony_ci| Name| Description| 579e41f4b71Sopenharmony_ci| -------- | -------- | 580e41f4b71Sopenharmony_ci| sourceVideoInfo | Pointer to the color space information of the input video.| 581e41f4b71Sopenharmony_ci 582e41f4b71Sopenharmony_ci**Returns** 583e41f4b71Sopenharmony_ci 584e41f4b71Sopenharmony_ciReturns **true** if metadata generation is supported; returns **false** otherwise. 585e41f4b71Sopenharmony_ci 586e41f4b71Sopenharmony_ci 587e41f4b71Sopenharmony_ci### OH_VideoProcessing_RegisterCallback() 588e41f4b71Sopenharmony_ci 589e41f4b71Sopenharmony_ci``` 590e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_RegisterCallback (OH_VideoProcessing * videoProcessor, const VideoProcessing_Callback * callback, void * userData ) 591e41f4b71Sopenharmony_ci``` 592e41f4b71Sopenharmony_ci 593e41f4b71Sopenharmony_ci**Description** 594e41f4b71Sopenharmony_ci 595e41f4b71Sopenharmony_ciRegisters a callback for video processing. 596e41f4b71Sopenharmony_ci 597e41f4b71Sopenharmony_ciThe callback function should be registered before video processing starts. During video processing, it cannot be registered. 598e41f4b71Sopenharmony_ci 599e41f4b71Sopenharmony_ci**Since**: 12 600e41f4b71Sopenharmony_ci 601e41f4b71Sopenharmony_ci**Parameters** 602e41f4b71Sopenharmony_ci 603e41f4b71Sopenharmony_ci| Name| Description| 604e41f4b71Sopenharmony_ci| -------- | -------- | 605e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 606e41f4b71Sopenharmony_ci| callback | Pointer to the callback function.| 607e41f4b71Sopenharmony_ci| userData | Pointer to user-defined data.| 608e41f4b71Sopenharmony_ci 609e41f4b71Sopenharmony_ci**Returns** 610e41f4b71Sopenharmony_ci 611e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 612e41f4b71Sopenharmony_ci 613e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the callback function is registered. 614e41f4b71Sopenharmony_ci 615e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 616e41f4b71Sopenharmony_ci 617e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the callback function pointer is null. 618e41f4b71Sopenharmony_ci 619e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the instance is still running. 620e41f4b71Sopenharmony_ci 621e41f4b71Sopenharmony_ci 622e41f4b71Sopenharmony_ci### OH_VideoProcessing_RenderOutputBuffer() 623e41f4b71Sopenharmony_ci 624e41f4b71Sopenharmony_ci``` 625e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_RenderOutputBuffer (OH_VideoProcessing * videoProcessor, uint32_t index ) 626e41f4b71Sopenharmony_ci``` 627e41f4b71Sopenharmony_ci 628e41f4b71Sopenharmony_ci**Description** 629e41f4b71Sopenharmony_ci 630e41f4b71Sopenharmony_ciRenders and processes the buffer, and then outputs it. 631e41f4b71Sopenharmony_ci 632e41f4b71Sopenharmony_ciIf the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) is set, the buffer index is returned through the callback function after the output buffer is ready. 633e41f4b71Sopenharmony_ci 634e41f4b71Sopenharmony_ci**Since**: 12 635e41f4b71Sopenharmony_ci 636e41f4b71Sopenharmony_ci**Parameters** 637e41f4b71Sopenharmony_ci 638e41f4b71Sopenharmony_ci| Name| Description| 639e41f4b71Sopenharmony_ci| -------- | -------- | 640e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 641e41f4b71Sopenharmony_ci| index | Index of the output buffer.| 642e41f4b71Sopenharmony_ci 643e41f4b71Sopenharmony_ci**Returns** 644e41f4b71Sopenharmony_ci 645e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 646e41f4b71Sopenharmony_ci 647e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. 648e41f4b71Sopenharmony_ci 649e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 650e41f4b71Sopenharmony_ci 651e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the index is invalid. 652e41f4b71Sopenharmony_ci 653e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) is not set or the instance is stopped. 654e41f4b71Sopenharmony_ci 655e41f4b71Sopenharmony_ci 656e41f4b71Sopenharmony_ci### OH_VideoProcessing_SetParameter() 657e41f4b71Sopenharmony_ci 658e41f4b71Sopenharmony_ci``` 659e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_SetParameter (OH_VideoProcessing * videoProcessor, const OH_AVFormat * parameter ) 660e41f4b71Sopenharmony_ci``` 661e41f4b71Sopenharmony_ci 662e41f4b71Sopenharmony_ci**Description** 663e41f4b71Sopenharmony_ci 664e41f4b71Sopenharmony_ciSets video processing parameters. 665e41f4b71Sopenharmony_ci 666e41f4b71Sopenharmony_ci**Since**: 12 667e41f4b71Sopenharmony_ci 668e41f4b71Sopenharmony_ci**Parameters** 669e41f4b71Sopenharmony_ci 670e41f4b71Sopenharmony_ci| Name| Description| 671e41f4b71Sopenharmony_ci| -------- | -------- | 672e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 673e41f4b71Sopenharmony_ci| parameter | Pointer to a video processing parameter instance.| 674e41f4b71Sopenharmony_ci 675e41f4b71Sopenharmony_ci**Returns** 676e41f4b71Sopenharmony_ci 677e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 678e41f4b71Sopenharmony_ci 679e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the parameters are successfully set. 680e41f4b71Sopenharmony_ci 681e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 682e41f4b71Sopenharmony_ci 683e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the parameter is empty. 684e41f4b71Sopenharmony_ci 685e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_VALUE** if some attributes of a parameter are invalid, for example, unsupported parameter value. 686e41f4b71Sopenharmony_ci 687e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_NO_MEMORY** if memory allocation fails. 688e41f4b71Sopenharmony_ci 689e41f4b71Sopenharmony_ci 690e41f4b71Sopenharmony_ci### OH_VideoProcessing_SetSurface() 691e41f4b71Sopenharmony_ci 692e41f4b71Sopenharmony_ci``` 693e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_SetSurface (OH_VideoProcessing * videoProcessor, const OHNativeWindow * window ) 694e41f4b71Sopenharmony_ci``` 695e41f4b71Sopenharmony_ci 696e41f4b71Sopenharmony_ci**Description** 697e41f4b71Sopenharmony_ci 698e41f4b71Sopenharmony_ciSets an output surface for video processing. 699e41f4b71Sopenharmony_ci 700e41f4b71Sopenharmony_ciAn output surface must be set before video processing starts. 701e41f4b71Sopenharmony_ci 702e41f4b71Sopenharmony_ci**Since**: 12 703e41f4b71Sopenharmony_ci 704e41f4b71Sopenharmony_ci**Parameters** 705e41f4b71Sopenharmony_ci 706e41f4b71Sopenharmony_ci| Name| Description| 707e41f4b71Sopenharmony_ci| -------- | -------- | 708e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 709e41f4b71Sopenharmony_ci| window | Pointer to the output surface.| 710e41f4b71Sopenharmony_ci 711e41f4b71Sopenharmony_ci**Returns** 712e41f4b71Sopenharmony_ci 713e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 714e41f4b71Sopenharmony_ci 715e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the output surface is successfully set. 716e41f4b71Sopenharmony_ci 717e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 718e41f4b71Sopenharmony_ci 719e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the window is a null pointer. 720e41f4b71Sopenharmony_ci 721e41f4b71Sopenharmony_ci 722e41f4b71Sopenharmony_ci### OH_VideoProcessing_Start() 723e41f4b71Sopenharmony_ci 724e41f4b71Sopenharmony_ci``` 725e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_Start (OH_VideoProcessing * videoProcessor) 726e41f4b71Sopenharmony_ci``` 727e41f4b71Sopenharmony_ci 728e41f4b71Sopenharmony_ci**Description** 729e41f4b71Sopenharmony_ci 730e41f4b71Sopenharmony_ciStarts video processing. 731e41f4b71Sopenharmony_ci 732e41f4b71Sopenharmony_ciAfter video processing starts, the callback [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) reports the **VIDEO_PROCESSING_STATE_RUNNING** state. For details, see [VideoProcessing_State](#videoprocessing_state). 733e41f4b71Sopenharmony_ci 734e41f4b71Sopenharmony_ci**Since**: 12 735e41f4b71Sopenharmony_ci 736e41f4b71Sopenharmony_ci**Parameters** 737e41f4b71Sopenharmony_ci 738e41f4b71Sopenharmony_ci| Name| Description| 739e41f4b71Sopenharmony_ci| -------- | -------- | 740e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 741e41f4b71Sopenharmony_ci 742e41f4b71Sopenharmony_ci**Returns** 743e41f4b71Sopenharmony_ci 744e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 745e41f4b71Sopenharmony_ci 746e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. 747e41f4b71Sopenharmony_ci 748e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 749e41f4b71Sopenharmony_ci 750e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if no output surface is set, no input surface is created, or the instance is running. 751e41f4b71Sopenharmony_ci 752e41f4b71Sopenharmony_ci 753e41f4b71Sopenharmony_ci### OH_VideoProcessing_Stop() 754e41f4b71Sopenharmony_ci 755e41f4b71Sopenharmony_ci``` 756e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessing_Stop (OH_VideoProcessing * videoProcessor) 757e41f4b71Sopenharmony_ci``` 758e41f4b71Sopenharmony_ci 759e41f4b71Sopenharmony_ci**Description** 760e41f4b71Sopenharmony_ci 761e41f4b71Sopenharmony_ciStops video processing. 762e41f4b71Sopenharmony_ci 763e41f4b71Sopenharmony_ciAfter video processing stops, the callback [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) reports the **VIDEO_PROCESSING_STATE_STOPPED** state. For details, see [VideoProcessing_State](#videoprocessing_state). 764e41f4b71Sopenharmony_ci 765e41f4b71Sopenharmony_ci**Since**: 12 766e41f4b71Sopenharmony_ci 767e41f4b71Sopenharmony_ci**Parameters** 768e41f4b71Sopenharmony_ci 769e41f4b71Sopenharmony_ci| Name| Description| 770e41f4b71Sopenharmony_ci| -------- | -------- | 771e41f4b71Sopenharmony_ci| videoProcessor | Pointer to a video processing instance.| 772e41f4b71Sopenharmony_ci 773e41f4b71Sopenharmony_ci**Returns** 774e41f4b71Sopenharmony_ci 775e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 776e41f4b71Sopenharmony_ci 777e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. 778e41f4b71Sopenharmony_ci 779e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. 780e41f4b71Sopenharmony_ci 781e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the instance is stopped. 782e41f4b71Sopenharmony_ci 783e41f4b71Sopenharmony_ci 784e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_BindOnError() 785e41f4b71Sopenharmony_ci 786e41f4b71Sopenharmony_ci``` 787e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnError (VideoProcessing_Callback * callback, OH_VideoProcessingCallback_OnError onError ) 788e41f4b71Sopenharmony_ci``` 789e41f4b71Sopenharmony_ci 790e41f4b71Sopenharmony_ci**Description** 791e41f4b71Sopenharmony_ci 792e41f4b71Sopenharmony_ciBinds the callback function [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror) to a video processing callback object. 793e41f4b71Sopenharmony_ci 794e41f4b71Sopenharmony_ci**Since**: 12 795e41f4b71Sopenharmony_ci 796e41f4b71Sopenharmony_ci**Parameters** 797e41f4b71Sopenharmony_ci 798e41f4b71Sopenharmony_ci| Name| Description| 799e41f4b71Sopenharmony_ci| -------- | -------- | 800e41f4b71Sopenharmony_ci| callback | Pointer to a callback object.| 801e41f4b71Sopenharmony_ci| onError | Callback function to bind.| 802e41f4b71Sopenharmony_ci 803e41f4b71Sopenharmony_ci**Returns** 804e41f4b71Sopenharmony_ci 805e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 806e41f4b71Sopenharmony_ci 807e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the binding is successful. 808e41f4b71Sopenharmony_ci 809e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** or **onError** is null. 810e41f4b71Sopenharmony_ci 811e41f4b71Sopenharmony_ci 812e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_BindOnNewOutputBuffer() 813e41f4b71Sopenharmony_ci 814e41f4b71Sopenharmony_ci``` 815e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnNewOutputBuffer (VideoProcessing_Callback * callback, OH_VideoProcessingCallback_OnNewOutputBuffer onNewOutputBuffer ) 816e41f4b71Sopenharmony_ci``` 817e41f4b71Sopenharmony_ci 818e41f4b71Sopenharmony_ci**Description** 819e41f4b71Sopenharmony_ci 820e41f4b71Sopenharmony_ciBinds the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) to a video processing callback object. 821e41f4b71Sopenharmony_ci 822e41f4b71Sopenharmony_ci**Since**: 12 823e41f4b71Sopenharmony_ci 824e41f4b71Sopenharmony_ci**Parameters** 825e41f4b71Sopenharmony_ci 826e41f4b71Sopenharmony_ci| Name| Description| 827e41f4b71Sopenharmony_ci| -------- | -------- | 828e41f4b71Sopenharmony_ci| callback | Pointer to a callback object.| 829e41f4b71Sopenharmony_ci| onNewOutputBuffer | Callback function to bind.| 830e41f4b71Sopenharmony_ci 831e41f4b71Sopenharmony_ci**Returns** 832e41f4b71Sopenharmony_ci 833e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 834e41f4b71Sopenharmony_ci 835e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the binding is successful. 836e41f4b71Sopenharmony_ci 837e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** is null. 838e41f4b71Sopenharmony_ci 839e41f4b71Sopenharmony_ci 840e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_BindOnState() 841e41f4b71Sopenharmony_ci 842e41f4b71Sopenharmony_ci``` 843e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnState (VideoProcessing_Callback * callback, OH_VideoProcessingCallback_OnState onState ) 844e41f4b71Sopenharmony_ci``` 845e41f4b71Sopenharmony_ci 846e41f4b71Sopenharmony_ci**Description** 847e41f4b71Sopenharmony_ci 848e41f4b71Sopenharmony_ciBinds the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) to a video processing callback object. 849e41f4b71Sopenharmony_ci 850e41f4b71Sopenharmony_ci**Since**: 12 851e41f4b71Sopenharmony_ci 852e41f4b71Sopenharmony_ci**Parameters** 853e41f4b71Sopenharmony_ci 854e41f4b71Sopenharmony_ci| Name| Description| 855e41f4b71Sopenharmony_ci| -------- | -------- | 856e41f4b71Sopenharmony_ci| callback | Pointer to a callback object.| 857e41f4b71Sopenharmony_ci| onState | Callback function to bind.| 858e41f4b71Sopenharmony_ci 859e41f4b71Sopenharmony_ci**Returns** 860e41f4b71Sopenharmony_ci 861e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 862e41f4b71Sopenharmony_ci 863e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the binding is successful. 864e41f4b71Sopenharmony_ci 865e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** or **onState** is null. 866e41f4b71Sopenharmony_ci 867e41f4b71Sopenharmony_ci 868e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_Create() 869e41f4b71Sopenharmony_ci 870e41f4b71Sopenharmony_ci``` 871e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessingCallback_Create (VideoProcessing_Callback ** callback) 872e41f4b71Sopenharmony_ci``` 873e41f4b71Sopenharmony_ci 874e41f4b71Sopenharmony_ci**Description** 875e41f4b71Sopenharmony_ci 876e41f4b71Sopenharmony_ciCreates a video processing callback object. 877e41f4b71Sopenharmony_ci 878e41f4b71Sopenharmony_ci**Since**: 12 879e41f4b71Sopenharmony_ci 880e41f4b71Sopenharmony_ci**Parameters** 881e41f4b71Sopenharmony_ci 882e41f4b71Sopenharmony_ci| Name| Description| 883e41f4b71Sopenharmony_ci| -------- | -------- | 884e41f4b71Sopenharmony_ci| callback | Double pointer to the video processing callback object. Before creating a callback object, **\*callback** must be a null pointer.| 885e41f4b71Sopenharmony_ci 886e41f4b71Sopenharmony_ci**Returns** 887e41f4b71Sopenharmony_ci 888e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 889e41f4b71Sopenharmony_ci 890e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the callback object is created. 891e41f4b71Sopenharmony_ci 892e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** is null or **\*callback** is not null. 893e41f4b71Sopenharmony_ci 894e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_NO_MEMORY** if the memory is insufficient. 895e41f4b71Sopenharmony_ci 896e41f4b71Sopenharmony_ci 897e41f4b71Sopenharmony_ci### OH_VideoProcessingCallback_Destroy() 898e41f4b71Sopenharmony_ci 899e41f4b71Sopenharmony_ci``` 900e41f4b71Sopenharmony_ciVideoProcessing_ErrorCode OH_VideoProcessingCallback_Destroy (VideoProcessing_Callback * callback) 901e41f4b71Sopenharmony_ci``` 902e41f4b71Sopenharmony_ci 903e41f4b71Sopenharmony_ci**Description** 904e41f4b71Sopenharmony_ci 905e41f4b71Sopenharmony_ciDestroys a video processing callback object. 906e41f4b71Sopenharmony_ci 907e41f4b71Sopenharmony_ciThe video processing callback object can be destroyed after the callback function is registered. 908e41f4b71Sopenharmony_ci 909e41f4b71Sopenharmony_ci**Since**: 12 910e41f4b71Sopenharmony_ci 911e41f4b71Sopenharmony_ci**Parameters** 912e41f4b71Sopenharmony_ci 913e41f4b71Sopenharmony_ci| Name| Description| 914e41f4b71Sopenharmony_ci| -------- | -------- | 915e41f4b71Sopenharmony_ci| callback | Pointer to the callback object. You are advised to set the pointer to a null pointer after the callback object is destroyed.| 916e41f4b71Sopenharmony_ci 917e41f4b71Sopenharmony_ci**Returns** 918e41f4b71Sopenharmony_ci 919e41f4b71Sopenharmony_ciReturns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): 920e41f4b71Sopenharmony_ci 921e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_SUCCESS** if the callback object is destroyed. 922e41f4b71Sopenharmony_ci 923e41f4b71Sopenharmony_ci- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** is null. 924e41f4b71Sopenharmony_ci 925e41f4b71Sopenharmony_ci 926e41f4b71Sopenharmony_ci## Variable Description 927e41f4b71Sopenharmony_ci 928e41f4b71Sopenharmony_ci 929e41f4b71Sopenharmony_ci### VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL 930e41f4b71Sopenharmony_ci 931e41f4b71Sopenharmony_ci``` 932e41f4b71Sopenharmony_ciconst char* VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL 933e41f4b71Sopenharmony_ci``` 934e41f4b71Sopenharmony_ci 935e41f4b71Sopenharmony_ci**Description** 936e41f4b71Sopenharmony_ci 937e41f4b71Sopenharmony_ciPointer to the quality level of video detail enhancement. 938e41f4b71Sopenharmony_ci 939e41f4b71Sopenharmony_ciFor details about the available options, see [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel). You can call [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) to set the quality level, and call [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) to obtain the quality level. 940e41f4b71Sopenharmony_ci 941e41f4b71Sopenharmony_ci**Since**: 12 942e41f4b71Sopenharmony_ci 943e41f4b71Sopenharmony_ci 944e41f4b71Sopenharmony_ci### VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION 945e41f4b71Sopenharmony_ci 946e41f4b71Sopenharmony_ci``` 947e41f4b71Sopenharmony_ciconst int32_t VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION 948e41f4b71Sopenharmony_ci``` 949e41f4b71Sopenharmony_ci 950e41f4b71Sopenharmony_ci**Description** 951e41f4b71Sopenharmony_ci 952e41f4b71Sopenharmony_ciInstance created for color space conversion during video processing. 953e41f4b71Sopenharmony_ci 954e41f4b71Sopenharmony_ciCall [OH_VideoProcessing_Create](#oh_videoprocessing_create) to create such an instance for color space conversion. If color space conversion is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) is returned. 955e41f4b71Sopenharmony_ci 956e41f4b71Sopenharmony_ci**Since**: 12 957e41f4b71Sopenharmony_ci 958e41f4b71Sopenharmony_ci 959e41f4b71Sopenharmony_ci### VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER 960e41f4b71Sopenharmony_ci 961e41f4b71Sopenharmony_ci``` 962e41f4b71Sopenharmony_ciconst int32_t VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER 963e41f4b71Sopenharmony_ci``` 964e41f4b71Sopenharmony_ci 965e41f4b71Sopenharmony_ci**Description** 966e41f4b71Sopenharmony_ci 967e41f4b71Sopenharmony_ciInstance for detail enhancement during video processing. 968e41f4b71Sopenharmony_ci 969e41f4b71Sopenharmony_ciCall [OH_VideoProcessing_Create](#oh_videoprocessing_create) to create such an instance for detail enhancement. If detail enhancement is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) is returned. 970e41f4b71Sopenharmony_ci 971e41f4b71Sopenharmony_ci**Since**: 12 972e41f4b71Sopenharmony_ci 973e41f4b71Sopenharmony_ci 974e41f4b71Sopenharmony_ci### VIDEO_PROCESSING_TYPE_METADATA_GENERATION 975e41f4b71Sopenharmony_ci 976e41f4b71Sopenharmony_ci``` 977e41f4b71Sopenharmony_ciconst int32_t VIDEO_PROCESSING_TYPE_METADATA_GENERATION 978e41f4b71Sopenharmony_ci``` 979e41f4b71Sopenharmony_ci 980e41f4b71Sopenharmony_ci**Description** 981e41f4b71Sopenharmony_ci 982e41f4b71Sopenharmony_ciInstance created for metadata generation during video processing. 983e41f4b71Sopenharmony_ci 984e41f4b71Sopenharmony_ciCall [OH_VideoProcessing_Create](#oh_videoprocessing_create) to create such an instance for metadata generation. If metadata generation is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) is returned. 985e41f4b71Sopenharmony_ci 986e41f4b71Sopenharmony_ci**Since**: 12 987