openharmony 鸿蒙 capi-video-processing-types-h

2025-06-12 浏览 (1)

video_processing_types.h

Overview

The video_processing_types.h file declares the video processing types.

Library: libvideo_processing.so

System capability: SystemCapability.Multimedia.VideoProcessingEngine

Since: 12

Related module: VideoProcessing

Summary

Structs

Nametypedef KeywordDescription
VideoProcessing_ColorSpaceInfoVideoProcessing_ColorSpaceInfoDescribes the color space information of video processing.
OH_VideoProcessingOH_VideoProcessingDescribes 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. Before creation, ensure that the pointer is null. You can create different video processing instances with different processing types.
VideoProcessing_CallbackVideoProcessing_CallbackDescribes a callback object for handling video processing events.
You should define a null pointer for VideoProcessing_Callback and use OH_VideoProcessingCallback_Create to create a callback object. Before creation, ensure that the pointer is null. After creating the callback object, call OH_VideoProcessing_RegisterCallback to register it with the video processing instance.

Enums

Nametypedef KeywordDescription
VideoDetailEnhancer_QualityLevelVideoDetailEnhancer_QualityLevelEnumerates the quality levels for detail enhancement.
VideoProcessing_ErrorCodeVideoProcessing_ErrorCodeEnumerates the video processing error codes.
VideoProcessing_StateVideoProcessing_StateEnumerates the video processing states.
The video processing state is reported through the callback function OH_VideoProcessingCallback_OnState.

Functions

Nametypedef KeywordDescription
typedef void (*OH_VideoProcessingCallback_OnError)(OH_VideoProcessing* videoProcessor,VideoProcessing_ErrorCode error, void* userData)OH_VideoProcessingCallback_OnErrorCalled when an error occurs during video processing.
typedef void (*OH_VideoProcessingCallback_OnState)(OH_VideoProcessing* videoProcessor, VideoProcessing_State state,void* userData)OH_VideoProcessingCallback_OnStateCalled 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_OnNewOutputBufferCalled 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.

Variables

NameDescription
const int32_t VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSIONInstance 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.
Since: 12
const int32_t VIDEO_PROCESSING_TYPE_METADATA_GENERATIONInstance 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.
Since: 12
const int32_t VIDEO_PROCESSING_TYPE_DETAIL_ENHANCERInstance 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_LEVELPointer 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

Enum Description

VideoDetailEnhancer_QualityLevel

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 ItemDescription
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_NONENo detail enhancement.
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_LOWLow-quality detail enhancement, which features fast speed. This is the default value.
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_MEDIUMMedium-quality detail enhancement, which features moderate speed.
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_HIGHHigh-quality detail enhancement, which features slow speed.

See also

OH_VideoProcessing_SetParameter

OH_VideoProcessing_GetParameter

VideoProcessing_ErrorCode

enum VideoProcessing_ErrorCode

Description

Enumerates the video processing error codes.

Since: 12

Enum ItemDescription
VIDEO_PROCESSING_SUCCESSThe processing is successful.
VIDEO_PROCESSING_ERROR_INVALID_PARAMETER = 401An 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 = 29210001An unknown error occurs. For example, the GPU computing or memcpy fails.
VIDEO_PROCESSING_ERROR_INITIALIZE_FAILEDThe global video processing environment, for example, the GPU environment, fails to be initialized.
VIDEO_PROCESSING_ERROR_CREATE_FAILEDCreating the video processing instance fails. For example, the total number of instances exceeds the upper limit.
VIDEO_PROCESSING_ERROR_PROCESS_FAILEDThe processing fails. For example, the processing times out.
VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSINGThe processing type is not supported. You can call OH_VideoProcessing_IsXXXSupported to check whether a specific processing type is supported.
VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTEDThe operation is not allowed. For example, the function is called in an incorrect running state.
VIDEO_PROCESSING_ERROR_NO_MEMORYInsufficient memory.
VIDEO_PROCESSING_ERROR_INVALID_INSTANCEThe video processing instance is invalid, for example, a null instance.
VIDEO_PROCESSING_ERROR_INVALID_VALUEThe 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.

VideoProcessing_State

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 ItemDescription
VIDEO_PROCESSING_STATE_RUNNINGVideo processing is in progress.
VIDEO_PROCESSING_STATE_STOPPEDVideo processing stopped.

Function Description

OH_VideoProcessingCallback_OnError()

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 attribute. 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

ParameterDescription
OH_VideoProcessing* videoProcessorPointer to the video processing instance.
VideoProcessing_ErrorCode errorError code reported.
void* userDataPointer to user-defined data.

OH_VideoProcessingCallback_OnState()

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

ParameterDescription
OH_VideoProcessing* videoProcessorPointer to the video processing instance.
VideoProcessing_State stateVideo processing state.
void* userDataPointer to user-defined data.

OH_VideoProcessingCallback_OnNewOutputBuffer()

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

ParameterDescription
OH_VideoProcessing* videoProcessorPointer to the video processing instance.
uint32_t indexIndex of the output buffer.
void* userDataPointer to user-defined data.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Media Kit

harmony 鸿蒙AVImageGenerator

harmony 鸿蒙AVMetadataExtractor

harmony 鸿蒙AVPlayer

harmony 鸿蒙AVPlayerCallback

harmony 鸿蒙AVRecorder

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙OH_AVRecorder_Config

harmony 鸿蒙OH_AVRecorder_EncoderInfo

harmony 鸿蒙OH_AVRecorder_Location

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/qsQvps