标签:lan ola 属性 ann 优先 描述符 _for 输出参数 amp
/********************************* *函数功能:开启VO设备 *输出参数: *返回值:成功为0 失败非0 *********************************/ HI_S32 enable_VO() { HI_S32 s32Ret; //返回值 VO_DEV VoDev = 0; //输出设备号 VO_PUB_ATTR_S stPubAttr; //VO公共属性。 s32Ret = HI_MPI_VO_GetPubAttr(VoDev, &stPubAttr); //获取视频输出设备的公共属性。 if (s32Ret != HI_SUCCESS) { printf("Get device attributes failed with error code %#x!\n", s32Ret); return HI_FAILURE; } /*配置VO公共属性*/ stPubAttr.u32BgColor = 0xff; //背景色 RGB格式 stPubAttr.enIntfType = VO_INTF_VGA; //VO接口类型 stPubAttr.enIntfSync = VO_OUTPUT_1280x1024_60; //VO时序类型 s32Ret = HI_MPI_VO_SetPubAttr(VoDev, &stPubAttr); //配置视频输出设备的公共属性 if (s32Ret != HI_SUCCESS) { printf("Set device attributes failed with errno %#x!\n", s32Ret); return HI_FAILURE; } s32Ret = HI_MPI_VO_Enable(VoDev); //启用视频输出设备 if (s32Ret != HI_SUCCESS) { printf("Enable vo dev %d failed with errno %#x!\n", VoDev, s32Ret); return HI_FAILURE; } /*.....*/ s32Ret = HI_MPI_VO_Disable(VoDev); //关闭VO设备 if (s32Ret != HI_SUCCESS) { printf("Enable vo dev %d failed with errno %#x!\n", VoDev, s32Ret); return HI_FAILURE; } s32Ret = HI_MPI_VO_CloseFd(); //关闭VO文件描述符 if (s32Ret != HI_SUCCESS) { printf("Some device is not disable with errno %#x!\n", VoDev, s32Ret); return HI_FAILURE; } }
/********************************* *函数功能:开启视频层 *输出参数: *返回值:成功为0 失败非0 *********************************/ HI_S32 start_VO_Layer() { HI_S32 s32Ret; //返回值 VO_LAYER VoLayer = 0; //视频层号 RECT_S stRect; VO_VIDEO_LAYER_ATTR_S stLayerAttr; //视频层属性 s32Ret = HI_MPI_VO_GetVideoLayerAttr(VoLayer, &stLayerAttr); //获取视频层属性 if (s32Ret != HI_SUCCESS) { printf("Get video layer attributes failed with errno %#x!\n", s32Ret); return HI_FAILURE; } /*定义视频层属性*/ //stDispRect——显示分辨率 stImageSize——图像分辨率 stLayerAttr.stDispRect.s32X = 0; //左上角顶点坐标 stLayerAttr.stDispRect.s32Y = 0; stLayerAttr.stDispRect.u32Width = 720; //显示分辨率 stLayerAttr.stDispRect.u32Height = 576; stLayerAttr.stImageSize.u32Width = 720; //画布大小(图像分辨率) stLayerAttr.stImageSize.u32Height = 576; stLayerAttr.u32DispFrmRt = 25; //帧率 stLayerAttr.enPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_422; //像素格式 stLayerAttr.bDoubleFrame = HI_TRUE; //视频是否开启倍频 stLayerAttr.bClusterMode = HI_FALSE; //视频层是否采用聚集的方式 s32Ret = HI_MPI_VO_SetVideoLayerAttr(VoLayer, &stLayerAttr); if (s32Ret != HI_SUCCESS) { printf("Set video layer attributes failed with errno %#x!\n", s32Ret); return HI_FAILURE; } s32Ret = HI_MPI_VO_EnableVideoLayer(VoLayer); //使能视频层 if (s32Ret != HI_SUCCESS) { printf("Enable video layer failed with errno %#x!\n", s32Ret); return HI_FAILURE; } s32Ret = HI_MPI_VO_DisableVideoLayer(VoLayer); //关闭视频层 if (s32Ret != HI_SUCCESS) { printf("Disable video layer failed with errno %#x!\n", s32Ret); return HI_FAILURE; } }
/********************************* *函数功能:使能视频输出通道 *输出参数: *返回值:成功为0 失败非0 *********************************/ HI_S32 start_VO_chn() { VO_DEV VoDev = 0; //VO设备 VO_LAYER VoLayer = 0; //VO视频输出视频层号 VO_CHN VoChn = 0; //VO视频输出通道 VO_CHN_ATTR_S stChnAttr; s32Ret = HI_MPI_VO_GetChnAttr(VoLayer, VoChn, &stChnAttr); //获取VO chn属性 if (s32Ret != HI_SUCCESS) { printf("Get channel attr failed with errno %#x!\n", s32Ret); return HI_FAILURE; } stChnAttr.u32Priority = 0; //通道优先级 stChnAttr.stRect.s32X = 0; //通道显示区域 顶点(左上角) stChnAttr.stRect.s32Y = 0; stChnAttr.stRect.u32Width = 720; //通道显示区域大小 stChnAttr.stRect.u32Height = 576; s32Ret = HI_MPI_VO_SetChnAttr(VoLayer, VoChn, &stChnAttr); //配置指定视频输出通道的属性 if (s32Ret != HI_SUCCESS) { printf("Set channel attr failed with errno %#x!\n", s32Ret); return HI_FAILURE; } s32Ret = HI_MPI_VO_EnableChn(VoLayer, VoChn); //开启指定的VO通道 if (s32Ret != HI_SUCCESS) { printf("Enable channel failed with errno %#x!\n", s32Ret); return HI_FAILURE; } s32Ret = HI_MPI_VO_DisableChn(VoLayer, VoChn); //关闭通道 if (s32Ret != HI_SUCCESS) { printf("Disable channel failed with errno %#x!\n", s32Ret); return HI_FAILURE; } }
标签:lan ola 属性 ann 优先 描述符 _for 输出参数 amp
原文地址:https://www.cnblogs.com/qifeng1024/p/13475260.html