video_output.h

Overview

The file declares the video output concepts.

File to include: <ohcamera/video_output.h>

Library: libohcamera.so

System capability: SystemCapability.Multimedia.Camera.Core

Since: 11

Related module: OH_Camera

Summary

Structs

Name typedef Keyword Description
VideoOutput_Callbacks VideoOutput_Callbacks Describes the callbacks related to video output.
Camera_VideoOutput Camera_VideoOutput Describes the video output object.
You can use OH_CameraManager_CreateVideoOutput to create such an object.

Functions

Name typedef Keyword Description
typedef void (*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput) OH_VideoOutput_OnFrameStart Defines the callback defined in the VideoOutput_Callbacks struct and used to report video output frame start events.
typedef void (*OH_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount) OH_VideoOutput_OnFrameEnd Defines the callback defined in the VideoOutput_Callbacks struct and used to report video output frame end events.
typedef void (*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode) OH_VideoOutput_OnError Defines the callback defined in the VideoOutput_Callbacks struct and used to report video output errors.
Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback) - Registers a callback to listen for video output events.
Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback) - Unregisters the callback used to listen for video output events.
Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput) - Starts video output.
Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput) - Stops video output.
Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput) - Releases a VideoOutput instance.
Camera_ErrorCode OH_VideoOutput_GetActiveProfile(Camera_VideoOutput* videoOutput, Camera_VideoProfile** profile) - Obtains the profile of a VideoOutput instance.
Camera_ErrorCode OH_VideoOutput_DeleteProfile(Camera_VideoProfile* profile) - Deletes the profile of a VideoOutput instance.
Camera_ErrorCode OH_VideoOutput_IsMirrorSupported(Camera_VideoOutput* videoOutput, bool* isSupported) - Checks whether a video output supports mirror mode.
Camera_ErrorCode OH_VideoOutput_EnableMirror(Camera_VideoOutput* videoOutput, bool mirrorMode) - Enables or disables mirror mode for a video output.
Camera_ErrorCode OH_VideoOutput_GetVideoRotation(Camera_VideoOutput* videoOutput, int deviceDegree, Camera_ImageRotation* imageRotation) - Obtains the rotation angle of a video.
Camera_ErrorCode OH_VideoOutput_GetVideoRotationWithoutDeviceDegree(Camera_VideoOutput* videoOutput, Camera_ImageRotation* imageRotation) - Obtains the rotation angle of a video.
Camera_ErrorCode OH_VideoOutput_GetSupportedFrameRates(Camera_VideoOutput* videoOutput, Camera_FrameRateRange** frameRateRange, uint32_t* size) - Obtains the list of frame rates supported by a VideoOutput instance.
Camera_ErrorCode OH_VideoOutput_DeleteFrameRates(Camera_VideoOutput* videoOutput, Camera_FrameRateRange* frameRateRange) - Deletes the frame rate list.
Camera_ErrorCode OH_VideoOutput_SetFrameRate(Camera_VideoOutput* videoOutput, int32_t minFps, int32_t maxFps) - Sets the frame rates for a VideoOutput instance.
Camera_ErrorCode OH_VideoOutput_GetActiveFrameRate(Camera_VideoOutput* videoOutput, Camera_FrameRateRange* frameRateRange) - Obtains the active frame rates of a VideoOutput instance.

Function Description

OH_VideoOutput_OnFrameStart()

typedef void (*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput)

Description

Defines the callback defined in the VideoOutput_Callbacks struct and used to report video output frame start events.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance that transfers the callback.

OH_VideoOutput_OnFrameEnd()

typedef void (*OH_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount)

Description

Defines the callback defined in the VideoOutput_Callbacks struct and used to report video output frame end events.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance that transfers the callback.
int32_t frameCount Number of frames to be included in the callback.

OH_VideoOutput_OnError()

typedef void (*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode)

Description

Defines the callback defined in the VideoOutput_Callbacks struct and used to report video output errors.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance that transfers the callback.
Camera_ErrorCode errorCode Error code reported during video output.

See also

CAMERA_SERVICE_FATAL_ERROR

OH_VideoOutput_RegisterCallback()

Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback)

Description

Registers a callback to listen for video output events.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
VideoOutput_Callbacks* callback Pointer to the target callback.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_VideoOutput_UnregisterCallback()

Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback)

Description

Unregisters the callback used to listen for video output events.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
VideoOutput_Callbacks* callback Pointer to the target callback.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_VideoOutput_Start()

Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput)

Description

Starts video output.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance to start.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SESSION_NOT_CONFIG: The capture session is not configured.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_Stop()

Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput)

Description

Stops video output.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance to stop.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_Release()

Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput)

Description

Releases a VideoOutput instance.

Since: 11

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance to release.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_GetActiveProfile()

Camera_ErrorCode OH_VideoOutput_GetActiveProfile(Camera_VideoOutput* videoOutput, Camera_VideoProfile** profile)

Description

Obtains the profile of a VideoOutput instance.

Since: 12

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance for which the profile is to be obtained.
Camera_VideoProfile** profile Double pointer to the video output profile obtained.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_DeleteProfile()

Camera_ErrorCode OH_VideoOutput_DeleteProfile(Camera_VideoProfile* profile)

Description

Deletes the profile of a VideoOutput instance.

Since: 12

Parameters

Name Description
Camera_VideoProfile* profile Pointer to the profile to delete.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_VideoOutput_IsMirrorSupported()

 Camera_ErrorCode OH_VideoOutput_IsMirrorSupported(Camera_VideoOutput* videoOutput, bool* isSupported)

Description

Checks whether a video output supports mirror mode.

Since: 15

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
bool* isSupported Pointer to the check result for the support of mirror mode. true if supported, false otherwise.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_EnableMirror()

 Camera_ErrorCode OH_VideoOutput_EnableMirror(Camera_VideoOutput* videoOutput, bool mirrorMode)

Description

Enables or disables mirror mode for a video output.

Since: 15

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
bool mirrorMode Whether to enable or disable mirror mode. true to enable, false otherwise.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_GetVideoRotation()

 Camera_ErrorCode OH_VideoOutput_GetVideoRotation(Camera_VideoOutput* videoOutput, int deviceDegree, Camera_ImageRotation* imageRotation)

Description

Obtains the rotation angle of a video.

Since: 12

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
int deviceDegree Clockwise rotation angle of the device relative to the natural direction (the charging port faces downward).
Camera_ImageRotation* imageRotation Pointer to the rotation angle of the video output.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_GetVideoRotationWithoutDeviceDegree()

Camera_ErrorCode OH_VideoOutput_GetVideoRotationWithoutDeviceDegree(Camera_VideoOutput* videoOutput, Camera_ImageRotation* imageRotation)

Description

Obtains the rotation angle of a video.

Since: 23

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
Camera_ImageRotation* imageRotation Pointer to the rotation angle of the video output.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_GetSupportedFrameRates()

Camera_ErrorCode OH_VideoOutput_GetSupportedFrameRates(Camera_VideoOutput* videoOutput, Camera_FrameRateRange** frameRateRange, uint32_t* size)

Description

Obtains the list of frame rates supported by a VideoOutput instance.

Since: 12

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
Camera_FrameRateRange** frameRateRange Double pointer to the list of frame rates, if the function is successfully called.
uint32_t* size Pointer to the size of the list of frame rates.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_VideoOutput_DeleteFrameRates()

Camera_ErrorCode OH_VideoOutput_DeleteFrameRates(Camera_VideoOutput* videoOutput, Camera_FrameRateRange* frameRateRange)

Description

Deletes the frame rate list.

Since: 12

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
Camera_FrameRateRange* frameRateRange Pointer to the list of frame rates to delete.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_VideoOutput_SetFrameRate()

Camera_ErrorCode OH_VideoOutput_SetFrameRate(Camera_VideoOutput* videoOutput, int32_t minFps, int32_t maxFps)

Description

Sets the frame rates for a VideoOutput instance.

Since: 12

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the VideoOutput instance for which the frame rates are to be set.
int32_t minFps Minimum frame rate.
int32_t maxFps Maximum frame rate.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_VideoOutput_GetActiveFrameRate()

Camera_ErrorCode OH_VideoOutput_GetActiveFrameRate(Camera_VideoOutput* videoOutput, Camera_FrameRateRange* frameRateRange)

Description

Obtains the active frame rates of a VideoOutput instance.

Since: 12

Parameters

Name Description
Camera_VideoOutput* videoOutput Pointer to the target VideoOutput instance.
Camera_FrameRateRange* frameRateRange Pointer to the frame rate range, if the function is successfully called.

Returns

Type Description
Camera_ErrorCode CAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.