1# video_output.h 2<!--Kit: Camera Kit--> 3<!--Subsystem: Multimedia--> 4<!--Owner: @qano--> 5<!--SE: @leo_ysl--> 6<!--TSE: @xchaosioda--> 7 8## Overview 9 10The file declares the video output concepts. 11 12**File to include**: <ohcamera/video_output.h> 13 14**Library**: libohcamera.so 15 16**System capability**: SystemCapability.Multimedia.Camera.Core 17 18**Since**: 11 19 20**Related module**: [OH_Camera](capi-oh-camera.md) 21 22## Summary 23 24### Structs 25 26| Name| typedef Keyword| Description| 27| -- | -- | -- | 28| [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md) | VideoOutput_Callbacks | Describes the callbacks related to video output.| 29| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md) | Camera_VideoOutput | Describes the video output object.<br>You can use [OH_CameraManager_CreateVideoOutput](capi-camera-manager-h.md#oh_cameramanager_createvideooutput) to create such an object. | 30 31### Functions 32 33| Name| typedef Keyword| Description| 34| -- | -- | -- | 35| [typedef void (\*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput)](#oh_videooutput_onframestart) | OH_VideoOutput_OnFrameStart | Defines the callback defined in the [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md) struct and used to report video output frame start events.| 36| [typedef void (\*OH_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount)](#oh_videooutput_onframeend) | OH_VideoOutput_OnFrameEnd | Defines the callback defined in the [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md) struct and used to report video output frame end events.| 37| [typedef void (\*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode)](#oh_videooutput_onerror) | OH_VideoOutput_OnError | Defines the callback defined in the [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md) struct and used to report video output errors.| 38| [Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback)](#oh_videooutput_registercallback) | - | Registers a callback to listen for video output events.| 39| [Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback)](#oh_videooutput_unregistercallback) | - | Unregisters the callback used to listen for video output events.| 40| [Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput)](#oh_videooutput_start) | - | Starts video output.| 41| [Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput)](#oh_videooutput_stop) | - | Stops video output.| 42| [Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput)](#oh_videooutput_release) | - | Releases a VideoOutput instance.| 43| [Camera_ErrorCode OH_VideoOutput_GetActiveProfile(Camera_VideoOutput* videoOutput, Camera_VideoProfile** profile)](#oh_videooutput_getactiveprofile) | - | Obtains the profile of a VideoOutput instance.| 44| [Camera_ErrorCode OH_VideoOutput_DeleteProfile(Camera_VideoProfile* profile)](#oh_videooutput_deleteprofile) | - | Deletes the profile of a VideoOutput instance.| 45| [ Camera_ErrorCode OH_VideoOutput_IsMirrorSupported(Camera_VideoOutput* videoOutput, bool* isSupported)](#oh_videooutput_ismirrorsupported) | - | Checks whether a video output supports mirror mode.| 46| [ Camera_ErrorCode OH_VideoOutput_EnableMirror(Camera_VideoOutput* videoOutput, bool mirrorMode)](#oh_videooutput_enablemirror) | - | Enables or disables mirror mode for a video output.| 47| [ Camera_ErrorCode OH_VideoOutput_GetVideoRotation(Camera_VideoOutput* videoOutput, int deviceDegree,Camera_ImageRotation* imageRotation)](#oh_videooutput_getvideorotation) | - | Obtains the rotation angle of a video output.| 48| [Camera_ErrorCode OH_VideoOutput_GetSupportedFrameRates(Camera_VideoOutput* videoOutput,Camera_FrameRateRange** frameRateRange, uint32_t* size)](#oh_videooutput_getsupportedframerates) | - | Obtains the list of frame rates supported by a VideoOutput instance.| 49| [Camera_ErrorCode OH_VideoOutput_DeleteFrameRates(Camera_VideoOutput* videoOutput,Camera_FrameRateRange* frameRateRange)](#oh_videooutput_deleteframerates) | - | Deletes the frame rate list.| 50| [Camera_ErrorCode OH_VideoOutput_SetFrameRate(Camera_VideoOutput* videoOutput,int32_t minFps, int32_t maxFps)](#oh_videooutput_setframerate) | - | Sets the frame rates for a VideoOutput instance.| 51| [Camera_ErrorCode OH_VideoOutput_GetActiveFrameRate(Camera_VideoOutput* videoOutput,Camera_FrameRateRange* frameRateRange)](#oh_videooutput_getactiveframerate) | - | Obtains the active frame rates of a VideoOutput instance.| 52 53## Function Description 54 55### OH_VideoOutput_OnFrameStart() 56 57``` 58typedef void (*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput) 59``` 60 61**Description** 62 63Defines the callback defined in the [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md) struct and used to report video output frame start events. 64 65**Since**: 11 66 67 68**Parameters** 69 70| Name| Description| 71| -- | -- | 72| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance that transfers the callback.| 73 74### OH_VideoOutput_OnFrameEnd() 75 76``` 77typedef void (*OH_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount) 78``` 79 80**Description** 81 82Defines the callback defined in the [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md) struct and used to report video output frame end events. 83 84**Since**: 11 85 86 87**Parameters** 88 89| Name| Description| 90| -- | -- | 91| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance that transfers the callback.| 92| int32_t frameCount | Number of frames to be included in the callback.| 93 94### OH_VideoOutput_OnError() 95 96``` 97typedef void (*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode) 98``` 99 100**Description** 101 102Defines the callback defined in the [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md) struct and used to report video output errors. 103 104**Since**: 11 105 106 107**Parameters** 108 109| Name| Description| 110| -- | -- | 111| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance that transfers the callback.| 112| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) errorCode | Error code reported during video output.| 113 114**See also** 115 116[CAMERA_SERVICE_FATAL_ERROR](capi-camera-h.md#camera_errorcode) 117 118### OH_VideoOutput_RegisterCallback() 119 120``` 121Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback) 122``` 123 124**Description** 125 126Registers a callback to listen for video output events. 127 128**Since**: 11 129 130 131**Parameters** 132 133| Name| Description| 134| -- | -- | 135| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 136| [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md)* callback | Pointer to the target callback.| 137 138**Returns** 139 140| Type| Description| 141| -- | -- | 142| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.| 143 144### OH_VideoOutput_UnregisterCallback() 145 146``` 147Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback) 148``` 149 150**Description** 151 152Unregisters the callback used to listen for video output events. 153 154**Since**: 11 155 156 157**Parameters** 158 159| Name| Description| 160| -- | -- | 161| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 162| [VideoOutput_Callbacks](capi-oh-camera-videooutput-callbacks.md)* callback | Pointer to the target callback.| 163 164**Returns** 165 166| Type| Description| 167| -- | -- | 168| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.| 169 170### OH_VideoOutput_Start() 171 172``` 173Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput) 174``` 175 176**Description** 177 178Starts video output. 179 180**Since**: 11 181 182 183**Parameters** 184 185| Name| Description| 186| -- | -- | 187| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance to start.| 188 189**Returns** 190 191| Type| Description| 192| -- | -- | 193| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SESSION_NOT_CONFIG**: The capture session is not configured.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 194 195### OH_VideoOutput_Stop() 196 197``` 198Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput) 199``` 200 201**Description** 202 203Stops video output. 204 205**Since**: 11 206 207 208**Parameters** 209 210| Name| Description| 211| -- | -- | 212| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance to stop.| 213 214**Returns** 215 216| Type| Description| 217| -- | -- | 218| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 219 220### OH_VideoOutput_Release() 221 222``` 223Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput) 224``` 225 226**Description** 227 228Releases a VideoOutput instance. 229 230**Since**: 11 231 232 233**Parameters** 234 235| Name| Description| 236| -- | -- | 237| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance to release.| 238 239**Returns** 240 241| Type| Description| 242| -- | -- | 243| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 244 245### OH_VideoOutput_GetActiveProfile() 246 247``` 248Camera_ErrorCode OH_VideoOutput_GetActiveProfile(Camera_VideoOutput* videoOutput, Camera_VideoProfile** profile) 249``` 250 251**Description** 252 253Obtains the profile of a VideoOutput instance. 254 255**Since**: 12 256 257 258**Parameters** 259 260| Name| Description| 261| -- | -- | 262| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance for which the profile is to be obtained.| 263| [Camera_VideoProfile](capi-oh-camera-camera-videoprofile.md)** profile | Double pointer to the video output profile obtained.| 264 265**Returns** 266 267| Type| Description| 268| -- | -- | 269| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 270 271### OH_VideoOutput_DeleteProfile() 272 273``` 274Camera_ErrorCode OH_VideoOutput_DeleteProfile(Camera_VideoProfile* profile) 275``` 276 277**Description** 278 279Deletes the profile of a VideoOutput instance. 280 281**Since**: 12 282 283 284**Parameters** 285 286| Name| Description| 287| -- | -- | 288| [Camera_VideoProfile](capi-oh-camera-camera-videoprofile.md)* profile | Pointer to the profile to delete.| 289 290**Returns** 291 292| Type| Description| 293| -- | -- | 294| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.| 295 296### OH_VideoOutput_IsMirrorSupported() 297 298``` 299 Camera_ErrorCode OH_VideoOutput_IsMirrorSupported(Camera_VideoOutput* videoOutput, bool* isSupported) 300``` 301 302**Description** 303 304Checks whether a video output supports mirror mode. 305 306**Since**: 15 307 308 309**Parameters** 310 311| Name| Description| 312| -- | -- | 313| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 314| bool* isSupported | Pointer to the check result for the support of mirror mode. **true** if supported, **false** otherwise.| 315 316**Returns** 317 318| Type| Description| 319| -- | -- | 320| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 321 322### OH_VideoOutput_EnableMirror() 323 324``` 325 Camera_ErrorCode OH_VideoOutput_EnableMirror(Camera_VideoOutput* videoOutput, bool mirrorMode) 326``` 327 328**Description** 329 330Enables or disables mirror mode for a video output. 331 332**Since**: 15 333 334 335**Parameters** 336 337| Name| Description| 338| -- | -- | 339| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 340| bool mirrorMode | Whether to enable mirror mode. **TRUE** to enable, **FALSE** otherwise.| 341 342**Returns** 343 344| Type| Description| 345| -- | -- | 346| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 347 348### OH_VideoOutput_GetVideoRotation() 349 350``` 351 Camera_ErrorCode OH_VideoOutput_GetVideoRotation(Camera_VideoOutput* videoOutput, int deviceDegree,Camera_ImageRotation* imageRotation) 352``` 353 354**Description** 355 356Obtains the rotation angle of a video output. 357 358**Since**: 12 359 360 361**Parameters** 362 363| Name| Description| 364| -- | -- | 365| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 366| int deviceDegree | Clockwise rotation angle of the device relative to the natural direction (the charging port faces downward).| 367| [Camera_ImageRotation](capi-camera-h.md#camera_imagerotation)* imageRotation | Pointer to the rotation angle of the video output.| 368 369**Returns** 370 371| Type| Description| 372| -- | -- | 373| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 374 375### OH_VideoOutput_GetSupportedFrameRates() 376 377``` 378Camera_ErrorCode OH_VideoOutput_GetSupportedFrameRates(Camera_VideoOutput* videoOutput,Camera_FrameRateRange** frameRateRange, uint32_t* size) 379``` 380 381**Description** 382 383Obtains the list of frame rates supported by a VideoOutput instance. 384 385**Since**: 12 386 387 388**Parameters** 389 390| Name| Description| 391| -- | -- | 392| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 393| [Camera_FrameRateRange](capi-oh-camera-camera-frameraterange.md)** frameRateRange | Double pointer to the list of frame rates, if the function is successfully called.| 394| uint32_t* size | Pointer to the size of the list of frame rates.| 395 396**Returns** 397 398| Type| Description| 399| -- | -- | 400| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 401 402### OH_VideoOutput_DeleteFrameRates() 403 404``` 405Camera_ErrorCode OH_VideoOutput_DeleteFrameRates(Camera_VideoOutput* videoOutput,Camera_FrameRateRange* frameRateRange) 406``` 407 408**Description** 409 410Deletes the frame rate list. 411 412**Since**: 12 413 414 415**Parameters** 416 417| Name| Description| 418| -- | -- | 419| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 420| [Camera_FrameRateRange](capi-oh-camera-camera-frameraterange.md)* frameRateRange | Pointer to the list of frame rates to delete.| 421 422**Returns** 423 424| Type| Description| 425| -- | -- | 426| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.| 427 428### OH_VideoOutput_SetFrameRate() 429 430``` 431Camera_ErrorCode OH_VideoOutput_SetFrameRate(Camera_VideoOutput* videoOutput,int32_t minFps, int32_t maxFps) 432``` 433 434**Description** 435 436Sets the frame rates for a VideoOutput instance. 437 438**Since**: 12 439 440 441**Parameters** 442 443| Name| Description| 444| -- | -- | 445| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the VideoOutput instance for which the frame rates are to be set.| 446| int32_t minFps | Minimum frame rate.| 447| int32_t maxFps | Maximum frame rate.| 448 449**Returns** 450 451| Type| Description| 452| -- | -- | 453| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.| 454 455### OH_VideoOutput_GetActiveFrameRate() 456 457``` 458Camera_ErrorCode OH_VideoOutput_GetActiveFrameRate(Camera_VideoOutput* videoOutput,Camera_FrameRateRange* frameRateRange) 459``` 460 461**Description** 462 463Obtains the active frame rates of a VideoOutput instance. 464 465**Since**: 12 466 467 468**Parameters** 469 470| Name| Description| 471| -- | -- | 472| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)* videoOutput | Pointer to the target VideoOutput instance.| 473| [Camera_FrameRateRange](capi-oh-camera-camera-frameraterange.md)* frameRateRange | Pointer to the frame rate range, if the function is successfully called.| 474 475**Returns** 476 477| Type| Description| 478| -- | -- | 479| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.| 480