The file declares the video processing types.
File to include: <multimedia/video_processing_engine/video_processing_types.h>
Library: libvideo_processing.so
System capability: SystemCapability.Multimedia.VideoProcessingEngine
Since: 12
Related module: VideoProcessing
| Name | typedef Keyword | Description |
|---|---|---|
| VideoProcessing_ColorSpaceInfo | VideoProcessing_ColorSpaceInfo | Describes the color space information of video processing. |
| OH_VideoProcessing | OH_VideoProcessing | Describes an object for video processing. You should define a null pointer for OH_VideoProcessing and use OH_VideoProcessing_Create to create a video processing instance. You can create different video processing instances with different processing types. |
| NativeWindow | OHNativeWindow | Describes the NativeWindow object. |
| OH_AVFormat | OH_AVFormat | Describes the OH_AVFormat object. |
| VideoProcessing_Callback | VideoProcessing_Callback | Describes a callback object for handling video processing events. Describes a callback object for handling video processing events. Before using OH_VideoProcessingCallback_Create to create a callback object, initialize the pointer of this type to a null pointer. After the callback object is created, you can call OH_VideoProcessing_RegisterCallback to register the callback object with the video processing instance. |
| Name | typedef Keyword | Description |
|---|---|---|
| VideoDetailEnhancer_QualityLevel | VideoDetailEnhancer_QualityLevel | Enumerates the quality levels for detail enhancement. |
| VideoMetadataGeneratorStyleControl | VideoMetadataGeneratorStyleControl | Enumerates the style modes available for video metadata generation. For details about the enumerated values, see VIDEO_METADATA_GENERATOR_STYLE_CONTROL. |
| VideoProcessing_ErrorCode | VideoProcessing_ErrorCode | Enumerates the video processing error codes. |
| VideoProcessing_State | VideoProcessing_State | Enumerates the video processing states. The video processing state is reported through the callback function OH_VideoProcessingCallback_OnState. |
| Name | typedef Keyword | Description |
|---|---|---|
| typedef void (*OH_VideoProcessingCallback_OnError)(OH_VideoProcessing* videoProcessor, VideoProcessing_ErrorCode error, void* userData) | OH_VideoProcessingCallback_OnError | Called when an error occurs during video processing. The following error codes defined in VideoProcessing_ErrorCode area available: VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING: unsupported processing. For example, conversion between the color space types for input and output is not supported. VIDEO_PROCESSING_ERROR_INVALID_VALUE: invalid video property. For example, the video color space is invalid. VIDEO_PROCESSING_ERROR_NO_MEMORY: out of memory. VIDEO_PROCESSING_ERROR_PROCESS_FAILED: An error occurs during the processing. |
| typedef void (*OH_VideoProcessingCallback_OnState)(OH_VideoProcessing* videoProcessor, VideoProcessing_State state, void* userData) | OH_VideoProcessingCallback_OnState | Called when the video processing state changes. After OH_VideoProcessing_Start is called, the video processing state changes to VideoProcessing_State.VIDEO_PROCESSING_STATE_RUNNING. After OH_VideoProcessing_Stop is called, the video processing state changes to VideoProcessing_State.VIDEO_PROCESSING_STATE_STOPPED after all buffers are processed. |
| typedef void (*OH_VideoProcessingCallback_OnNewOutputBuffer)(OH_VideoProcessing* videoProcessor, uint32_t index, void* userData) | OH_VideoProcessingCallback_OnNewOutputBuffer | Called when the output buffer is filled with data. After data is filled in each new output buffer, the index of the buffer is reported. Call 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. |
| Name | Description |
|---|---|
| const int32_t VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION | Instance created for color space conversion during video processing. Call OH_VideoProcessing_Create to create such an instance for color space conversion. If color space conversion is not supported, VideoProcessing_ErrorCode.VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING is returned. You can call OH_VideoProcessing_IsColorSpaceConversionSupported to check whether this processing is supported. Since: 12 |
| const int32_t VIDEO_PROCESSING_TYPE_METADATA_GENERATION | Instance created for metadata generation during video processing. Call OH_VideoProcessing_Create to create such an instance for metadata generation. If metadata generation is not supported, VideoProcessing_ErrorCode.VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING is returned. You can call OH_VideoProcessing_IsMetadataGenerationSupported to check whether this processing is supported. Since: 12 |
| const int32_t VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER | Instance for detail enhancement during video processing. Call OH_VideoProcessing_Create to create such an instance for detail enhancement. If detail enhancement is not supported, VideoProcessing_ErrorCode.VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING is returned. Since: 12 |
| const char* VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL | Pointer to the quality level of video detail enhancement. For details, see VideoDetailEnhancer_QualityLevel. You can call OH_VideoProcessing_SetParameter to set the quality level, and call OH_VideoProcessing_GetParameter to obtain the quality level. Since: 12 |
| const char * VIDEO_METADATA_GENERATOR_STYLE_CONTROL | Style mode available for video metadata generation. For details about the enumerated values, see VideoMetadataGeneratorStyleControl. Call OH_AVFormat_SetIntValue to set the video metadata generation style in the AVFormat parameter. Call OH_VideoProcessing_SetParameter to configure the current video metadata generation style. Call OH_VideoProcessing_GetParameter to obtain the current video metadata generation style. Since: 22 |
enum VideoDetailEnhancer_QualityLevel
Description
Enumerates the quality levels for detail enhancement. For details about the enumerated values, see VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL. For details about how to set the quality level, see the development guide.
Since: 12
| Enum Item | Description |
|---|---|
| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_NONE | No detail enhancement. |
| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_LOW | Low-quality detail enhancement, which features fast speed. This is the default value. |
| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_MEDIUM | Medium-quality detail enhancement, which features moderate speed. |
| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_HIGH | High-quality detail enhancement, which features slow speed. |
See also
enum VideoMetadataGeneratorStyleControl
Description
Enumerates the style modes available for video metadata generation. For details about the enumerated values, see VIDEO_METADATA_GENERATOR_STYLE_CONTROL.
Since: 22
| Enum Item | Description |
|---|---|
| VIDEO_METADATA_GENERATOR_CONTRAST_MODE = 0 | Prioritizes contrast optimization in the generated metadata. |
| VIDEO_METADATA_GENERATOR_BRIGHT_MODE = 1 | Prioritizes brightness optimization in the generated metadata. |
See also
OH_VideoProcessing_SetParameter
enum VideoProcessing_ErrorCode
Description
Enumerates the video processing error codes.
Since: 12
| Enum Item | Description |
|---|---|
| VIDEO_PROCESSING_SUCCESS | The processing is successful. |
| VIDEO_PROCESSING_ERROR_INVALID_PARAMETER = 401 | An input parameter is invalid. This error code is returned in the following cases: 1. The input or output video buffer is either invalid or empty. 2. The provided parameter is invalid or missing. 3. The requested processing type is invalid. |
| VIDEO_PROCESSING_ERROR_UNKNOWN = 29210001 | An unknown error occurs. For example, the GPU computing or memcpy fails. |
| VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED | The global video processing environment, for example, the GPU environment, fails to be initialized. Check whether the device supports GPU acceleration, or restart the app and try again. |
| VIDEO_PROCESSING_ERROR_CREATE_FAILED | Creating the video processing instance fails. For example, the total number of instances exceeds the upper limit. Call OH_VideoProcessing_Destroy to release the instance that is no longer used and try again. |
| VIDEO_PROCESSING_ERROR_PROCESS_FAILED | The processing fails. For example, the processing times out. |
| VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING | The processing type is not supported. For example, an attempt is made to create a video processing instance that is not supported. Currently, the following two video processing functions can be checked: OH_VideoProcessing_IsColorSpaceConversionSupported and OH_VideoProcessing_IsMetadataGenerationSupported. |
| VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED | The operation is not allowed. For example, the function is called in an incorrect running state. |
| VIDEO_PROCESSING_ERROR_NO_MEMORY | Insufficient memory. Release resources that are no longer used and try again, or reduce the video processing resolution. |
| VIDEO_PROCESSING_ERROR_INVALID_INSTANCE | The video processing instance is invalid, for example, a null instance. |
| VIDEO_PROCESSING_ERROR_INVALID_VALUE | The input value is invalid. This error code is returned in the following cases: 1. The width and height of the video buffer are inappropriate or the color space is incorrect. 2. The parameter contains an invalid value. For example, the quality level of detail enhancement is incorrect. |
enum VideoProcessing_State
Description
Enumerates the video processing states. The video processing state is reported through the callback function OH_VideoProcessingCallback_OnState.
Since: 12
| Enum Item | Description |
|---|---|
| VIDEO_PROCESSING_STATE_RUNNING | Video processing is in progress. |
| VIDEO_PROCESSING_STATE_STOPPED | Video processing stopped. |
typedef void (*OH_VideoProcessingCallback_OnError)(OH_VideoProcessing* videoProcessor, VideoProcessing_ErrorCode error, void* userData)
Description
Called when an error occurs during video processing.
The following error codes are defined in VideoProcessing_ErrorCode:
VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING: unsupported processing. For example, conversion between the color space types for input and output is not supported.
VIDEO_PROCESSING_ERROR_INVALID_VALUE: invalid video property. For example, the video color space is invalid.
VIDEO_PROCESSING_ERROR_NO_MEMORY: out of memory.
VIDEO_PROCESSING_ERROR_PROCESS_FAILED: An error occurs during the processing.
Since: 12
Parameters
| Parameter | Description |
|---|---|
| OH_VideoProcessing* videoProcessor | Pointer to the video processing instance. |
| VideoProcessing_ErrorCode error | Error code reported. |
| void* userData | Pointer to user-defined data. |
typedef void (*OH_VideoProcessingCallback_OnState)(OH_VideoProcessing* videoProcessor, VideoProcessing_State state, void* userData)
Description
Called when the video processing state changes.
After OH_VideoProcessing_Start is called, the video processing state changes to VideoProcessing_State.VIDEO_PROCESSING_STATE_RUNNING. After OH_VideoProcessing_Stop is called, the video processing state changes to VideoProcessing_State.VIDEO_PROCESSING_STATE_STOPPED after all buffers are processed.
Since: 12
Parameters
| Parameter | Description |
|---|---|
| OH_VideoProcessing* videoProcessor | Pointer to the video processing instance. |
| VideoProcessing_State state | Video processing state. |
| void* userData | Pointer to user-defined data. |
typedef void (*OH_VideoProcessingCallback_OnNewOutputBuffer)(OH_VideoProcessing* videoProcessor, uint32_t index, void* userData)
Description
Called when the output buffer is filled with data.
After data is filled in each new output buffer, the index of the buffer is reported. Call 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.
Since: 12
Parameters
| Parameter | Description |
|---|---|
| OH_VideoProcessing* videoProcessor | Pointer to the video processing instance. |
| uint32_t index | Index of the output buffer. |
| void* userData | Pointer to user-defined data. |