这个SDK里面有一个三路编码h264的流,另外一个是JPEG抓拍的。
虽然文档里面建议通道0进行抓拍,SDK用的通道1. 将其入到三路码流之后。通道3。
开始一直错误,VpssChn = 3;没有设定,设定如下:
//抓拍的通道 获取图像'小 s32Ret = SAMPLE_COMM_SYS_GetPicSize(gs_enNorm, enSize[0], &stSize); if (HI_SUCCESS != s32Ret) { SAMPLE_PRT("SAMPLE_COMM_SYS_GetPicSize failed!\n"); goto END_VENC_1080P_CLASSIC_4; } VpssChn = 3; stVpssChnMode.enChnMode = VPSS_CHN_MODE_USER; stVpssChnMode.bDouble = HI_FALSE; stVpssChnMode.enPixelFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420; stVpssChnMode.u32Width = stSize.u32Width; stVpssChnMode.u32Height = stSize.u32Height; stVpssChnMode.enCompressMode = COMPRESS_MODE_NONE; memset(&stVpssChnAttr, 0, sizeof(stVpssChnAttr)); stVpssChnAttr.s32SrcFrameRate = -1; stVpssChnAttr.s32DstFrameRate = -1; s32Ret = SAMPLE_COMM_VPSS_EnableChn(VpssGrp, VpssChn, &stVpssChnAttr, &stVpssChnMode, HI_NULL); if (HI_SUCCESS != s32Ret) { SAMPLE_PRT("Enable vpss chn failed!\n"); goto END_VENC_1080P_CLASSIC_4; }
之后就是绑定和获取图片
//hg 添加拍照功能 2018-12-24 VpssGrp = 0; VpssChn = 3; VencChn = 3; s32Ret = SAMPLE_COMM_VENC_SnapStart(VpssChn,&stSize,HI_FALSE); if(HI_SUCCESS !=s32Ret) { SAMPLE_PRT("Start snap failed!\n"); goto END_VENC_JPEG_6; } s32Ret = SAMPLE_COMM_VENC_BindVpss(VencChn, VpssGrp, VpssChn); if (HI_SUCCESS != s32Ret) { SAMPLE_PRT("Start Venc failed!\n"); goto END_VENC_JPEG_6; }
三个图可以直观的观察vpss: