houyongnan
易百纳技术社区
易百纳技术社区
0 访问量
0 原创专栏
0 资料
1 粉丝
个性签名:此E友还没有留下个性签名哦~
加入易百纳时间:2017-08-14

个人成就

易百纳技术社区 共获得 0 个点赞
易百纳技术社区 共获得 6 个收藏
易百纳技术社区 共获得 118 次评论/回复

个人勋章

暂无勋章
分类专栏

Ta擅长的领域

暂无
  • HI_S32 SAMPLE_RGN_CreateOverlayex(RGN_HANDLE Handle, HI_U32  ChnId,HI_U32 u32Num,MOD_ID_E u32ModId) {     HI_S32 i;     HI_S32 s32Ret;     MPP_CHN_S stChn;     RGN_ATTR_S stRgnAttr;     RGN_CHN_ATTR_S stChnAttr;         /* Add cover to vpss group */     stChn.enModId  = u32ModId;     stChn.s32DevId = 0;     stChn.s32ChnId = ChnId;              for (i=Handle; i<(Handle + u32Num); i++)     {         stRgnAttr.enType = OVERLAYEX_RGN;         stRgnAttr.unAttr.stOverlayEx.enPixelFmt       = PIXEL_FORMAT_RGB_1555;         stRgnAttr.unAttr.stOverlayEx.stSize.u32Width  = 128;         stRgnAttr.unAttr.stOverlayEx.stSize.u32Height = 128;         //stRgnAttr.unAttr.stOverlayEx.u32BgColor       = 0x00007c00;         stRgnAttr.unAttr.stOverlayEx.u32BgColor       = 0xff007c00;         printf("RGN_HANDLE_MAX:%d\n",RGN_HANDLE_MAX);         s32Ret = HI_MPI_RGN_Create(i, &stRgnAttr);         if(s32Ret != HI_SUCCESS)         {             SAMPLE_RGN_NOT_PASS(s32Ret);         }             stChnAttr.bShow  = HI_TRUE;         stChnAttr.enType = OVERLAYEX_RGN;         stChnAttr.unChnAttr.stOverlayExChn.stPoint.s32X = 0;         stChnAttr.unChnAttr.stOverlayExChn.stPoint.s32Y = 0;         stChnAttr.unChnAttr.stOverlayExChn.u32BgAlpha   = 128;         stChnAttr.unChnAttr.stOverlayExChn.u32FgAlpha   = 128;         stChnAttr.unChnAttr.stOverlayExChn.u32Layer     = i; #if 0               stChnAttr.unChnAttr.stOverlayExChn.stQpInfo.bAbsQp = HI_FALSE;         stChnAttr.unChnAttr.stOverlayExChn.stQpInfo.s32Qp  = 0;         stChnAttr.unChnAttr.stOverlayExChn.stInvertColor.stInvColArea.u32Height = 16*(i%2+1);         stChnAttr.unChnAttr.stOverlayExChn.stInvertColor.stInvColArea.u32Width  = 16*(i%2+1);         stChnAttr.unChnAttr.stOverlayExChn.stInvertColor.u32LumThresh = 128;         stChnAttr.unChnAttr.stOverlayExChn.stInvertColor.enChgMod     = LESSTHAN_LUM_THRESH;         stChnAttr.unChnAttr.stOverlayExChn.stInvertColor.bInvColEn    = HI_TRUE;         if (i%2)         {             stChnAttr.unChnAttr.stOverlayExChn.stInvertColor.bInvColEn = HI_FALSE;         } #endif         s32Ret = HI_MPI_RGN_AttachToChn(i, &stChn, &stChnAttr);         if(s32Ret != HI_SUCCESS)         {             SAMPLE_RGN_NOT_PASS(s32Ret);         }     }     return HI_SUCCESS;     } HI_S32 MY_RGN_UpdateCanvas(const char *filename, BITMAP_S *pstBitmap, HI_BOOL bFil,     HI_U32 u16FilColor, SIZE_S *pstSize, HI_U32 u32Stride, PIXEL_FORMAT_E enPixelFmt) {     OSD_SURFACE_S Surface;     OSD_BITMAPFILEHEADER bmpFileHeader;     OSD_BITMAPINFO bmpInfo;     if(GetBmpInfo(filename, &bmpFileHeader, &bmpInfo) < 0)     {         printf("GetBmpInfo err!\n");         return HI_FAILURE;     }     if (PIXEL_FORMAT_RGB_1555 == enPixelFmt)     {         Surface.enColorFmt = OSD_COLOR_FMT_RGB1555;     }     else if (PIXEL_FORMAT_RGB_4444 == enPixelFmt)     {         Surface.enColorFmt = OSD_COLOR_FMT_RGB4444;     }     else if (PIXEL_FORMAT_RGB_8888 == enPixelFmt)     {         Surface.enColorFmt = OSD_COLOR_FMT_RGB8888;     }     else     {         printf("Pixel format is not support!\n");                 return HI_FAILURE;     }             if(NULL == pstBitmap->pData)     {         printf("malloc osd memroy err!\n");                 return HI_FAILURE;     } int ret=0;     ret=CreateSurfaceByCanvas(filename, &Surface, (HI_U8*)(pstBitmap->pData), pstSize->u32Width, pstSize->u32Height, u32Stride);     if(ret==-1)printf("CreateSurfaceByCanvas err\n");            pstBitmap->u32Width  = Surface.u16Width;     pstBitmap->u32Height = Surface.u16Height;         if (PIXEL_FORMAT_RGB_1555 == enPixelFmt)     {         pstBitmap->enPixelFormat = PIXEL_FORMAT_RGB_1555;     }     else if (PIXEL_FORMAT_RGB_4444 == enPixelFmt)     {         pstBitmap->enPixelFormat = PIXEL_FORMAT_RGB_4444;     }     else if (PIXEL_FORMAT_RGB_8888 == enPixelFmt)     {         pstBitmap->enPixelFormat = PIXEL_FORMAT_RGB_8888;     }     int i,j;     HI_U16 *pu16Temp;     pu16Temp = (HI_U16*)pstBitmap->pData;         if (bFil)     {         for (i=0; iu32Height; i++)         {             for (j=0; ju32Width; j++)             {                 if (u16FilColor == *pu16Temp)                 {                     *pu16Temp &= 0x7FFF;                 }                 pu16Temp++;             }         }     }              return HI_SUCCESS; } HI_S32 Rgn_AddOsdTo_Vo(HI_VOID) {     HI_S32 s32Ret = HI_SUCCESS;     HI_S32 u32OverlayexRgnNum;     HI_S32 u32CoverexRgnNum;     HI_S32 u32LineRgnNum;     RGN_HANDLE OverlayexHandle;     RGN_ATTR_S stRgnAttrSet;     RGN_CANVAS_INFO_S stCanvasInfo;     BITMAP_S stBitmap;     VO_DEV VoDev;     VO_LAYER VoLayer;     HI_U32 s32VoChnNum;     VO_INTF_SYNC_E enIntfSync;     RGN_ATTR_INFO_S stRgnAttrInfo0;     RGN_ATTR_INFO_S stRgnAttrInfo1;     SIZE_S stSize;     HI_U32 ChnID;     HI_U32 i;      /*************************************************     step 1: create region and attach to vpss group     *************************************************/     OverlayexHandle    = 0;     u32OverlayexRgnNum = 1;     ChnID =2;     printf("OVERLAYEX_MAX_NUM_VO:%d\n",OVERLAYEX_MAX_NUM_VO);     s32Ret = SAMPLE_RGN_CreateOverlayex(OverlayexHandle, ChnID, u32OverlayexRgnNum, HI_ID_VOU);        if(HI_SUCCESS != s32Ret)     {         printf("SAMPLE_RGN_CreateOverlayex failed! s32Ret: 0x%x.\n", s32Ret);         //goto END_OCL_VOU1;     } printf("SAMPLE_RGN_CreateOverlayex 0ver\n"); /*************************************************     step 5: load bitmap to region     *************************************************/ while(1) {     for(i=0; i     {         s32Ret = HI_MPI_RGN_GetAttr(OverlayexHandle+i, &stRgnAttrSet);         if(HI_SUCCESS != s32Ret)         {             printf("HI_MPI_RGN_GetAttr failed! s32Ret: 0x%x.\n", s32Ret);             //goto END_OCL_VOU7;         }         s32Ret = HI_MPI_RGN_GetCanvasInfo(OverlayexHandle+i, &stCanvasInfo);         if(HI_SUCCESS != s32Ret)         {             printf("HI_MPI_RGN_GetCanvasInfo failed! s32Ret: 0x%x.\n", s32Ret);             //goto END_OCL_VOU7;         }                      stBitmap.pData   = (HI_VOID *)stCanvasInfo.u32VirtAddr;         stSize.u32Width  = stCanvasInfo.stSize.u32Width;         stSize.u32Height = stCanvasInfo.stSize.u32Height; s32Ret = MY_RGN_UpdateCanvas("mm2.bmp", &stBitmap, HI_FALSE, 0, &stSize, stCanvasInfo.u32Stride, stRgnAttrSet.unAttr.stOverlay.enPixelFmt);          //s32Ret = SAMPLE_RGN_UpdateCanvas(&stBitmap, HI_FALSE, 0, &stSize, stCanvasInfo.u32Stride,             stRgnAttrSet.unAttr.stOverlay.enPixelFmt);         if(HI_SUCCESS != s32Ret)         {             printf("MY_RGN_UpdateCanvas failed! s32Ret: 0x%x.\n", s32Ret);             //goto END_OCL_VOU7;         }                  s32Ret = HI_MPI_RGN_UpdateCanvas(OverlayexHandle+i);         if(HI_SUCCESS != s32Ret)         {             printf("HI_MPI_RGN_UpdateCanvas failed! s32Ret: 0x%x.\n", s32Ret);            // goto END_OCL_VOU7;         }         else printf("HI_MPI_RGN_UpdateCanvas success \n");     } //sleep(1); }     /*************************************************     step 6: create a thread to change region's     layer, position, alpha and other display attribute     *************************************************/     //RgnAttrInfo0.Handle    = OverlayexHandle;    //tRgnAttrInfo0.u32RgnNum = u32OverlayexRgnNum;    //read_create(&g_stRgnCoverThread, NULL, SAMPLE_RGN_VouOverlayexDynamicDisplay, (HI_VOID*)&stRgnAttrInfo0);     //stRgnAttrInfo1.Handle    = CoverexHandle;     //stRgnAttrInfo1.u32RgnNum = u32CoverexRgnNum;     //pthread_create(&g_stRgnOsdThread, NULL, SAMPLE_RGN_VouCoverexDynamicDisplay, (HI_VOID*)&stRgnAttrInfo1); }
    2018-05-18
    1 0 3364
  • 使用qpf,qpf2,ttf格式的字库显示的都是方框。
    2018-04-10
    1 0 2108
  • rtc时间已经设置好了,但是localtime得到的初始时间总是1970年。正常不是开机时系统时间会从硬件得到时间吗?
    2018-02-06
    1 0 2358
  • 因为只是叠加时间只有几个字符所以不想用,sdl和freetype想问一下如何将点阵字体转成bmp呢?点阵字体如下 /****************************************************************************** * 逻辑字体: 宋体, 常规, 24 * 点阵大小: 13x23 * 字符数量: 13 * 扫描方式: 水平扫描,MSB *******************************************************************************/ static const unsigned char data[]= { //0x0030(0) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x19,0x80,0x30,0xC0, 0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, 0x60,0x60,0x30,0xC0,0x30,0xC0,0x19,0x80,0x0F,0x00,0x00,0x00,0x00,0x00, //0x0031(1) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x3E,0x00,0x06,0x00, 0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00, 0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00, //0x0032(2) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x80,0x40,0xC0, 0x60,0xC0,0x60,0xC0,0x00,0xC0,0x00,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x04,0x00, 0x08,0x00,0x10,0x40,0x20,0x40,0x60,0x40,0x7F,0xC0,0x00,0x00,0x00,0x00, //0x0033(3) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x63,0x00,0x61,0x80, 0x61,0x80,0x01,0x80,0x01,0x80,0x03,0x00,0x0E,0x00,0x01,0x80,0x00,0x80,0x00,0xC0, 0x00,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x1F,0x00,0x00,0x00,0x00,0x00, //0x0034(4) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x80, 0x05,0x80,0x05,0x80,0x09,0x80,0x11,0x80,0x11,0x80,0x21,0x80,0x41,0x80,0x7F,0xF0, 0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x07,0xE0,0x00,0x00,0x00,0x00, //0x0035(5) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x20,0x00,0x20,0x00, 0x20,0x00,0x20,0x00,0x20,0x00,0x2F,0x00,0x31,0x80,0x20,0xC0,0x00,0xC0,0x00,0xC0, 0x60,0xC0,0x60,0xC0,0x41,0x80,0x21,0x80,0x1F,0x00,0x00,0x00,0x00,0x00, //0x0036(6) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0xC0,0x30,0xC0, 0x30,0x00,0x20,0x00,0x60,0x00,0x67,0x80,0x68,0xC0,0x70,0x60,0x60,0x60,0x60,0x60, 0x60,0x60,0x20,0x60,0x30,0x40,0x18,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00, //0x0037(7) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x30,0x60,0x20,0x40, 0x20,0x80,0x00,0x80,0x00,0x80,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x02,0x00, 0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00, //0x0038(8) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60, 0x60,0x60,0x60,0x60,0x30,0x40,0x38,0xC0,0x0F,0x00,0x13,0x80,0x30,0xC0,0x60,0x60, 0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00, //0x0039(9) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0x80,0x30,0xC0, 0x60,0x40,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xE0,0x31,0x60,0x1E,0x60,0x00,0x60, 0x00,0xC0,0x00,0xC0,0x30,0x80,0x31,0x80,0x1E,0x00,0x00,0x00,0x00,0x00, //0x003A(:) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00, //0x002D(-) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x0020( ) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, };
    2018-02-04
    14 0 4118
  • 两个线程得到一个venc通道的视屏帧时录制的视频会出现一会绿屏一会有图像的情况。
    2018-01-21
    7 0 2138
  • HI_VOID *vedio_recorde() {     fd_set read_fds;     int i;     VENC_STREAM_S stStream;     VENC_CHN_STAT_S stStat;     MP4FileHandle hMP4File[2];     MP4TrackId video[2];     HI_CHAR aszFileName[2][64];     //HI_S32 VencFd[2];     HI_S32 s32Ret;     int w=0;     /*for(i=0;i<2;i++)     {         VencFd = HI_MPI_VENC_GetFd(i*2+1);         if (VencFd < 0)         {             SAMPLE_PRT("HI_MPI_VENC_GetFd failed with %#x!\n",VencFd);             return NULL;         }         if (maxfd <= VencFd)         maxfd = VencFd;     }*/     for(i=0;i<2;i++)     {         sprintf(aszFileName, "video/stream_chnxu%d_%d%s", i*2+1,j,".mp4");             hMP4File= MP4CreateEx(aszFileName,  0, 1, 1, 0, 0, 0, 0);             if (hMP4File == MP4_INVALID_FILE_HANDLE)         {                 printf("open mp4 file fialed.\n");                 return NULL;             }         MP4SetTimeScale(hMP4File, 90000);             video= MP4AddH264VideoTrack(hMP4File, 90000, 90000 / 25, 3840, 2160,                                         0x64, //sps[1] AVCProfileIndication                                         0x00, //sps[2] profile_compat                                         0x1f, //sps[3] AVCLevelIndication                                         3); // 4 bytes length before each NAL unit             if (video == MP4_INVALID_TRACK_ID)           {                 printf("add video mp4 track fialed.\n");                 return NULL;             }     }MP4Close(hMP4File, 0);   while(1)   {     FD_ZERO(&read_fds);     struct timeval TimeoutVal;     for (i = 0; i <2; i++)     {         FD_SET(VencFd[i*2+1], &read_fds);                  }     TimeoutVal.tv_sec  = 2;     TimeoutVal.tv_usec = 0;     s32Ret = select(maxfd + 1, &read_fds, NULL, NULL, &TimeoutVal);     //printf("s32Ret:%d",s32Ret);     if (s32Ret < 0)     {         SAMPLE_PRT("select failed!\n");         break;     }     else if (s32Ret == 0)     {         SAMPLE_PRT("get venc stream time out, exit thread\n");         continue;     }     else     {         for (i = 0; i <2; i++)         {                     //printf("venc[%d]:",i);             if (FD_ISSET(VencFd[i*2+1], &read_fds))             {                 /*******************************************************                 step 2.1 : query how many packs in one-frame stream.                 *******************************************************/                 memset(&stStream, 0, sizeof(stStream));                 s32Ret = HI_MPI_VENC_Query(i*2+1, &stStat);                 if (HI_SUCCESS != s32Ret)                 {                     SAMPLE_PRT("HI_MPI_VENC_Query chn[%d] failed with %#x!\n", i*2+1, s32Ret);                     break;                 }                                         HI_S32 s32Ret;                                 if(0 == stStat.u32CurPacks)                                 {                                                                                   SAMPLE_PRT("NOTE: Current  frame is NULL!\n");                                     continue;                                 }                 /*******************************************************                 step 2.3 : malloc corresponding number of pack nodes.                 *******************************************************/                 stStream.pstPack = (VENC_PACK_S*)malloc(sizeof(VENC_PACK_S) * stStat.u32CurPacks);                 if (NULL == stStream.pstPack)                 {                     SAMPLE_PRT("malloc stream pack failed!\n");                     break;                 }                                      /*******************************************************                 step 2.4 : call mpi to get one-frame stream                 *******************************************************/                 stStream.u32PackCount = stStat.u32CurPacks;                 s32Ret = HI_MPI_VENC_GetStream(i*2+1, &stStream, HI_TRUE);                 if (HI_SUCCESS != s32Ret)                 {                     free(stStream.pstPack);                     stStream.pstPack = NULL;                     SAMPLE_PRT("HI_MPI_VENC_GetStream failed with %#x!\n",s32Ret);                     break;                 }                         MP4WriteSample(hMP4File, video, stStream.pstPack[0].pu8Addr+stStream.pstPack[0].u32Offset,stStream.pstPack[0].u32Len-stStream.pstPack[0].u32Offset,MP4_INVALID_DURATION, 0, 1);                         if(w==1300)                 {   printf("pthread w=%d\n");                     flag=0;                 }                 //printf("HI_S32 VencFd[VENC_MAX_CHN_NUM];venc[%d]:%d\n",i,stStream.pstPack[0].u32Len-stStream.pstPack[0].u32Offset);                 //printf("FD_ISSET success\n");                 /*******************************************************                     step 2.6 : release stream                 *******************************************************/                 //if(flag=1)                 //{                     s32Ret = HI_MPI_VENC_ReleaseStream(i*2+1,&stStream);                     if (HI_SUCCESS != s32Ret)                     {                         free(stStream.pstPack);                                     SAMPLE_PRT("HI_MPI_VENC_ReleaseStream chn[%d] failed with %#x!\n", i*2+1, s32Ret);                                             stStream.pstPack = NULL;                         break;                     }                 //}                 /*******************************************************                     step 2.7 : free pack nodes                 *******************************************************/                 free(stStream.pstPack);                         //printf("free  stStream.pstPack--%d\n",i);                 stStream.pstPack = NULL;                                          }                                       }       }     if(w==1500)         {           for (i = 0; i <2; i++)                 {                                               MP4Close(hMP4File, 0);                     //printf("mp4 close\n");                                                     }         break;     }     w++;   }   printf("pthread over\n"); } /****************************************************************************** * funciton : get stream from each channels and save them ******************************************************************************/ HI_VOID* SAMPLE_COMM_VENC_GetVencStreamProc(HI_VOID *p) {            HI_S32 i;     //HI_S32 j=0;     HI_S32 s32ChnTotal;     VENC_CHN_ATTR_S stVencChnAttr;     SAMPLE_VENC_GETSTREAM_PARA_S *pstPara;     //HI_S32 maxfd = 0;     struct timeval TimeoutVal;     fd_set read_fds;     //HI_S32 VencFd[VENC_MAX_CHN_NUM];     HI_CHAR aszFileName[VENC_MAX_CHN_NUM][64];     //HI_CHAR aszFileName2[VENC_MAX_CHN_NUM][64];     //FILE *pFile[VENC_MAX_CHN_NUM];//自己注释     MP4FileHandle hMP4File[VENC_MAX_CHN_NUM];     MP4TrackId video[VENC_MAX_CHN_NUM];     char szFilePostfix[10];     VENC_CHN_STAT_S stStat;     VENC_STREAM_S stStream;     HI_S32 s32Ret;     VENC_CHN VencChn;     PAYLOAD_TYPE_E enPayLoadType[VENC_MAX_CHN_NUM];        pstPara = (SAMPLE_VENC_GETSTREAM_PARA_S*)p;     s32ChnTotal = pstPara->s32Cnt;      pthread_t pt=1;         /******************************************         step 1:  check & prepare save-file & venc-fd         ******************************************/     if (s32ChnTotal >= VENC_MAX_CHN_NUM)     {         SAMPLE_PRT("input count invaild\n");         return NULL;     }     for (i = 0; i < s32ChnTotal; i++)     {         /* decide the stream file name, and open file to save stream */         VencChn = i;         s32Ret = HI_MPI_VENC_GetChnAttr(VencChn, &stVencChnAttr);         if(s32Ret != HI_SUCCESS)         {FD_SET(VencFd, &read_fds);         SAMPLE_PRT("HI_MPI_VENC_GetChnAttr chn[%d] failed with %#x!\n", \                    VencChn, s32Ret);         return NULL;         }         /* Set Venc Fd. */         VencFd = HI_MPI_VENC_GetFd(i);         if (VencFd < 0)         {         SAMPLE_PRT("HI_MPI_VENC_GetFd failed with %#x!\n",                    VencFd);         return NULL;         }         if (maxfd <= VencFd)         {             maxfd = VencFd;             printf("macfd:%d\n",maxfd);         }     }    while(1)     {     int w=0;     int l_flag=0;     printf("mp4:%d\n",j);         for(i=0;i         {             sprintf(aszFileName, "video/stream_chn%d_%d%s", i,j,".mp4");                 hMP4File= MP4CreateEx(aszFileName,  0, 1, 1, 0, 0, 0, 0);                 if (hMP4File == MP4_INVALID_FILE_HANDLE)             {                         printf("open mp4 file fialed.\n");                         return NULL;                 }             MP4SetTimeScale(hMP4File, 90000);                 video= MP4AddH264VideoTrack(hMP4File, 90000, 90000 / 25, 3840, 2160,                                         0x64, //sps[1] AVCProfileIndication                                         0x00, //sps[2] profile_compat                                         0x1f, //sps[3] AVCLevelIndication                                         3); // 4 bytes length before each NAL unit                 if (video == MP4_INVALID_TRACK_ID)               {                     printf("add video mp4 track fialed.\n");                     return NULL;                 }         }         if(flag==1)         {                printf("pthread join\n");             while(flag);             printf("pthread go\n");         }         /******************************************          step 2:  Start to get streams of each channel.         ******************************************/         while (HI_TRUE == pstPara->bThreadStart)         {                 FD_ZERO(&read_fds);                 for (i = 0; i < s32ChnTotal; i++)                 {                     FD_SET(VencFd, &read_fds);                              }                 TimeoutVal.tv_sec  = 2;                 TimeoutVal.tv_usec = 0;                 s32Ret = select(maxfd + 1, &read_fds, NULL, NULL, &TimeoutVal);                     //printf("s32Ret:%d",s32Ret);                 if (s32Ret < 0)                 {                     SAMPLE_PRT("select failed!\n");                     break;                 }                 else if (s32Ret == 0)                 {                     SAMPLE_PRT("get venc stream time out, exit thread\n");                     continue;                 }                 else                 {                     for (i = 0; i < s32ChnTotal; i++)                     {                                 //printf("venc[%d]:",i);                         if (FD_ISSET(VencFd, &read_fds))                         {                            /*******************************************************                             step 2.1 : query how many packs in one-frame stream.                             *******************************************************/                             memset(&stStream, 0, sizeof(stStream));                             s32Ret = HI_MPI_VENC_Query(i, &stStat);                             if (HI_SUCCESS != s32Ret)                             {                                 SAMPLE_PRT("HI_MPI_VENC_Query chn[%d] failed with %#x!\n", i, s32Ret);                                 break;                             }                                                                                         if(0 == stStat.u32CurPacks)                                                 {                                                                                                           SAMPLE_PRT("NOTE: Current  frame is NULL!\n");                                                         continue;                                                 }                             /*******************************************************                             step 2.3 : malloc corresponding number of pack nodes.                             *******************************************************/                             stStream.pstPack = (VENC_PACK_S*)malloc(sizeof(VENC_PACK_S) * stStat.u32CurPacks);                             if (NULL == stStream.pstPack)                                 {                                     SAMPLE_PRT("malloc stream pack failed!\n");                                     break;                                 }                                                  /*******************************************************                             step 2.4 : call mpi to get one-frame stream                             *******************************************************/                             stStream.u32PackCount = stStat.u32CurPacks;                             s32Ret = HI_MPI_VENC_GetStream(i, &stStream, HI_TRUE);                             if (HI_SUCCESS != s32Ret)                             {                                 free(stStream.pstPack);                                 stStream.pstPack = NULL;                                 SAMPLE_PRT("HI_MPI_VENC_GetStream failed with %#x!\n",s32Ret);                                 break;                             }                                                         MP4WriteSample(hMP4File, video, stStream.pstPack[0].pu8Addr+stStream.pstPack[0].u32Offset,stStream.pstPack[0].u32Len-stStream.pstPack[0].u32Offset,MP4_INVALID_DURATION, 0, 1);                             //printf("venc[%d]:%d\n",i,stStream.pstPack[0].u32Len-stStream.pstPack[0].u32Offset);                             //printf("FD_ISSET success\n");                             /*******************************************************                                 step 2.6 : release stream                             *******************************************************/                             //if(flag==0)                             //{                                 s32Ret = HI_MPI_VENC_ReleaseStream(i, &stStream);                                 if (HI_SUCCESS != s32Ret)                                 {                                     free(stStream.pstPack);                                                 printf("HI_SUCCESS != s32Ret free  stStream.pstPack--%d\n",i);                                             stStream.pstPack = NULL;                                     break;                                 }                            // }                             /*******************************************************                             step 2.7 : free pack nodes                             *******************************************************/                             free(stStream.pstPack);                                     //printf("free  stStream.pstPack--%d\n",i);                             stStream.pstPack = NULL;                                                      }                                         /*for(i=0; i<2; i++)                                             {                                                 VencChn = i*2;                                                 VpssGrp = i;                                                        SAMPLE_COMM_VENC_UnBindVpss(VencChn,VpssGrp,0);                                                 VencChn++;                                                 SAMPLE_COMM_VENC_UnBindVpss(VencChn,VpssGrp,1);                                         }*/                                                      else                         {                            // printf("FD_ISSET fail\n");                         }                     }                     if(w==1300)                     {                         flag=1;                     }                     if(flag==1&&l_flag==0)                     {                         printf("pthrad_begin\n");                         pthread_create(&pt,0,vedio_recorde,NULL);                         l_flag=1;                           }                     if(w==1500)                                 {                                     int VencChn,VpssGrp;                                     for (i = 0; i <4; i++)                                         {                                     //fclose(pFile);                                                                        MP4Close(hMP4File,0);                                         //printf("mp4 close\n");                                                                             }                     break;                     }                     w++;                 }             }     j++;     }     return NULL; }
    2018-01-21
    4 0 2351
  • n画面其中一个格子窗口,因为其中一帧是有部分区域透明,透明的地方显示的是绿色
    2017-11-06
    0 0 1903
  • ################Failed to send head frame! Failed to download File! Failed to download fastboot! 板子是别人做的。 我看见有人说要配置 ddr之类的(不理解) datasheet文件在哪个文件夹下 Hi3521A/Hi3520DV300 DDR 配置中提到的uboot表格在哪个文件夹下
    2017-10-19
    1 0 5587
  • memset(&pstVideoFrame,0,sizeof(VIDEO_FRAME_INFO_S)); fp=fopen("nv21_v6.yuv","r"); if (HI_FAILURE == HI_MPI_SYS_MmzAlloc(&Phyaddr,((void**)&Viraddr),NULL, NULL, HD_WIDTH*HD_HEIGHT*2))     {         SAMPLE_PRT("allocate memory (maxW*maxH*2 bytes) failed\n");         fclose(fp);         return HI_NULL;     } memset(Viraddr, 0x00,HD_WIDTH*HD_HEIGHT*2); fread(Viraddr,1,HD_WIDTH*HD_HEIGHT*2,fp); pstVideoFrame.stVFrame.u32Width=1280; pstVideoFrame.stVFrame.u32Height=720; pstVideoFrame.stVFrame.u32Field= VIDEO_FIELD_FRAME;//帧场模式,帧类型 pstVideoFrame.stVFrame.enPixelFormat=PIXEL_FORMAT_YUV_PLANAR_420;  //视频图像像素格式。 pstVideoFrame.stVFrame.enCompressMode=COMPRESS_MODE_NONE;//视频压缩模式 pstVideoFrame.stVFrame.u32PhyAddr[0]=Phyaddr;    //物理地址 pstVideoFrame.stVFrame.pVirAddr[0]=Viraddr;       //虚拟地址 pstVideoFrame.stVFrame.u32Stride[0]=2;      //图像跨距。 s32Ret =HI_MPI_VPSS_SendFrame(0,&pstVideoFrame, -1);     if(s32Ret != HI_SUCCESS)     {                        SAMPLE_PRT("vpss  send frame fail for %#x!\n", s32Ret);         fclose(fp);         return HI_NULL;            }        运行时报错:0xa0078003 (VPSS 参数设置无效)
    2017-10-17
    20 3 12044
  • (HI3520DV300)用arm-hisiv300-linux-g++编译sample_vdec.c有很多错误,改完后,运行程序,出现HI_MPI_VPSS_SetChnMode failed with 0xa0078003,(VPSS 参数设置无效),但是用gcc再次编译这个程序就可以运行,如果是参数有问题的话,gcc也应该不能运行啊,各位大佬求解。
    2017-10-12
    0 0 2734
  • 江湖告急!!!!!!!!
    2017-10-11
    5 0 3956
  • total size=414720KB(405MB),used=73200KB(71MB + 496KB),remain=341520KB(333MB + 528KB),zone_number=2,block_number=26 执行free命令: ~ # free              total         used         free       shared      buffers Mem:         97000        56276        40724            0            0 -/+ buffers:              56276        40724 Swap:            0            0            0 好像跟上边没什么关系。 load3531  -osmem 64 或128,都不会改变Mem:         97000值 我想要增大mem的大小怎么办。
    2017-10-10
    10 0 5558
  •     stVarInfo.xres_virtual=1024;     stVarInfo.yres_virtual =720; 显示的图片一道一道的。 上传图片总失败。
    2017-10-09
    1 0 2816
  • #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "sample_comm.h" #include #include "hifb.h" static VO_DEV VoDev = SAMPLE_VO_DEV_DHD0; static struct fb_bitfield s_a32 = {24,8,0}; static struct fb_bitfield s_r32 = {16,8,0}; static struct fb_bitfield s_g32 = {8,8,0}; static struct fb_bitfield s_b32 = {0,8,0};//ARGB /*static struct fb_bitfield g_r16 = {10, 5, 0}; static struct fb_bitfield g_g16 = {5, 5, 0}; static struct fb_bitfield g_b16 = {0, 5, 0}; static struct fb_bitfield g_a16 = {15, 1, 0};*/ /*#define WIDTH                        1920 #define HEIGHT                         1080*/ #define WIDTH                  1024 #define HEIGHT                 720 #define GRAPHICS_LAYER_HC0 2 #define GRAPHICS_LAYER_G0  0 #define GRAPHICS_LAYER_G1  1 typedef struct hiPTHREAD_HIFB_SAMPLE {     HI_S32 fd;     HI_S32 layer;     HI_S32 ctrlkey; }PTHREAD_HIFB_SAMPLE_INFO; HI_VOID SAMPLE_HIFB_HandleSig(HI_S32 signo) {     if (SIGINT == signo || SIGTSTP == signo)     {         SAMPLE_COMM_SYS_Exit();         printf("\033[0;31mprogram exit abnormally!\033[0;39m\n");     }     exit(0); } HI_VOID *init_hifb() { HI_S32 s32Ret = HI_SUCCESS;     HI_BOOL bShow;     struct fb_var_screeninfo stVarInfo;     HI_CHAR file[12] = "/dev/fb0";     PTHREAD_HIFB_SAMPLE_INFO pstInfo;    // FILE *fp;     HI_BOOL bEnable;     HIFB_DDRZONE_S stDDRZonePara;     HIFB_LAYER_INFO_S stLayerinfo;     //HIFB_BUFFER_S stCanvasBuf;    // HI_CHAR *pcBuf;    // HI_S32 i = 0;             //pthread_t phifb0 = -1;            //PTHREAD_HIFB_SAMPLE_INFO stInfo0;     HI_U32 u32PicWidth         = WIDTH;     HI_U32 u32PicHeight        = HEIGHT;     SIZE_S  stSize;     VO_LAYER VoLayer = 0;     VO_PUB_ATTR_S stPubAttr;     VO_VIDEO_LAYER_ATTR_S stLayerAttr;     HI_U32 u32VoFrmRate;     VB_CONF_S       stVbConf;     HI_U32 u32BlkSize;     /******************************************      step  1: init variable     ******************************************/     memset(&stVbConf,0,sizeof(VB_CONF_S));     u32BlkSize = CEILING_2_POWER(u32PicWidth,SAMPLE_SYS_ALIGN_WIDTH)\         * CEILING_2_POWER(u32PicHeight,SAMPLE_SYS_ALIGN_WIDTH) *2;     stVbConf.u32MaxPoolCnt = 128;         stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;     stVbConf.astCommPool[0].u32BlkCnt =  6;     /******************************************      step 2: mpp system init.     ******************************************/     s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);     if (HI_SUCCESS != s32Ret)     {         SAMPLE_PRT("system init failed with %d!\n", s32Ret);         goto SAMPLE_HIFB_NoneBufMode_0;     }     /******************************************      step 3:  start vo hd0.     *****************************************/     s32Ret = HI_MPI_VO_UnBindGraphicLayer(GRAPHICS_LAYER_HC0, VoDev);     if (HI_SUCCESS != s32Ret)     {         SAMPLE_PRT("UnBindGraphicLayer failed with %d!\n", s32Ret);         goto SAMPLE_HIFB_NoneBufMode_0;     }     s32Ret = HI_MPI_VO_BindGraphicLayer(GRAPHICS_LAYER_HC0, VoDev);     if (HI_SUCCESS != s32Ret)     {         SAMPLE_PRT("BindGraphicLayer failed with %d!\n", s32Ret);         goto SAMPLE_HIFB_NoneBufMode_0;     }     stPubAttr.enIntfSync = VO_OUTPUT_720P60;     // stPubAttr.enIntfSync = VO_OUTPUT_1080P60;     stPubAttr.enIntfType = VO_INTF_VGA;         stPubAttr.u32BgColor = 0x00ff00;     stLayerAttr.bClusterMode = HI_FALSE;         stLayerAttr.bDoubleFrame = HI_FALSE;         stLayerAttr.enPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;     s32Ret = SAMPLE_COMM_VO_GetWH(stPubAttr.enIntfSync,&stSize.u32Width,\         &stSize.u32Height,&u32VoFrmRate);     if (HI_SUCCESS != s32Ret)     {         SAMPLE_PRT("get vo wh failed with %d!\n", s32Ret);         goto SAMPLE_HIFB_NoneBufMode_0;     }     memcpy(&stLayerAttr.stImageSize,&stSize,sizeof(stSize));         stLayerAttr.u32DispFrmRt = 30 ;         stLayerAttr.stDispRect.s32X = 0;         stLayerAttr.stDispRect.s32Y = 0;         stLayerAttr.stDispRect.u32Width = stSize.u32Width;         stLayerAttr.stDispRect.u32Height = stSize.u32Height; printf("hello\n");     s32Ret = SAMPLE_COMM_VO_StartDev(VoDev, &stPubAttr);     if (HI_SUCCESS != s32Ret)     {         SAMPLE_PRT("start vo dev failed with %d!\n", s32Ret);         goto SAMPLE_HIFB_NoneBufMode_0;         }     s32Ret = SAMPLE_COMM_VO_StartLayer(VoLayer, &stLayerAttr);     if (HI_SUCCESS != s32Ret)     {         SAMPLE_PRT("start vo layer failed with %d!\n", s32Ret);         goto SAMPLE_HIFB_NoneBufMode_1;         }         if (stPubAttr.enIntfType & VO_INTF_HDMI)     {         printf("HDMI\n");         s32Ret = SAMPLE_COMM_VO_HdmiStart(stPubAttr.enIntfSync);                if (HI_SUCCESS != s32Ret)         {             SAMPLE_PRT("start HDMI failed with %d!\n", s32Ret);             goto SAMPLE_HIFB_NoneBufMode_2;             }     }     /******************************************      step 4:  start hifb.     *****************************************/     //stInfo0.layer   =  0;     //stInfo0.fd      = -1;     //stInfo0.ctrlkey =  3;     //pthread_create(&phifb0, 0, SAMPLE_HIFB_COMPRESS, (void *)(&stInfo0));       pstInfo.layer        = 0;       pstInfo.fd      = -1;       pstInfo.ctrlkey =  3;         switch (pstInfo.layer)         {                 case GRAPHICS_LAYER_G0:                         strcpy(file, "/dev/fb0");                         break;                 default:                         strcpy(file, "/dev/fb0");                         break;         }     /* 1. open framebuffer device overlay 0 */         pstInfo.fd = open(file, O_RDWR, 0);         if(pstInfo.fd < 0)         {                 SAMPLE_PRT("open %s failed!\n",file);                 return HI_NULL;         }     s32Ret = ioctl (pstInfo.fd, FBIOGET_VSCREENINFO, &stVarInfo);     if (s32Ret < 0)     {         SAMPLE_PRT("FBIOGET_VSCREENINFO failed!\n");         close(pstInfo.fd);         return HI_NULL;     }         stVarInfo.red = s_r32;         stVarInfo.green = s_g32;         stVarInfo.blue = s_b32;         stVarInfo.transp = s_a32;         stVarInfo.bits_per_pixel = 32;     stVarInfo.xres=WIDTH;     stVarInfo.yres=HEIGHT;     stVarInfo.activate=FB_ACTIVATE_NOW;     stVarInfo.xres_virtual=WIDTH;     stVarInfo.yres_virtual = HEIGHT;     stVarInfo.xoffset=0;     stVarInfo.yoffset=0;     s32Ret = ioctl (pstInfo.fd, FBIOPUT_VSCREENINFO, &stVarInfo);     if (s32Ret < 0)     {         SAMPLE_PRT("FBIOPUT_VSCREENINFO failed!\n");         close(pstInfo.fd);         return HI_NULL;     }     s32Ret = ioctl(pstInfo.fd, FBIOGET_LAYER_INFO, &stLayerinfo);     if (s32Ret < 0)     {         SAMPLE_PRT("FBIOGET_LAYER_INFO failed!\n");         close(pstInfo.fd);         return HI_NULL;     }                stLayerinfo.u32Mask = 0;     stLayerinfo.BufMode = HIFB_LAYER_BUF_NONE;     stLayerinfo.u32Mask |= HIFB_LAYERMASK_BUFMODE;        s32Ret = ioctl(pstInfo.fd, FBIOPUT_LAYER_INFO, &stLayerinfo);     if (s32Ret < 0)     {         SAMPLE_PRT("FBIOPUT_LAYER_INFO failed!\n");         close(pstInfo.fd);         return HI_NULL;     }     stDDRZonePara.u32StartSection = 0;     stDDRZonePara.u32ZoneNums = 15;     s32Ret = ioctl(pstInfo.fd, FBIOPUT_MDDRDETECT_HIFB, &stDDRZonePara);     if (s32Ret < 0)     {         SAMPLE_PRT("FBIOPUT_MDDRDETECT_HIFB failed!\n");         close(pstInfo.fd);         return HI_NULL;     }         /* 2. open compress */     //bEnable = HI_TRUE;      bEnable=HI_FALSE;     s32Ret = ioctl(pstInfo.fd, FBIOPUT_COMPRESSION_HIFB, &bEnable);     if (s32Ret < 0)     {         SAMPLE_PRT("FBIOPUT_COMPRESSION_HIFB failed!\n");         close(pstInfo.fd);         return HI_NULL;     }     bShow = HI_TRUE;     if (ioctl(pstInfo.fd, FBIOPUT_SHOW_HIFB, &bShow) < 0)     {         printf("FBIOPUT_SHOW_HIFB failed!\n");         return HI_NULL;     }     SAMPLE_HIFB_NoneBufMode_2:     SAMPLE_COMM_VO_StopLayer(VoLayer); SAMPLE_HIFB_NoneBufMode_1:     SAMPLE_COMM_VO_StopDev(VoDev); SAMPLE_HIFB_NoneBufMode_0:     SAMPLE_COMM_SYS_Exit(); } int main(int argc,char **argv) {     signal(SIGINT, SAMPLE_HIFB_HandleSig);     signal(SIGTERM, SAMPLE_HIFB_HandleSig);    printf("qt \n"); QApplication app(argc,argv); app.setApplicationName("panorama"); init_hifb(); mywidget w; printf("w.show\n"); w.show(); printf("w.show\n"); return app.exec(); } init_hifb();单独做一个程序后台运行就可以显示qt界面放到一起就不行了。很奇怪。
    2017-10-09
    3 1 8861
  • 求解这种想法可不可以实现。fb0和fb1,只开启一个vo,还是要开启两个。
    2017-10-08
    0 0 2249
  • /opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin/../lib/gcc/arm-hisiv300-linux-uclibcgnueabi/4.8.3/../../../../arm-hisiv300-linux-uclibcgnueabi/bin/ld: qteworkspace: hidden symbol `jpeg_mem_src' in /opt/hisi-linux/x86-arm/arm-hisiv300-linux/arm-hisiv300-linux-uclibcgnueabi/lib/3rdparty/liblibjpeg.a(jdatasrc.c.obj) is referenced by DSO /opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin/../lib/gcc/arm-hisiv300-linux-uclibcgnueabi/4.8.3/../../../../arm-hisiv300-linux-uclibcgnueabi/bin/ld: 最后的链结失败: 错误的值 collect2: error: ld returned 1 exit status make: *** [qteworkspace] 错误 1
    2017-10-08
    0 0 2966
  • 各位大佬给个大概的思路
    2017-10-06
    6 0 2168
  • HIFB_BUFFER_S stCanvasBuf;//图形层画布信息及更新区域,用于绘制与刷新。 这两个就可以设置 stSrc.enColorFmt =TDE2_COLOR_FMT_RGBA8888; stDst.enColorFmt =TDE2_COLOR_FMT_RGBA8888;
    2017-09-30
    2 0 2499
  • 我需要用TDE播放一些opencv处理过的图片序列
    2017-09-28
    0 0 3189
  • 图片的宽高和屏幕的宽高都设置好了
    2017-09-26
    0 0 3302
易百纳技术社区
共32条
  • 1
  • 2
易百纳技术社区