5.3. API Reference¶
Video output (VO) realizes video output device, video channel and other functions..
The APIs supported by this function module are introduced from the aspects of device, video layer, channel and so on.
Device related APIs are as follows:
CVI_VO_Enable: Enable video output device.
CVI_VO_Disable: Disable video output device.
CVI_VO_SetPubAttr: Set the properties of the video output device.
CVI_VO_GetPubAttr: Get the properties of the video output device.
CVI_VO_CloseFd: Close the file handle of the video output device.
Video layer related APIs are as follows:
CVI_VO_EnableVideoLayer: Enable video layer
CVI_VO_DisableVideoLayer: Disable video layer
CVI_VO_SetVideoLayerAttr: Set the properties of the video layer device
CVI_VO_GetVideoLayerAttr: Get the properties of the video layer device
Channel related APIs are as follows:
CVI_VO_EnableChn: Enable video output channel.
CVI_VO_DisableChn: Disable video output channel.
CVI_VO_SetChnAttr: Set the properties of the video output channel.
CVI_VO_GetChnAttr: Get the properties of the video output channel.
CVI_VO_ShowChn: Display the specified video output channel.
CVI_VO_HideChn: Hide the specified video output channel.
CVI_VO_SetChnRotation: Set the rotation property of the video output channel.
CVI_VO_GetChnRotation: Get the rotation property of the video output channel.
CVI_VO_PauseChn: Pause the output of the specified VO channel.
CVI_VO_ResumeChn: Resume the output of the specified VO channel.
5.3.1. CVI_VO_Enable¶
【Description】
Enable video output device.
【Syntax】
CVI_S32 CVI_VO_Enable(VO_DEV VoDev);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoDev |
Video output device number. Value range: [0, VO_MAX_DEV_NUM] |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
The device must be enabled before using the video output function.
Before calling the device enable, you must configure the common properties of the device.
Otherwise, an error message is displayed indicating that the device is not configured.
If you want to change the VO timing configuration,
you need to call the CVI_VO_Disable interface to forcibly disable the VO hardware before enabling it to avoid undesirable transients in the process of changing the timing.
【Example】
CVI_S32 s32Ret = CVI_SUCCESS;
s32Ret = CVI_VO_SetPubAttr(VoDev, pstPubAttr);
if (s32Ret != CVI_SUCCESS) {
SAMPLE_PRT("failed with %#x!\n", s32Ret);
return CVI_FAILURE;
}
s32Ret = CVI_VO_Enable(VoDev);
if (s32Ret != CVI_SUCCESS) {
SAMPLE_PRT("failed with %#x!\n", s32Ret);
return CVI_FAILURE;
}
【Related Topic】
5.3.2. CVI_VO_Disable¶
【Description】
Disable video output device.
【Syntax】
CVI_S32 CVI_VO_Disable(VO_DEV VoDev);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoDev |
Video output device number. Value range: [0, VO_MAX_DEV_NUM] |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
library file: libvpu.a
【Note】
The video layer on the device must be forbidden before the device is forbidden.
You can set device attributes only when the VO device is disabled.
【Example】
None.
【Related Topic】
5.3.3. CVI_VO_SetPubAttr¶
【Description】
Set the properties of the video output device.
【Syntax】
CVI_S32 CVI_VO_SetPubAttr(VO_DEV VoDev, const VO_PUB_ATTR_S *pstPubAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoDev |
Video output device number. Value range: [0, VO_MAX_DEV_NUM]。 |
Input |
pstPubAttr |
Pointer to the common attribute structure of the video output device. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
The property of video output device is static and must be configured before CVI_VO_Enable.
See VO_DEV for instructions on how to use DEV.
Please refer to the VO_PUB_ATTR_S chapter for the description of video output device properties.
【Example】
None.
【Related Topic】
5.3.4. CVI_VO_GetPubAttr¶
【Description】
Get the related properties of the video output device.
【Syntax】
CVI_S32 CVI_VO_GtPubAttr(VO_DEV VoDev, VO_PUB_ATTR_S *pstPubAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoDev |
Video output device number. Value range: [0, VO_MAX_DEV_NUM]. |
Input |
pstPubAttr |
Pointer to the common attribute structure of the video output device. |
Output |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
Obtain the attributes before setting the public attributes of the device so that you can set only the configuration items that you want to change.
【Example】
None.
【Related Topic】
5.3.5. CVI_VO_EnableVideoLayer¶
【Description】
Enable the video layer.
【Syntax】
CVI_S32 CVI_VO_EnableVideoLayer (VO_LAYER VoLayer);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
Before enabling the video layer, the device bound to the video layer must be enabled.
【Example】
None.
【Related Topic】
5.3.6. CVI_VO_DisableVideoLayer¶
【Description】
Disable the video layer.
【Syntax】
CVI_S32 CVI_VO_DisableVideoLayer (VO_LAYER VoLayer);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
Before the video layer is disabled, the channel on it must be disabled first.
【Example】
None.
【Related Topic】
5.3.7. CVI_VO_SetVideoLayerAttr¶
【Description】
Configure properties of the video layer.
【Syntax】
CVI_S32 CVI_VO_SetVideoLayerAttr (VO_LAYER VoLayer, const VO_VIDEO_LAYER_ATTR_S *pstLayerAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
pstLayerAttr |
Pointer to the video layer properties structure. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
None.
【Example】
None.
【Related Topic】
5.3.8. CVI_VO_GetVideoLayerAttr¶
【Description】
Get the related properties of the video layer.
【Syntax】
CVI_S32 CVI_VO_GetVideoLayerAttr (VO_LAYER VoLayer, VO_VIDEO_LAYER_ATTR_S *pstLayerAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
pstLayerAttr |
Pointer to the video layer properties structure. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
None.
【Example】
None.
【Related Topic】
5.3.9. CVI_VO_EnableChn¶
【Description】
Enables the specified video output channel.
【Syntax】
CVI_S32 CVI_VO_EnableChn(VO_LAYER VoLayer, VO_CHN VoChn);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel ID. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
The video layer on the corresponding device must be enabled before calling.
The channel must be configured before the channel is enabled. Otherwise an error message indicating that the channel is not configured is displayed.
【Example】
None.
【Related Topic】
5.3.10. CVI_VO_DisableChn¶
【Description】
Disable the video output channel.
【Syntax】
CVI_S32 CVI_VO_DisableChn(VO_LAYER VoLayer, VO_CHN VoChn);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel ID. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
None.
【Example】
None.
【Related Topic】
5.3.11. CVI_VO_SetChnAttr¶
【Description】
Configure the properties of the video output channel.
【Syntax】
CVI_S32 CVI_VO_SetPubAttr(VO_LAYER VoLayer, VO_CHN VoChn, const VO_CHN_ATTR_S *pstChnAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel ID. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
pstChnAttr |
Pointer to the properties structure of the video output channel. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
The channel display area should be smaller than the stImageSize set in the video layer properties.
【Example】
None.
【Related Topic】
5.3.12. CVI_VO_GetChnAttr¶
【Description】
Get the related properties of video output channel.
【Syntax】
CVI_S32 CVI_VO_GtPubAttr(VO_LAYER VoLayer, VO_CHN VoChn, VO_CHN_ATTR_S *pstChnAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel ID. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
pstChnAttr |
Pointer to the properties structure of the video output channel. |
Output |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
None.
【Example】
None.
【Related Topic】
5.3.13. CVI_VO_ShowChn¶
【Description】
Displays the specified video output channel.
【Syntax】
CVI_S32 CVI_VO_ShowChn(VO_LAYER VoLayer, VO_CHN VoChn);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel ID. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
Before calling, the video channel on the corresponding device must be enabled.
By default, it is in the display state.
【Example】
None.
【Related Topic】
5.3.14. CVI_VO_HideChn¶
【Description】
Hides the specified video output channel.
【Syntax】
CVI_S32 CVI_VO_HideChn(VO_LAYER VoLayer, VO_CHN VoChn);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel ID. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
None.
【Example】
None.
【Related Topic】
5.3.15. CVI_VO_SetChnRotation¶
【Description】
Set the properties of VO channel rotation.
【Syntax】
CVI_S32 CVI_VO_SetChnRotation(VO_LAYER VoLayer, VO_CHN VoChn, ROTATION_E enRotation);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel number. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
enRotation |
Rotation properties. See ROTATION_E for details. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
Before using this interface, you need to call CVI_VO_SetChnAttr(); otherwise, the system displays a failure message.
CV182x/CV181x supports rotation only in NV12, NV21, and YUV400 formats.
After setting, rotation will apply to the video image entering the channel.
Pay attention to setting the attribute size of the video layer and the video channel.
For example, the size of the channel is set to 1920x1080 and rotated 90 degrees, so the image input to the channel should be 1080x1920.
【Example】
None.
【Related Topic】
None.
5.3.16. CVI_VO_GetChnRotation¶
【Description】
Get the properties of VO channel rotation.
【Syntax】
CVI_S32 CVI_VO_GetChnRotation(VO_LAYER VoLayer, VO_CHN VoChn, ROTATION_E *penRotation);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel number. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
penRotation |
Rotation property pointer. See ROTATION_E for details. |
Output |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
Before using this interface, you need to call CVI_VO_SetChnAttr();
otherwise, the system displays a failure message.
【Example】
None.
【Related Topic】
5.3.17. CVI_VO_PauseChn¶
【Description】
Pause the output of the specified VO channel.
【Syntax】
CVI_S32 CVI_VO_PauseChn(VO_LAYER VoLayer, VO_CHN VoChn);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel number. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
The video channel on the corresponding device must be enabled before calling.
It is allowed to pause the same channel repeatedly without returning failure.
【Example】
None.
【Related Topic】
5.3.18. CVI_VO_ResumeChn¶
【Description】
Resume the output of the specified VO channel.
【Syntax】
CVI_S32 CVI_VO_ResumeChn(VO_LAYER VoLayer, VO_CHN VoChn);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
VoLayer |
Video output video layer ID. Value range: [0, VO_MAX_LAYER_NUM]. |
Input |
VoChn |
Video output channel number. Value range: [0, VO_MAX_CHN_NUM]. |
Input |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
The video channel on the corresponding device must be enabled before calling.
It is allowed to resume the same channel repeatedly without returning failure.
【Example】
None.
【Related Topic】
5.3.19. CVI_VO_CloseFd¶
【Description】
Close the file handle of the video output device.
【Syntax】
CVI_S32 CVI_VO_CloseFd(CVI_VOID);
【Parameter】
None.
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_vo.h, cvi_comm_vo.h
Library files: libvpu.a
【Note】
After this interface is invoked, other MMF interfaces on the VO become invalid.
【Example】
None.
【Related Topic】
None.