Exemplo n.º 1
0
HI_S32 PCIV_Slave_StartVo(PCIV_MSGHEAD_S *pMsg)
{
    HI_S32 s32Ret, s32CurPos;
    VO_CHN voChn = -1;
    PCIV_VOCMD_CREATE_S *pCmd     = (PCIV_VOCMD_CREATE_S *)pMsg->cMsgBody;
    PCIV_VOCMD_ECHO_S   *pCmdEcho = (PCIV_VOCMD_ECHO_S   *)pMsg->cMsgBody;

    s32CurPos = 0;
    while(s32CurPos < pMsg->u32MsgLen)
    {
        voChn  = pCmd->voChn;
        s32Ret = HI_MPI_VO_SetChnAttr(voChn, &pCmd->stAttr);
        HI_ASSERT(HI_SUCCESS == s32Ret);

        s32Ret = HI_MPI_VO_EnableChn(voChn);
        HI_ASSERT(HI_SUCCESS == s32Ret);

        pCmd++;
        s32CurPos += sizeof(*pCmd);
    }

    pMsg->enMsgType   = PCIV_MSGTYPE_CMDECHO;
    pMsg->enDevType   = PCIV_DEVTYPE_VOCHN;
    pMsg->u32Target   = 0;
    pMsg->u32MsgLen   = sizeof(PCIV_VOCMD_ECHO_S);
    pCmdEcho->s32Echo = HI_SUCCESS;
    pCmdEcho->voChn   = voChn;

    s32Ret = PCIV_SendMsg(0, PCIV_MSGPORT_USERCMD, pMsg);
    HI_ASSERT(HI_FAILURE != s32Ret);

    return HI_SUCCESS;
}
Exemplo n.º 2
0
HI_S32 SampleInitVoMScreen(HI_U32 ScreenCnt)
{
    HI_U32 i;
    VO_PUB_ATTR_S  VoPubAttr;

    VoPubAttr.stTvConfig.stComposeMode = g_u32TvMode;
    VoPubAttr.u32BgColor = 0xff;

    if (HI_SUCCESS != HI_MPI_VO_SetPubAttr(&VoPubAttr))
    {
        return HI_FAILURE;
    }

    if (HI_SUCCESS != SampleSetVochnMscreen(ScreenCnt))
    {
        return HI_FAILURE;
    }

    if (HI_SUCCESS != HI_MPI_VO_Enable())
    {
        return HI_FAILURE;
    }

    for (i = 0; i < ScreenCnt; i++)
    {
        CHECK(HI_MPI_VO_EnableChn(i), "HI_MPI_VO_EnableChn");
    }

    return HI_SUCCESS;
}
Exemplo n.º 3
0
HI_S32 SampleEnableVo(VO_CHN VoChn, VO_PUB_ATTR_S *pVoPubAttr,
											VO_CHN_ATTR_S *pVoChnAttr)
{
	HI_S32 s32Ret;

	s32Ret = HI_MPI_VO_SetPubAttr(pVoPubAttr);
	if (HI_SUCCESS != s32Ret)
	{
		printf("set VO attribute failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_VO_SetChnAttr(VoChn, pVoChnAttr);
	if (HI_SUCCESS != s32Ret)
	{
		printf("set VO Chn attribute failed !\n");
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_VO_Enable();
	if (HI_SUCCESS != s32Ret)
	{
		printf("set VO  enable failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_VO_EnableChn(VoChn);
	if (HI_SUCCESS != s32Ret)
	{
		printf("set VO Chn enable failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	return HI_SUCCESS;
}
Exemplo n.º 4
0
HI_S32 SampleVoInitChn(VO_CHN VoChn, VO_CHN_ATTR_S *pstVoChnAttr)
{
    if (HI_SUCCESS!=HI_MPI_VO_SetChnAttr(VoChn, pstVoChnAttr))
    {
        Printf("set VO 0 Chn attribute failed !\n");
        return HI_FAILURE;
    }

    if(HI_SUCCESS!=HI_MPI_VO_EnableChn(VoChn))
    {
        Printf("enable vo channel failed !\n");
        return HI_FAILURE;
    }

    return HI_SUCCESS;
}
Exemplo n.º 5
0
HI_S32 SampleEnableVo4Cif(HI_VOID)
{
	HI_U32 i;

	VO_PUB_ATTR_S  VoPubAttr;

	VoPubAttr.stTvConfig.stComposeMode = VIDEO_ENCODING_MODE_PAL;
	VoPubAttr.u32BgColor = 0xff;

	if (0!=HI_MPI_VO_SetPubAttr(&VoPubAttr))
	{
		printf("HI_MPI_VO_SetPubAttr faild!\n");
		return HI_FAILURE;
	}

	if(HI_SUCCESS!=SampleSetVochnMscreen(4))
	{
		printf("SampleSetVochnMscreen faild!\n");
		return HI_FAILURE;
    }

	if(HI_SUCCESS!=HI_MPI_VO_Enable())
	{
		printf("HI_MPI_VO_Enable faild!\n");
		return HI_FAILURE;
    }

	for(i=0;i<4;i++)
	{
		if(HI_SUCCESS!=HI_MPI_VO_EnableChn(i))
		{
			printf("HI_MPI_VO_EnableChn faild!\n");
	        return HI_FAILURE;
        }
	}

	return HI_SUCCESS;
}
Exemplo n.º 6
0
HI_S32 SAMPLE_COMM_VO_StartChn(VO_DEV VoDev,VO_PUB_ATTR_S *pstPubAttr,SAMPLE_VO_MODE_E enMode)
{
    HI_S32 i;
    HI_S32 s32Ret = HI_SUCCESS;
    HI_U32 u32WndNum = 0;
    HI_U32 u32Square = 0;
    HI_U32 u32Width = 0;
    HI_U32 u32Height = 0;
    HI_U32 u32Frm = 0;
    VO_CHN_ATTR_S stChnAttr;
    
    switch (enMode)
    {
        case VO_MODE_1MUX:
            u32WndNum = 1;
            u32Square = 1;
            break;
        case VO_MODE_4MUX:
            u32WndNum = 4;
            u32Square = 2;
            break;
        case VO_MODE_9MUX:
            u32WndNum = 9;
            u32Square = 3;
            break;
        case VO_MODE_16MUX:
            u32WndNum = 16;
            u32Square = 4;
            break;
        default:
            SAMPLE_PRT("failed with %#x!\n", s32Ret);
            return HI_FAILURE;
    }

	///根据输出属性获取当前输出的分辨率的参数
    s32Ret = SAMPLE_COMM_VO_GetWH(pstPubAttr->enIntfSync, &u32Width,&u32Height,&u32Frm);
    if (s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("failed with %#x!\n", s32Ret);
        return HI_FAILURE;
    }
    printf("u32Width:%d, u32Square:%d\n", u32Width, u32Square);
    for (i=0; i<u32WndNum; i++)
    {
    	///设置输出的区域大小及坐标
        stChnAttr.stRect.s32X       = ALIGN_BACK((u32Width/u32Square) * (i%u32Square), 2);
        stChnAttr.stRect.s32Y       = ALIGN_BACK((u32Height/u32Square) * (i/u32Square), 2);
        stChnAttr.stRect.u32Width   = ALIGN_BACK(u32Width/u32Square, 2);
        stChnAttr.stRect.u32Height  = ALIGN_BACK(u32Height/u32Square, 2);
		///优先级
        stChnAttr.u32Priority       = 0;
		///是否开启抗闪烁
        stChnAttr.bDeflicker        = HI_FALSE;

        s32Ret = HI_MPI_VO_SetChnAttr(VoDev, i, &stChnAttr);
        if (s32Ret != HI_SUCCESS)
        {
            printf("%s(%d):failed with %#x!\n",\
                   __FUNCTION__,__LINE__,  s32Ret);
            return HI_FAILURE;
        }

        s32Ret = HI_MPI_VO_EnableChn(VoDev, i );
        if (s32Ret != HI_SUCCESS)
        {
            SAMPLE_PRT("failed with %#x!\n", s32Ret);
            return HI_FAILURE;
        }
    }

    return HI_SUCCESS;
}
Exemplo n.º 7
0
static void video_OutputInit()
{
	int i = 0, ii = 0;
	int const nMaxFps = MAX_D1_CNT ? MAX_D1_LIVE_FPS : MAX_CIF_LIVE_FPS;

	VO_VIDEO_LAYER_ATTR_S stVgaLayerAttr;
	VO_VIDEO_LAYER_ATTR_S stCvbsLayerAttr;

	// vga output
	{
		VGA_RESOLUTION const enRes = g_pstSysEnv->GetVGAResolution(g_pstSysEnv);

		stVgaLayerAttr.stImageSize.u32Width  = VO_ORIGIN_WIDTH;
		stVgaLayerAttr.stImageSize.u32Height = VO_ORIGIN_HEIGHT;
		stVgaLayerAttr.stDispRect.s32X = 0;
		stVgaLayerAttr.stDispRect.s32Y = 0;
		switch(enRes) {
		case VGA_800x600:
			stVgaLayerAttr.stDispRect.u32Width  = 800;
			stVgaLayerAttr.stDispRect.u32Height = 600;
			break;
		default:
		case VGA_1024x768:
			stVgaLayerAttr.stDispRect.u32Width  = 1024;
			stVgaLayerAttr.stDispRect.u32Height = 768;
			break;
		case VGA_1280x1024:
			stVgaLayerAttr.stDispRect.u32Width  = 1280;
			stVgaLayerAttr.stDispRect.u32Height = 1024;
			break;
		case VGA_1366x768:
			stVgaLayerAttr.stDispRect.u32Width  = 1366;
			stVgaLayerAttr.stDispRect.u32Height = 768;
			break;
		case VGA_1440x900:
			stVgaLayerAttr.stDispRect.u32Width  = 1440;
			stVgaLayerAttr.stDispRect.u32Height = 900;
			break;
		}

		stVgaLayerAttr.u32DispFrmRt = nMaxFps;
		stVgaLayerAttr.enPixFormat  = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
		stVgaLayerAttr.s32PiPChn    = VO_DEFAULT_CHN;
	}
	// cvbs
	{
		stCvbsLayerAttr.stImageSize.u32Width  = VO_ORIGIN_WIDTH;
		stCvbsLayerAttr.stImageSize.u32Height = VO_ORIGIN_HEIGHT;
		stCvbsLayerAttr.stDispRect.s32X       = 0;
		stCvbsLayerAttr.stDispRect.s32Y       = 0;
		stCvbsLayerAttr.stDispRect.u32Width   = VO_ORIGIN_WIDTH;
		stCvbsLayerAttr.stDispRect.u32Height  = VO_ORIGIN_HEIGHT;
		stCvbsLayerAttr.u32DispFrmRt          = nMaxFps;
		stCvbsLayerAttr.enPixFormat           = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
		stCvbsLayerAttr.s32PiPChn             = VO_DEFAULT_CHN;
	}
	{
		// configuration active
		const VO_VIDEO_LAYER_ATTR_S astVideoLayerAttr[] = {stVgaLayerAttr, stCvbsLayerAttr};

        video_ScreenInit();

		for(i = 0; i < sizeof(VO_DEV_ID) / sizeof(VO_DEV_ID[0]); ++i){
			//DVR_ASSERT(HI_MPI_VO_SetDispBufLen(nDev, MAX_CAM_CH));
			DVR_ASSERT(HI_MPI_VO_SetVideoLayerAttr(VO_DEV_ID[i], &astVideoLayerAttr[i]));
			DVR_ASSERT(HI_MPI_VO_EnableVideoLayer(VO_DEV_ID[i]));
			// setup division
			video_Division(VO_DEV_ID[i], s_stVideo.nScrWidth[i], s_stVideo.nScrHeight[i], -1, 0, FALSE);
			// enable vo channel
			for(ii = 0; ii < VIDEO_GetMaxDiv(); ++ii){
				DVR_ASSERT(HI_MPI_VO_SetChnField(VO_DEV_ID[i], ii, VO_FIELD_BOTTOM));
				DVR_ASSERT(HI_MPI_VO_EnableChn(VO_DEV_ID[i], ii));
				if(ii < MAX_CAM_CH){
					video_BindOutput(VO_DEV_ID[i], ii, TRUE);
				}else{
					DVR_ASSERT(HI_MPI_VO_SENDFRAME(VO_DEV_ID[i], ii, s_pstLogoPic));
				}
			}
		}
	}
	s_stVideo.bOutput = TRUE;
}
Exemplo n.º 8
0
static void video_OutputInit()
{
	int i = 0, ii = 0;
	int const nMaxFps = MAX_D1_CNT ? MAX_D1_LIVE_FPS : MAX_CIF_LIVE_FPS;

	VO_VIDEO_LAYER_ATTR_S stVgaLayerAttr;
	VO_VIDEO_LAYER_ATTR_S stCvbsLayerAttr;

	// vga output
	{
		VGA_RESOLUTION const enRes = g_pstSysEnv->GetVGAResolution(g_pstSysEnv);

		stVgaLayerAttr.stImageSize.u32Width  = VO_ORIGIN_WIDTH;
		stVgaLayerAttr.stImageSize.u32Height = VO_ORIGIN_HEIGHT;
		stVgaLayerAttr.stDispRect.s32X = 0;
		stVgaLayerAttr.stDispRect.s32Y = 0;
		switch(enRes) {
		case VGA_800x600:
			stVgaLayerAttr.stDispRect.u32Width  = 800;
			stVgaLayerAttr.stDispRect.u32Height = 600;
			break;
		default:
		case VGA_1024x768:
			stVgaLayerAttr.stDispRect.u32Width  = 1024;
			stVgaLayerAttr.stDispRect.u32Height = 768;
			break;
		case VGA_1280x1024:
			stVgaLayerAttr.stDispRect.u32Width  = 1280;
			stVgaLayerAttr.stDispRect.u32Height = 1024;
			break;
		case VGA_1366x768:
			stVgaLayerAttr.stDispRect.u32Width  = 1366;
			stVgaLayerAttr.stDispRect.u32Height = 768;
			break;
		case VGA_1440x900:
			stVgaLayerAttr.stDispRect.u32Width  = 1440;
			stVgaLayerAttr.stDispRect.u32Height = 900;
			break;
		}

		stVgaLayerAttr.u32DispFrmRt = nMaxFps;
		stVgaLayerAttr.enPixFormat  = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
		stVgaLayerAttr.s32PiPChn    = VO_DEFAULT_CHN;
	}
	// cvbs
	{
		stCvbsLayerAttr.stImageSize.u32Width  = VO_ORIGIN_WIDTH;
		stCvbsLayerAttr.stImageSize.u32Height = VO_ORIGIN_HEIGHT;
		stCvbsLayerAttr.stDispRect.s32X       = 0;
		stCvbsLayerAttr.stDispRect.s32Y       = 0;
		stCvbsLayerAttr.stDispRect.u32Width   = VO_ORIGIN_WIDTH;
		stCvbsLayerAttr.stDispRect.u32Height  = VO_ORIGIN_HEIGHT;
		stCvbsLayerAttr.u32DispFrmRt          = nMaxFps;
		stCvbsLayerAttr.enPixFormat           = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
		stCvbsLayerAttr.s32PiPChn             = VO_DEFAULT_CHN;
	}
	{
		// configuration active
		const VO_VIDEO_LAYER_ATTR_S astVideoLayerAttr[] = {stVgaLayerAttr, stCvbsLayerAttr};

        video_ScreenInit();

		for(i = 0; i < sizeof(VO_DEV_ID) / sizeof(VO_DEV_ID[0]); ++i){
			//DVR_ASSERT(HI_MPI_VO_SetDispBufLen(nDev, MAX_CAM_CH));
			DVR_ASSERT(HI_MPI_VO_SetVideoLayerAttr(VO_DEV_ID[i], &astVideoLayerAttr[i]));
			DVR_ASSERT(HI_MPI_VO_EnableVideoLayer(VO_DEV_ID[i]));
			// setup division
			video_Division(VO_DEV_ID[i], s_stVideo.nScrWidth[i], s_stVideo.nScrHeight[i], VIDEO_GetMaxDiv(), 0, FALSE);

			// 1 - 16 digital zoom
			// 17 - 20 bind directly
			// 21 - 24 bind directly
			VO_DISPLAY_FIELD_E enDisplayField;
			// enable vo channel
			for(ii = 0; ii < VIDEO_GetMaxDiv() + 1; ++ii){
				if(ii < 16){
					// for vi0 1-16
					// digital zoom
					VO_ZOOM_ATTR_S stZoomAttr;
					memset(&stZoomAttr, 0, sizeof(stZoomAttr));
					stZoomAttr.enField = VIDEO_FIELD_FRAME;
					stZoomAttr.stZoomRect.u32Width = VI_CIF_WIDTH;
					stZoomAttr.stZoomRect.u32Height = VI_CIF_HEIGHT;
					stZoomAttr.stZoomRect.s32X = 0;
					stZoomAttr.stZoomRect.s32Y = (ii % 8) * (stZoomAttr.stZoomRect.u32Height + 2);
					VIDEO_TRACE("ch=%d zoom [%d,%d,%d,%d]", ii, stZoomAttr.stZoomRect.s32X, stZoomAttr.stZoomRect.s32Y, stZoomAttr.stZoomRect.u32Width, stZoomAttr.stZoomRect.u32Height);
					DVR_ASSERT(HI_MPI_VO_SetZoomInWindow(VO_DEV_ID[i], ii, &stZoomAttr));
					enDisplayField = (ii >= 8) ? VO_FIELD_TOP : VO_FIELD_BOTTOM;
				}else if(ii < 20){
					// for vi2 ch1-4
					enDisplayField = VO_FIELD_BOTTOM;
				}else if(ii < 24){
					// for vi3 ch1-4
					enDisplayField = VO_FIELD_BOTTOM;
				}else if(24 == ii){
					enDisplayField = VO_FIELD_BOTH;
				}else if(25 == ii){
					// for ch1-16 d1 live
					enDisplayField = VO_FIELD_BOTH;
				}
				DVR_ASSERT(HI_MPI_VO_SetChnField(VO_DEV_ID[i], ii, enDisplayField));
				DVR_ASSERT(HI_MPI_VO_EnableChn(VO_DEV_ID[i], ii));
				if(ii < MAX_CAM_CH){
					video_BindOutput(VO_DEV_ID[i], ii, TRUE);
				}else if(ii < SPECIAL_D1_CH){
					DVR_ASSERT(HI_MPI_VO_SENDFRAME(VO_DEV_ID[i], ii, s_pstLogoPic));
				}
			}
		}
	}
	s_stVideo.bOutput = TRUE;
}
Exemplo n.º 9
0
HI_S32 SAMPLE_COMM_VO_StartChn(VO_LAYER VoLayer, SAMPLE_VO_MODE_E enMode)
{
    HI_S32 i;
    HI_S32 s32Ret = HI_SUCCESS;
    HI_U32 u32WndNum = 0;
    HI_U32 u32Square = 0;
    HI_U32 u32Width = 0;
    HI_U32 u32Height = 0;
    VO_CHN_ATTR_S stChnAttr;
    VO_VIDEO_LAYER_ATTR_S stLayerAttr;
    
    switch (enMode)
    {
        case VO_MODE_1MUX:
            u32WndNum = 1;
            u32Square = 1;
            break;
        case VO_MODE_2MUX:
            u32WndNum = 2;
            u32Square = 2;
            break;
        default:
            SAMPLE_PRT("failed with %#x!\n", s32Ret);
            return HI_FAILURE;
    }

    s32Ret = HI_MPI_VO_GetVideoLayerAttr(VoLayer, &stLayerAttr);
    if (s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("failed with %#x!\n", s32Ret);
        return HI_FAILURE;
    }
    u32Width = stLayerAttr.stImageSize.u32Width;
    u32Height = stLayerAttr.stImageSize.u32Height;
    printf("u32Width:%d, u32Square:%d\n", u32Width, u32Square);
    for (i=0; i<u32WndNum; i++)
    {
        stChnAttr.stRect.s32X       = ALIGN_BACK((u32Width/u32Square) * (i%u32Square), 2);
        stChnAttr.stRect.s32Y       = ALIGN_BACK((u32Height/u32Square) * (i/u32Square), 2);
        stChnAttr.stRect.u32Width   = ALIGN_BACK(u32Width/u32Square, 2);
        stChnAttr.stRect.u32Height  = ALIGN_BACK(u32Height/u32Square, 2);
        stChnAttr.u32Priority       = 0;
        stChnAttr.bDeflicker        = HI_FALSE;

        s32Ret = HI_MPI_VO_SetChnAttr(VoLayer, i, &stChnAttr);
        if (s32Ret != HI_SUCCESS)
        {
            printf("%s(%d):failed with %#x!\n",\
                   __FUNCTION__,__LINE__,  s32Ret);
            return HI_FAILURE;
        }

        s32Ret = HI_MPI_VO_EnableChn(VoLayer, i);
        if (s32Ret != HI_SUCCESS)
        {
            SAMPLE_PRT("failed with %#x!\n", s32Ret);
            return HI_FAILURE;
        }
    }
    return HI_SUCCESS;
}