static void video_DisplayD1(int nVoDev, int nChn, unsigned char bDisplay) { static int s_nDispViDev = -1; static int s_nDispViChn = -1; VI_CHN_ATTR_S stViChnAttr; if(bDisplay){ int i = 0; for(i = 0; i < MAX_CAM_CH; ++i){ DVR_ASSERT(HI_MPI_VO_ChnHide(nVoDev, i)); } } if(bDisplay){ static int s_nLastFull = -1; // prevent to bind twice if(-1 == s_nLastFull || nChn != s_nLastFull){ int fd = open(VIDEO_DEV, O_RDWR); VIDEO_TRACE("%s fd = %d", __func__, fd); if(fd > 0){ // set ad configuration video_preview_t stPreview = {0}; stPreview.chn = nChn; // switch to this channel @ ad ioctl(fd, VIDEO_DRV_SET_LIVE_CHN, &stPreview); close(fd); fd = -1; } } // unbind last full channel first if(!(-1 == s_nDispViDev && -1 == s_nDispViChn)){ DVR_ASSERT(HI_MPI_VI_UnBindOutput(s_nDispViDev, s_nDispViChn, nVoDev, MAX_CAM_CH)); } // bind to d1 special live connect s_nDispViDev = 2; s_nDispViChn = 0; DVR_ASSERT(HI_MPI_VO_ClearChnBuffer(nVoDev, MAX_CAM_CH, HI_TRUE)); if(s_stVideo.nLossStat & (1<<nChn)){ DVR_ASSERT(HI_MPI_VO_SENDFRAME(nVoDev, MAX_CAM_CH, VIDEO_GetUserPic(nChn))); }else{ DVR_ASSERT(HI_MPI_VI_GetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); VI_D1_ATTR_CONF(&stViChnAttr); DVR_ASSERT(HI_MPI_VI_SetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); DVR_ASSERT(HI_MPI_VI_BindOutput(s_nDispViDev, s_nDispViChn, nVoDev, MAX_CAM_CH)); } usleep(40000); DVR_ASSERT(HI_MPI_VO_ChnShow(nVoDev, MAX_CAM_CH)); video_CheckDigitalZoomD1(nChn); }else{ if(!(-1 == s_nDispViDev && -1 == s_nDispViChn)){ DVR_ASSERT(HI_MPI_VO_ChnHide(nVoDev, MAX_CAM_CH)); // printf("unbind output (%d,%d) to (%d,%d)", s_nDispViDev, s_nDispViChn, nVoDev, MAX_CAM_CH); DVR_ASSERT(HI_MPI_VI_UnBindOutput(s_nDispViDev, s_nDispViChn, nVoDev, MAX_CAM_CH)); DVR_ASSERT(HI_MPI_VI_GetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); VI_CIF_ATTR_CONF(&stViChnAttr); DVR_ASSERT(HI_MPI_VI_SetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); s_nDispViDev = -1; s_nDispViChn = -1; } } }
static void video_DisplayD1(int nVoDev, int nChn, unsigned char bDisplay) { int i = 0, ii = 0; static int s_nDispViDev = -1; static int s_nDispViChn = -1; VI_CHN_ATTR_S stViChnAttr; if(bDisplay){ for(i = 0; i < VIDEO_GetMaxDiv(); ++i){ DVR_ASSERT(HI_MPI_VO_ChnHide(nVoDev, i)); } } if(bDisplay){ // unbind last full channel first if(!(-1 == s_nDispViDev && -1 == s_nDispViChn)){ DVR_ASSERT(HI_MPI_VI_UnBindOutput(s_nDispViDev, s_nDispViChn, nVoDev, SPECIAL_D1_CH)); } DVR_ASSERT(HI_MPI_VO_ClearChnBuffer(nVoDev, SPECIAL_D1_CH, HI_TRUE)); if(nChn < 16){ int fd = open(VIDEO_DEV, O_RDWR); if(fd > 0){ // set ad configuration video_preview_t stPreview = {0}; stPreview.chn = nChn; // switch to this channel @ ad ioctl(fd, VIDEO_DRV_SET_LIVE_CHN, &stPreview); close(fd); fd = -1; } // redefine device s_nDispViDev = 1; s_nDispViChn = 0; }else if(nChn < 24){ // reset field to both not downscale if(0 == VIMAP_Get(nChn, &s_nDispViDev, &s_nDispViChn)){ } }else{ ; } if(s_stVideo.nLossStat & (1<<nChn)){ // VIDEO_TRACE("Send User Pic"); DVR_ASSERT(HI_MPI_VO_SENDFRAME(nVoDev, SPECIAL_D1_CH, VIDEO_GetUserPic(nChn))); }else{ DVR_ASSERT(HI_MPI_VI_GetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); VI_D1_ATTR_CONF(&stViChnAttr); DVR_ASSERT(HI_MPI_VI_SetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); DVR_ASSERT(HI_MPI_VI_BindOutput(s_nDispViDev, s_nDispViChn, nVoDev, SPECIAL_D1_CH)); usleep(40000); } DVR_ASSERT(HI_MPI_VO_ChnShow(nVoDev, SPECIAL_D1_CH)); }else{ if(!(-1 == s_nDispViDev && -1 == s_nDispViChn)){ DVR_ASSERT(HI_MPI_VI_GetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); VI_CIF_ATTR_CONF(&stViChnAttr); DVR_ASSERT(HI_MPI_VI_SetChnAttr(s_nDispViDev, s_nDispViChn, &stViChnAttr)); DVR_ASSERT(HI_MPI_VI_UnBindOutput(s_nDispViDev, s_nDispViChn, nVoDev, SPECIAL_D1_CH)); DVR_ASSERT(HI_MPI_VO_ChnHide(nVoDev, SPECIAL_D1_CH)); if(nVoDev > 0){ s_nDispViDev = -1; s_nDispViChn = -1; } } } }