OSD创建OVERLAYEX_RGN 绑定到vi设备通道

{
HI_S32 s32Ret = HI_FAILURE;
    
    RGN_HANDLE coverHandle;
    RGN_ATTR_S stCoverAttr;
    MPP_CHN_S stCoverChn;
    RGN_CHN_ATTR_S stCoverChnAttr;
    
    /*******************************************************
     step 2: create an cover region and attach it to vi chn0
    ********************************************************/ 
    coverHandle = 0;
    stCoverAttr.enType = OVERLAYEX_RGN;
    stCoverAttr.unAttr.stOverlayEx.enPixelFmt = PIXEL_FORMAT_RGB_1555;
    stCoverAttr.unAttr.stOverlayEx.stSize.u32Width  = 128;
    stCoverAttr.unAttr.stOverlayEx.stSize.u32Height = 128;
    stCoverAttr.unAttr.stOverlayEx.u32BgColor = 0xfc;
    s32Ret = HI_MPI_RGN_Create(coverHandle, &stCoverAttr);
    if(HI_SUCCESS != s32Ret)
    {
        printf("1111failed with %#x!\n", s32Ret);
        return HI_FALSE;
    }


BITMAP_S stBitmap;
stBitmap.pData = new HI_U8[64*64*2];
stBitmap.u32Width = 64;
    stBitmap.u32Height = 64;
    stBitmap.enPixelFormat = PIXEL_FORMAT_RGB_1555;
memset(stBitmap.pData, 0xff, 64*32);
    s32Ret = HI_MPI_RGN_SetBitMap(coverHandle, &stBitmap);
    if (s32Ret != HI_SUCCESS)
    {
        printf("region set bitmap to  pciv chn %d fail. value=0x%x.", coverHandle, s32Ret);
        return HI_FALSE;
    }


    stCoverChn.enModId = HI_ID_VIU;
    stCoverChn.s32ChnId = 12;
    stCoverChn.s32DevId = 0;


    stCoverChnAttr.bShow = HI_TRUE;
    stCoverChnAttr.enType = OVERLAYEX_RGN;
    stCoverChnAttr.unChnAttr.stOverlayExChn.stPoint.s32X = 128;
    stCoverChnAttr.unChnAttr.stOverlayExChn.stPoint.s32Y = 128;
    stCoverChnAttr.unChnAttr.stOverlayExChn.u32BgAlpha   = 255;
    stCoverChnAttr.unChnAttr.stOverlayExChn.u32FgAlpha   = 255;
    stCoverChnAttr.unChnAttr.stOverlayExChn.u32Layer     = 0;      
    s32Ret = HI_MPI_RGN_AttachToChn(coverHandle, &stCoverChn, &stCoverChnAttr);
    if(HI_SUCCESS != s32Ret)
    {
        printf("222failed with %#x!\n", s32Ret);
        return HI_FALSE;
    }
    
    return HI_TRUE;
}

你可能感兴趣的:(嵌入式开发)