• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# video_processing.h
2<!--Kit: Media Kit-->
3<!--Subsystem: Multimedia-->
4<!--Owner: @wang-haizhou6-->
5<!--Designer: @HmQQQ-->
6<!--Tester: @xchaosioda-->
7<!--Adviser: @zengyawen-->
8
9## Overview
10
11The file declares the video processing functions.
12
13It provides video processing capabilities, including color space conversion, metadata generation, and video scaling.
14
15**File to include**: <multimedia/video_processing_engine/video_processing.h>
16
17**Library**: libvideo_processing.so
18
19**System capability**: SystemCapability.Multimedia.VideoProcessingEngine
20
21**Since**: 12
22
23**Related module**: [VideoProcessing](capi-videoprocessing.md)
24
25## Summary
26
27### Functions
28
29| Name| Description|
30| -- | -- |
31| [VideoProcessing_ErrorCode OH_VideoProcessing_InitializeEnvironment(void)](#oh_videoprocessing_initializeenvironment) | Initializes the global video processing environment.<br>This function is optional.<br>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).|
32| [VideoProcessing_ErrorCode OH_VideoProcessing_DeinitializeEnvironment(void)](#oh_videoprocessing_deinitializeenvironment) | Releases the global video processing environment.<br>Before calling this API, you must call [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) to initialize the environment.<br>Generally, this function is called when the main process is about to exit.<br>Do not call this function when a video processing instance is running.|
33| [bool OH_VideoProcessing_IsColorSpaceConversionSupported(const VideoProcessing_ColorSpaceInfo* sourceVideoInfo, const VideoProcessing_ColorSpaceInfo* destinationVideoInfo)](#oh_videoprocessing_iscolorspaceconversionsupported) | Checks whether color space conversion is supported during video processing.|
34| [bool OH_VideoProcessing_IsMetadataGenerationSupported(const VideoProcessing_ColorSpaceInfo* sourceVideoInfo)](#oh_videoprocessing_ismetadatagenerationsupported) | Checks whether metadata generation is supported during video processing.|
35| [VideoProcessing_ErrorCode OH_VideoProcessing_Create(OH_VideoProcessing** videoProcessor, int type)](#oh_videoprocessing_create) | Creates a video processing instance.|
36| [VideoProcessing_ErrorCode OH_VideoProcessing_Destroy(OH_VideoProcessing* videoProcessor)](#oh_videoprocessing_destroy) | Destroys a video processing instance.<br>Before destroying the instance, call [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) to stop it.|
37| [VideoProcessing_ErrorCode OH_VideoProcessing_RegisterCallback(OH_VideoProcessing* videoProcessor, const VideoProcessing_Callback* callback, void* userData)](#oh_videoprocessing_registercallback) | Registers a callback for video processing.<br>The callback function should be registered before video processing starts. During video processing, it cannot be registered.|
38| [VideoProcessing_ErrorCode OH_VideoProcessing_SetSurface(OH_VideoProcessing* videoProcessor, const OHNativeWindow* window)](#oh_videoprocessing_setsurface) | Sets an output surface for video processing.<br>An output surface must be set before video processing starts.|
39| [VideoProcessing_ErrorCode OH_VideoProcessing_GetSurface(OH_VideoProcessing* videoProcessor, OHNativeWindow** window)](#oh_videoprocessing_getsurface) | Obtains a surface for video processing.<br>An input surface must be created before video processing starts, it must be destroyed by calling [OH_NativeWindow_DestroyNativeWindow](../apis-arkgraphics2d/capi-external-window-h.md#oh_nativewindow_destroynativewindow) when it is no longer needed.|
40| [VideoProcessing_ErrorCode OH_VideoProcessing_SetParameter(OH_VideoProcessing* videoProcessor, const OH_AVFormat* parameter)](#oh_videoprocessing_setparameter) | Sets video processing parameters.|
41| [VideoProcessing_ErrorCode OH_VideoProcessing_GetParameter(OH_VideoProcessing* videoProcessor, OH_AVFormat* parameter)](#oh_videoprocessing_getparameter) | Obtains video processing parameters.|
42| [VideoProcessing_ErrorCode OH_VideoProcessing_Start(OH_VideoProcessing* videoProcessor)](#oh_videoprocessing_start) | Starts video processing.<br>After video processing starts, the callback [OH_VideoProcessingCallback_OnState](capi-video-processing-types-h.md#oh_videoprocessingcallback_onstate) reports the [VIDEO_PROCESSING_STATE_RUNNING](capi-video-processing-types-h.md#videoprocessing_state) state.|
43| [VideoProcessing_ErrorCode OH_VideoProcessing_Stop(OH_VideoProcessing* videoProcessor)](#oh_videoprocessing_stop) | Stops video processing.<br>After video processing stops, the callback [OH_VideoProcessingCallback_OnState](capi-video-processing-types-h.md#oh_videoprocessingcallback_onstate) reports the [VIDEO_PROCESSING_STATE_STOPPED](capi-video-processing-types-h.md#videoprocessing_state) state.|
44| [VideoProcessing_ErrorCode OH_VideoProcessing_RenderOutputBuffer(OH_VideoProcessing* videoProcessor, uint32_t index)](#oh_videoprocessing_renderoutputbuffer) | Renders and processes the buffer, and then outputs it.<br>If the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](capi-video-processing-types-h.md#oh_videoprocessingcallback_onnewoutputbuffer) is set, the buffer index is returned through the callback function after the output buffer is ready.|
45| [VideoProcessing_ErrorCode OH_VideoProcessingCallback_Create(VideoProcessing_Callback** callback)](#oh_videoprocessingcallback_create) | Creates a video processing callback object.|
46| [VideoProcessing_ErrorCode OH_VideoProcessingCallback_Destroy(VideoProcessing_Callback* callback)](#oh_videoprocessingcallback_destroy) | Destroys a video processing callback object. The video processing callback object can be destroyed after the callback function is registered.|
47| [VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnError(VideoProcessing_Callback* callback, OH_VideoProcessingCallback_OnError onError)](#oh_videoprocessingcallback_bindonerror) | Binds the callback function [OH_VideoProcessingCallback_OnError](capi-video-processing-types-h.md#oh_videoprocessingcallback_onerror) to a video processing callback object.|
48| [VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnState(VideoProcessing_Callback* callback, OH_VideoProcessingCallback_OnState onState)](#oh_videoprocessingcallback_bindonstate) | Binds the callback function [OH_VideoProcessingCallback_OnState](capi-video-processing-types-h.md#oh_videoprocessingcallback_onstate) to a video processing callback object.|
49| [VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnNewOutputBuffer(VideoProcessing_Callback* callback, OH_VideoProcessingCallback_OnNewOutputBuffer onNewOutputBuffer)](#oh_videoprocessingcallback_bindonnewoutputbuffer) | Binds the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](capi-video-processing-types-h.md#oh_videoprocessingcallback_onnewoutputbuffer) to a video processing callback object.|
50
51## Function Description
52
53### OH_VideoProcessing_InitializeEnvironment()
54
55```
56VideoProcessing_ErrorCode OH_VideoProcessing_InitializeEnvironment(void)
57```
58
59**Description**
60
61Initializes the global video processing environment.
62
63This function is optional.
64
65It 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).
66
67The global video processing environment must be released by calling [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment).
68
69For details about how and when to release the environment, see [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment).
70
71**Since**: 12
72
73**Returns**
74
75| Type| Description|
76| -- | -- |
77| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The initialization is successful.<br>**VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED**: The initialization fails.<br> If the operation fails, check whether the GPU works properly.|
78
79### OH_VideoProcessing_DeinitializeEnvironment()
80
81```
82VideoProcessing_ErrorCode OH_VideoProcessing_DeinitializeEnvironment(void)
83```
84
85**Description**
86
87Releases the global video processing environment.
88
89Before calling this API, you must call [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) to initialize the environment.
90
91Generally, this function is called when the main process is about to exit.
92
93Do not call this function when a video processing instance is running.
94
95**Since**: 12
96
97**Returns**
98
99| Type| Description|
100| -- | -- |
101| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The processing is successful.<br> **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED**: A video processing instance is not destroyed or [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) is not called to initialize the environment.|
102
103### OH_VideoProcessing_IsColorSpaceConversionSupported()
104
105```
106bool OH_VideoProcessing_IsColorSpaceConversionSupported(const VideoProcessing_ColorSpaceInfo* sourceVideoInfo,const VideoProcessing_ColorSpaceInfo* destinationVideoInfo)
107```
108
109**Description**
110
111Checks whether color space conversion is supported during video processing.
112
113**Since**: 12
114
115
116**Parameters**
117
118| Parameter| Description|
119| -- | -- |
120| const [VideoProcessing_ColorSpaceInfo](capi-videoprocessing-videoprocessing-colorspaceinfo.md)* sourceVideoInfo | Pointer to the color space information of the input video.|
121| const [VideoProcessing_ColorSpaceInfo](capi-videoprocessing-videoprocessing-colorspaceinfo.md)* destinationVideoInfo | Pointer to the color space information of the output video.|
122
123**Returns**
124
125| Type| Description|
126| -- | -- |
127| bool | Check result for the support of color space conversion. **true** if supported, **false** otherwise.|
128
129### OH_VideoProcessing_IsMetadataGenerationSupported()
130
131```
132bool OH_VideoProcessing_IsMetadataGenerationSupported(const VideoProcessing_ColorSpaceInfo* sourceVideoInfo)
133```
134
135**Description**
136
137Checks whether metadata generation is supported during video processing.
138
139**Since**: 12
140
141
142**Parameters**
143
144| Parameter| Description|
145| -- | -- |
146| const [VideoProcessing_ColorSpaceInfo](capi-videoprocessing-videoprocessing-colorspaceinfo.md)* sourceVideoInfo | Pointer to the color space information of the input video.|
147
148**Returns**
149
150| Type| Description|
151| -- | -- |
152| bool | Check result for the support of metadata generation. **true** if supported, **false** otherwise.|
153
154### OH_VideoProcessing_Create()
155
156```
157VideoProcessing_ErrorCode OH_VideoProcessing_Create(OH_VideoProcessing** videoProcessor, int type)
158```
159
160**Description**
161
162Creates a video processing instance.
163
164**Since**: 12
165
166
167**Parameters**
168
169| Parameter| Description|
170| -- | -- |
171| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)** videoProcessor |  Double pointer to the video processing instance created. Before any input, **\*videoProcessor** must be nullptr.|
172| int type | Video processing type. The processing type of an instance cannot be changed.|
173
174**Returns**
175
176| Type| Description|
177| -- | -- |
178| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The video processing instance is created successfully.<br> **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING**: The processing type is not supported. For example, metadata generation is not supported.<br> **VIDEO_PROCESSING_ERROR_CREATE_FAILED**: The video processing instance fails to be created.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or the pointer to the instance is not null.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: The video processing type is invalid.|
179
180### OH_VideoProcessing_Destroy()
181
182```
183VideoProcessing_ErrorCode OH_VideoProcessing_Destroy(OH_VideoProcessing* videoProcessor)
184```
185
186**Description**
187
188Destroys a video processing instance.
189
190Before destroying the instance, call [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) to stop it.
191
192**Since**: 12
193
194
195**Parameters**
196
197| Parameter| Description|
198| -- | -- |
199| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance. You are advised to set the pointer to nullptr after the instance is destroyed.|
200
201**Returns**
202
203| Type| Description|
204| -- | -- |
205| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The instance is destroyed.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED**: The instance is still running.|
206
207### OH_VideoProcessing_RegisterCallback()
208
209```
210VideoProcessing_ErrorCode OH_VideoProcessing_RegisterCallback(OH_VideoProcessing* videoProcessor,const VideoProcessing_Callback* callback, void* userData)
211```
212
213**Description**
214
215Registers a callback for video processing.
216
217The callback function should be registered before video processing starts. During video processing, it cannot be registered.
218
219**Since**: 12
220
221
222**Parameters**
223
224| Parameter| Description|
225| -- | -- |
226| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
227| const [VideoProcessing_Callback](capi-videoprocessing-videoprocessing-callback.md)* callback | Pointer to the callback function.|
228| void* userData | Pointer to user-defined data.|
229
230**Returns**
231
232| Type| Description|
233| -- | -- |
234| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The callback function is registered.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: The callback function pointer is null.<br> **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED**: The instance is still running.|
235
236### OH_VideoProcessing_SetSurface()
237
238```
239VideoProcessing_ErrorCode OH_VideoProcessing_SetSurface(OH_VideoProcessing* videoProcessor,const OHNativeWindow* window)
240```
241
242**Description**
243
244Sets an output surface for video processing.
245
246An output surface must be set before video processing starts.
247
248**Since**: 12
249
250
251**Parameters**
252
253| Parameter| Description|
254| -- | -- |
255| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
256| const [OHNativeWindow](capi-videoprocessing-nativewindow.md)* window | Pointer to the output surface.|
257
258**Returns**
259
260| Type| Description|
261| -- | -- |
262| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The output surface is successfully set.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: The window is nullptr.|
263
264### OH_VideoProcessing_GetSurface()
265
266```
267VideoProcessing_ErrorCode OH_VideoProcessing_GetSurface(OH_VideoProcessing* videoProcessor, OHNativeWindow** window)
268```
269
270**Description**
271
272Obtains a surface for video processing.
273
274An input surface must be created before video processing starts, and it must be destroyed by calling [OH_NativeWindow_DestroyNativeWindow](../apis-arkgraphics2d/capi-external-window-h.md#oh_nativewindow_destroynativewindow) when it is no longer needed.
275
276**Since**: 12
277
278
279**Parameters**
280
281| Parameter| Description|
282| -- | -- |
283| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
284| [OHNativeWindow](capi-videoprocessing-nativewindow.md)** window | Double pointer to the input surface. For example, the input surface pointer can point to an output surface of the video decoder.|
285
286**Returns**
287
288| Type| Description|
289| -- | -- |
290| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The processing is successful.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: The window is nullptr or the pointer to the window is not null.<br> **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED**: The surface fails to be created, an input surface has been created, or the video processing instance is running.|
291
292### OH_VideoProcessing_SetParameter()
293
294```
295VideoProcessing_ErrorCode OH_VideoProcessing_SetParameter(OH_VideoProcessing* videoProcessor,const OH_AVFormat* parameter)
296```
297
298**Description**
299
300Sets video processing parameters.
301
302**Since**: 12
303
304
305**Parameters**
306
307| Parameter| Description|
308| -- | -- |
309| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
310| const [OH_AVFormat](capi-videoprocessing-oh-avformat.md)* parameter | Pointer to the video processing parameter instance.|
311
312**Returns**
313
314| Type| Description|
315| -- | -- |
316| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The parameters are successfully set.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: The parameter is empty.<br> **VIDEO_PROCESSING_ERROR_INVALID_VALUE**: Some properties of a parameter are invalid, for example, unsupported parameter value.<br> **VIDEO_PROCESSING_ERROR_NO_MEMORY**: Memory allocation fails.|
317
318### OH_VideoProcessing_GetParameter()
319
320```
321VideoProcessing_ErrorCode OH_VideoProcessing_GetParameter(OH_VideoProcessing* videoProcessor, OH_AVFormat* parameter)
322```
323
324**Description**
325
326Obtains video processing parameters.
327
328**Since**: 12
329
330
331**Parameters**
332
333| Parameter| Description|
334| -- | -- |
335| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
336| [OH_AVFormat](capi-videoprocessing-oh-avformat.md)* parameter | Pointer to the video processing parameter instance.|
337
338**Returns**
339
340| Type| Description|
341| -- | -- |
342| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The parameters are obtained.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: The parameter is empty.|
343
344### OH_VideoProcessing_Start()
345
346```
347VideoProcessing_ErrorCode OH_VideoProcessing_Start(OH_VideoProcessing* videoProcessor)
348```
349
350**Description**
351
352Starts video processing.
353
354After video processing starts, the callback [OH_VideoProcessingCallback_OnState](capi-video-processing-types-h.md#oh_videoprocessingcallback_onstate) reports the [VideoProcessing_State](capi-video-processing-types-h.md#videoprocessing_state).VIDEO_PROCESSING_STATE_RUNNING state.
355
356**Since**: 12
357
358
359**Parameters**
360
361| Parameter| Description|
362| -- | -- |
363| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
364
365**Returns**
366
367| Type| Description|
368| -- | -- |
369| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The processing is successful.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED**: No output surface is set, no input surface is created, or the instance is running.|
370
371### OH_VideoProcessing_Stop()
372
373```
374VideoProcessing_ErrorCode OH_VideoProcessing_Stop(OH_VideoProcessing* videoProcessor)
375```
376
377**Description**
378
379Stops video processing.
380
381After video processing stops, the callback [OH_VideoProcessingCallback_OnState](capi-video-processing-types-h.md#oh_videoprocessingcallback_onstate) reports the [VideoProcessing_State](capi-video-processing-types-h.md#videoprocessing_state).VIDEO_PROCESSING_STATE_STOPPED state.
382
383**Since**: 12
384
385
386**Parameters**
387
388| Parameter| Description|
389| -- | -- |
390| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
391
392**Returns**
393
394| Type| Description|
395| -- | -- |
396| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The processing is successful.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED**: The instance is stopped.|
397
398### OH_VideoProcessing_RenderOutputBuffer()
399
400```
401VideoProcessing_ErrorCode OH_VideoProcessing_RenderOutputBuffer(OH_VideoProcessing* videoProcessor, uint32_t index)
402```
403
404**Description**
405
406Renders and processes the buffer, and then outputs it.
407
408If the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](capi-video-processing-types-h.md#oh_videoprocessingcallback_onnewoutputbuffer) is set, the buffer index is returned through the callback function after the output buffer is ready.
409
410**Since**: 12
411
412
413**Parameters**
414
415| Parameter| Description|
416| -- | -- |
417| [OH_VideoProcessing](capi-videoprocessing-oh-videoprocessing.md)* videoProcessor | Pointer to the video processing instance.|
418| uint32_t index | Index of the output buffer.|
419
420**Returns**
421
422| Type| Description|
423| -- | -- |
424| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The processing is successful.<br> **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE**: The instance is null or is not a video processing instance.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: The index is invalid.<br> **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED**: The callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](capi-video-processing-types-h.md#oh_videoprocessingcallback_onnewoutputbuffer) is not set or the instance is stopped.|
425
426### OH_VideoProcessingCallback_Create()
427
428```
429VideoProcessing_ErrorCode OH_VideoProcessingCallback_Create(VideoProcessing_Callback** callback)
430```
431
432**Description**
433
434Creates a video processing callback object.
435
436**Since**: 12
437
438
439**Parameters**
440
441| Parameter| Description|
442| -- | -- |
443| [VideoProcessing_Callback](capi-videoprocessing-videoprocessing-callback.md)** callback |  Double pointer to the video processing callback object. Before creating a callback object, **\*callback** must be nullptr.|
444
445**Returns**
446
447| Type| Description|
448| -- | -- |
449| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The callback object is created.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: **callback** is null or **callback** is not null.<br> **VIDEO_PROCESSING_ERROR_NO_MEMORY**: The memory is insufficient.|
450
451### OH_VideoProcessingCallback_Destroy()
452
453```
454VideoProcessing_ErrorCode OH_VideoProcessingCallback_Destroy(VideoProcessing_Callback* callback)
455```
456
457**Description**
458
459Destroys a video processing callback object. The video processing callback object can be destroyed after the callback function is registered.
460
461**Since**: 12
462
463
464**Parameters**
465
466| Parameter| Description|
467| -- | -- |
468| [VideoProcessing_Callback](capi-videoprocessing-videoprocessing-callback.md)* callback | Pointer to the callback object. You are advised to set the pointer to nullptr after the callback object is destroyed.|
469
470**Returns**
471
472| Type| Description|
473| -- | -- |
474| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The callback object is destroyed.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: **callback** is null.|
475
476### OH_VideoProcessingCallback_BindOnError()
477
478```
479VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnError(VideoProcessing_Callback* callback,OH_VideoProcessingCallback_OnError onError)
480```
481
482**Description**
483
484Binds the callback function [OH_VideoProcessingCallback_OnError](capi-video-processing-types-h.md#oh_videoprocessingcallback_onerror) to a video processing callback object.
485
486**Since**: 12
487
488
489**Parameters**
490
491| Parameter| Description|
492| -- | -- |
493| [VideoProcessing_Callback](capi-videoprocessing-videoprocessing-callback.md)* callback | Pointer to the callback object.|
494| [OH_VideoProcessingCallback_OnError](capi-video-processing-types-h.md#oh_videoprocessingcallback_onerror) onError | Callback function to bind.|
495
496**Returns**
497
498| Type| Description|
499| -- | -- |
500| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The binding is successful.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: **callback** or **onError** is null.|
501
502### OH_VideoProcessingCallback_BindOnState()
503
504```
505VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnState(VideoProcessing_Callback* callback,OH_VideoProcessingCallback_OnState onState)
506```
507
508**Description**
509
510Binds the callback function [OH_VideoProcessingCallback_OnState](capi-video-processing-types-h.md#oh_videoprocessingcallback_onstate) to a video processing callback object.
511
512**Since**: 12
513
514
515**Parameters**
516
517| Parameter| Description|
518| -- | -- |
519| [VideoProcessing_Callback](capi-videoprocessing-videoprocessing-callback.md)* callback | Pointer to the callback object.|
520| [OH_VideoProcessingCallback_OnState](capi-video-processing-types-h.md#oh_videoprocessingcallback_onstate) onState | Callback function to bind.|
521
522**Returns**
523
524| Type| Description|
525| -- | -- |
526| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The binding is successful.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: **callback** or **onState** is null.|
527
528### OH_VideoProcessingCallback_BindOnNewOutputBuffer()
529
530```
531VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnNewOutputBuffer(VideoProcessing_Callback* callback,OH_VideoProcessingCallback_OnNewOutputBuffer onNewOutputBuffer)
532```
533
534**Description**
535
536Binds the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](capi-video-processing-types-h.md#oh_videoprocessingcallback_onnewoutputbuffer) to a video processing callback object.
537
538**Since**: 12
539
540
541**Parameters**
542
543| Parameter| Description|
544| -- | -- |
545| [VideoProcessing_Callback](capi-videoprocessing-videoprocessing-callback.md)* callback | Pointer to the callback object.|
546| [OH_VideoProcessingCallback_OnNewOutputBuffer](capi-video-processing-types-h.md#oh_videoprocessingcallback_onnewoutputbuffer) onNewOutputBuffer | Callback function to bind.|
547
548**Returns**
549
550| Type| Description|
551| -- | -- |
552| [VideoProcessing_ErrorCode](capi-video-processing-types-h.md#videoprocessing_errorcode) | **VIDEO_PROCESSING_SUCCESS**: The binding is successful.<br> **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER**: **callback** is null.|
553
554<!--no_check-->