コード例 #1
0
ファイル: video_ja7216nc.c プロジェクト: dulton/FNF_Project1
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;
		}
	}
}
コード例 #2
0
ファイル: video_ja2016nc.c プロジェクト: dulton/FNF_Project1
static void video_Division(int nVoDev, int nScrWidth, int nScrHeight, int nDiv, int nPage, unsigned char bD1)
{
	int i = 0;
	int nGrid = 1;
	VO_CHN_ATTR_S stVoChnAttr;

	int nLocate = 0;
	int nChWidth = 0;
	int nChHeight = 0;
	int nOffsetX = (VO_ORIGIN_WIDTH - nScrWidth) / 2;
	int nOffsetY = (VO_ORIGIN_HEIGHT - nScrHeight) / 2;
	int nBlankW = 0;
	int nBlankH = 0;

	if(-1 == nDiv){
		nDiv = VIDEO_GetMaxDiv();
	}
	switch(nDiv)
	{
	case 1: nGrid = 1; break;
	case 4: nGrid = 2; break;
	case 9: nGrid = 3; break;
	case 16: nGrid = 4; break;
	case 25: nGrid = 5; break;
	default:
		return;
	}
	
	if(nVoDev == VO_CVBS_DEVICE) {
		nOffsetX = s_stVideo.ScrnEdges[1].nEdgeX;
		nOffsetY = s_stVideo.ScrnEdges[1].nEdgeY;

		nScrWidth  = s_stVideo.ScrnEdges[1].nEdgeW;
		nScrHeight = s_stVideo.ScrnEdges[1].nEdgeH;
	}
	
	nChWidth = nScrWidth / nGrid;
	nChHeight = nScrHeight / nGrid;
	nChWidth &= ~(2-1); // 2 alignment
	nChHeight &= ~(2-1); // 2 alignment
	nBlankW = nScrWidth % nChWidth;
	nBlankH = nScrHeight % nChHeight;
	for(i = 0, nLocate = 0; i < VIDEO_GetMaxDiv(); ++i){
		stVoChnAttr.stRect.s32X = nOffsetX + (((nLocate % nDiv) % nGrid) * nChWidth) & ~(2-1); // 2 alignment
		stVoChnAttr.stRect.s32Y = nOffsetY + (((nLocate % nDiv) / nGrid) * nChHeight) & ~(2-1); // 2 alignment	
		//VIDEO_TRACE("vo(%d,%d) (x,y)=%d,%d, [w,h]=%d,%d", nVoDev, i, stVoChnAttr.stRect.s32X, stVoChnAttr.stRect.s32Y, stVoChnAttr.stRect.u32Width, stVoChnAttr.stRect.u32Height);
		if((nGrid - 1) == (nLocate % nGrid)){
			// the right side
			stVoChnAttr.stRect.u32Width = nChWidth + nBlankW;
		}else{
			// for osd bar
			stVoChnAttr.stRect.u32Width = nChWidth - 2;
		}
		if((nGrid - 1) == (nLocate / nGrid)){
			stVoChnAttr.stRect.u32Height = nChHeight + nBlankH;
		}else{
			// for osd bar
			stVoChnAttr.stRect.u32Height = nChHeight - 2;
		}
		stVoChnAttr.u32Priority = 1;
		stVoChnAttr.bZoomEnable = HI_TRUE;
		stVoChnAttr.bDeflicker = (0 == nVoDev) ? HI_FALSE : HI_TRUE;
		DVR_ASSERT(HI_MPI_VO_SetChnAttr(nVoDev, i, &stVoChnAttr));
		if(VO_CHN_IS_ONTOP(nDiv, nPage, i)){
			++nLocate;
			DVR_ASSERT(HI_MPI_VO_ChnShow(nVoDev, i));
		}else{
			DVR_ASSERT(HI_MPI_VO_ChnHide(nVoDev, i));
		}
	}
}
コード例 #3
0
ファイル: video_ja7216nc.c プロジェクト: dulton/FNF_Project1
static void video_Division(int nVoDev, int nScrWidth, int nScrHeight, int nDiv, int nPage, unsigned char bLive)
{
	int i = 0;
	int nGrid = 1;
	VO_CHN_ATTR_S stVoChnAttr;
	int nLocate = 0;
	int nChWidth = 0;
	int nChHeight = 0;
	int nOffsetX = (VO_ORIGIN_WIDTH - nScrWidth) / 2;
	int nOffsetY = (VO_ORIGIN_HEIGHT - nScrHeight) / 2;
	int nBlankW = 0;
	int nBlankH = 0;
	int nBeginCh = nDiv * nPage;
	int nEndCh = MAX_CAM_CH >= (nBeginCh + nDiv) ? MAX_CAM_CH : (nBeginCh + nDiv);

//	if(!bD1 && 1 == nDiv){
//		// full screen is ready all the time at this solution
//		return;
//	}

	switch(nDiv)
	{
	case 1: nGrid = 1; break;
	case 4: nGrid = 2; break;
	case 9: nGrid = 3; break;
	case 16: nGrid = 4; break;
	case 25: nGrid = 5; break;
	default:
		return;
	}

	if(nVoDev == VO_CVBS_DEVICE) {
		nOffsetX = s_stVideo.ScrnEdges[1].nEdgeX;
		nOffsetY = s_stVideo.ScrnEdges[1].nEdgeY;

		nScrWidth  = s_stVideo.ScrnEdges[1].nEdgeW;
		nScrHeight = s_stVideo.ScrnEdges[1].nEdgeH;
	}

	// full d1 for live only
	stVoChnAttr.stRect.s32X = nOffsetX;
	stVoChnAttr.stRect.s32Y = nOffsetY;
	stVoChnAttr.stRect.u32Width = nScrWidth;
	stVoChnAttr.stRect.u32Height = nScrHeight;
	stVoChnAttr.u32Priority = 1;
	stVoChnAttr.bZoomEnable = HI_TRUE;
	stVoChnAttr.bDeflicker = HI_FALSE;
	DVR_ASSERT(HI_MPI_VO_SetChnAttr(nVoDev, MAX_CAM_CH, &stVoChnAttr));
	if(1 == nDiv && bLive){
		DVR_ASSERT(HI_MPI_VO_ChnShow(nVoDev, MAX_CAM_CH));
	}else{
		DVR_ASSERT(HI_MPI_VO_ChnHide(nVoDev, MAX_CAM_CH));
	}

	nChWidth = nScrWidth / nGrid;
	nChHeight = nScrHeight / nGrid;
	nChWidth &= ~(2-1); // 2 alignment
	nChHeight &= ~(2-1); // 2 alignment
	nBlankW = nScrWidth % nChWidth;
	nBlankH = nScrHeight % nChHeight;

	for(i = 0, nLocate = 0; i < nEndCh; ++i){
		int const nChn = i % MAX_CAM_CH;
		unsigned char bShow = FALSE;

		if(i >= nBeginCh && i < (nBeginCh + nDiv) && (nDiv > 1 || !bLive)){
			// need to show
			bShow = TRUE;
			// live not full division mode
			// playback all the mode
			stVoChnAttr.stRect.s32X = (nOffsetX + (((nLocate % nDiv) % nGrid) * nChWidth)) & ~(2-1); // 2 alignment
			stVoChnAttr.stRect.s32Y = (nOffsetY + (((nLocate % nDiv) / nGrid) * nChHeight)) & ~(2-1); // 2 alignment
			if((nGrid - 1) == (nLocate % nGrid)){
				// the right side
				stVoChnAttr.stRect.u32Width = nChWidth + nBlankW;
			}else{
				// for osd bar
				stVoChnAttr.stRect.u32Width = nChWidth - 2;
			}
			if((nGrid - 1) == (nLocate / nGrid)){
				// the bottom
				stVoChnAttr.stRect.u32Height = nChHeight + nBlankH;
			}else{
				// for osd bar
				stVoChnAttr.stRect.u32Height = nChHeight - 2;
			}
			stVoChnAttr.u32Priority = 0;
			stVoChnAttr.bZoomEnable = HI_TRUE;
			stVoChnAttr.bDeflicker = (0 == nVoDev) ? HI_FALSE : HI_TRUE;
			++nLocate;
		}else{
			bShow = FALSE;
			stVoChnAttr.stRect.s32X = 0;
			stVoChnAttr.stRect.s32Y = 0;
			stVoChnAttr.stRect.u32Width = VI_CIF_WIDTH;
			stVoChnAttr.stRect.u32Height = VI_CIF_HEIGHT;
			stVoChnAttr.u32Priority = 0;
			stVoChnAttr.bZoomEnable = HI_FALSE;
			stVoChnAttr.bDeflicker = HI_FALSE;
		}
//		VIDEO_TRACE("vo(%d,%d) (x,y)=%d,%d, [w,h]=%d,%d", nVoDev, i, stVoChnAttr.stRect.s32X, stVoChnAttr.stRect.s32Y, stVoChnAttr.stRect.u32Width, stVoChnAttr.stRect.u32Height);
		DVR_ASSERT(HI_MPI_VO_SetChnAttr(nVoDev, nChn, &stVoChnAttr));
		if(bShow){
			DVR_ASSERT(HI_MPI_VO_ChnShow(nVoDev, nChn));
		}else{
			DVR_ASSERT(HI_MPI_VO_ChnHide(nVoDev, nChn));
		}
	}
}
コード例 #4
0
ファイル: video_ja2024nc.c プロジェクト: Hi-Spy/hidvr-git
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;
			}
		}
	}
}