This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Dm368 osd can't display icon/image/Logo (using the static array that present in IPNC application)

Hi, erveryone

I try to display the logo(using the static array that present in IPNC application) in video, but it can't work.

My codes are:

1.  Init:

if(SWOSD_init()!=0) /* Run SW OSD*/
{
      printf(" SWOSD: SWOSD_init Failure................. \n");
      return FAIL;
}

iconBuff160_Y = (char *)OSD_CMEM_ALLOC((SWOSD_CHARWIDTHTILOGO_160_64*SWOSD_CHARHEIGHTTILOGO_160_64), 32) ;
iconBuff160_UV = (char *)OSD_CMEM_ALLOC(((SWOSD_CHARWIDTHTILOGO_160_64*SWOSD_CHARHEIGHTTILOGO_160_64)/2), 32);

swosdSetLogoPrm();  

for(i=0; i<2; i++)

{

if(SWOSD_createHandle(&osdHndl, &idxHndl[i]) != GS_SUCCESS)
{
      printf("Handle Creation Failed in SWOSD(%d).............", i);
      return FAIL;
}
else
{
       //Setting for 32 BMP windows currently
      if(SWOSD_setNumWindows(osdHndl, SWOSD_WINMAX)!=0) /* Run SW OSD*/
      {
            printf(" SWOSD: SWOSD_setNumWindows Failure................. \n");
             return FAIL;
      }
 
      swosdSetWinParam(height, width);

//swosdMakeFixWinString(i);

    }

   algSwosdHndl[i] = osdHndl;

}

static inline void swosdSetLogoPrm(void)
{

     OSD_MEMCPY(iconBuff160_Y, TILogo_Y_160_64, SWOSD_CHARWIDTHTILOGO_160_64*SWOSD_CHARHEIGHTTILOGO_160_64);
    OSD_MEMCPY(iconBuff160_UV, TILogo_UV_160_64, (SWOSD_CHARWIDTHTILOGO_160_64*SWOSD_CHARHEIGHTTILOGO_160_64)/2);

}

static int swosdSetWinParam(int height, int width)
{
     SWOSD_BmpWinPrm bmpWinPrm;
    int i = 0;

    #ifdef SWOSD_USER_TRANSPARANCY_ON
    bmpWinPrm.userTransparancy = SWOSD_RBOOLTRUE;
   #else
   bmpWinPrm.userTransparancy = SWOSD_RBOOLFALSE;
   #endif

   //for window 1
   bmpWinPrm.enable = SWOSD_RBOOLFALSE;
   bmpWinPrm.format = SWOSD_FORMATYUV420p;
   bmpWinPrm.startX = 0;
   bmpWinPrm.startY = 0;
   bmpWinPrm.width = SWOSD_CHARWIDTHTILOGO_160_64;
   bmpWinPrm.height = SWOSD_CHARHEIGHTTILOGO_160_64;
   bmpWinPrm.lineOffset = SWOSD_CHARWIDTHTILOGO_160_64;
   bmpWinPrm.transperencyVal = SWOSD_OSDWHITETRANSVAL;
   bmpWinPrm.transperencyRange = SWOSD_OSDWHITETRANSRANGE;
   bmpWinPrm.transperencyEnable = SWOSD_BMPTRANSDISABLE;
   bmpWinPrm.resizeEnable = 0;
   bmpWinPrm.bmpWinAddr = iconBuff160_Y;
   bmpWinPrm.bmpWinAddrUV = iconBuff160_UV;

  if(SWOSD_setBmpWinPrm(osdHndl, SWOSD_WINDOW_ONE, &bmpWinPrm)!=0)
  {
      printf(" SWOSD: SWOSD_setBmpWinPrm Failure................. \n");
      return FAIL;
  }

  return SUCCESS;
}

2.  Then call this function VIDEO_swosdTskRun() in the while loop of CAPTURE_ThrFxn():

int VIDEO_swosdTskRun(int streamId,int width, int height, int frameRate,void *pBufInfo)
{
    int startX = 0;
    int startY = 0;

    SWOSD_MainWinPrm mainWinPrm;

    static int osd_count[AVSERVER_MAX_STREAMS] = {0, 0, 0, 0};

    //if(gAVSERVER_config.captureConfig[streamId].swosdConfig.swosdEnable)
   {

       osdHndl = (SWOSD_Hndl *)algSwosdHndl[streamId];

       mainWinPrm.format = SWOSD_FORMATYUV420p;

       mainWinPrm.lineOffset = width;
       mainWinPrm.width = width;
       mainWinPrm.height = height - OSA_floor(startY, 2 )/2;
      /*OSD does not take care of Vertical offset, therefore care is needed to read UV data*/

     if(SWOSD_setMainWinPrm(osdHndl, &mainWinPrm)!=0)
    {
         printf(" SWOSD: SWOSD_setMainWinPrm Failure................. \n");
         return FAIL;
    }

    if(osd_count[streamId]>=(frameRate/1000))

    {
        swosdDisplay(streamId, osdHndl);
        osd_count[streamId] = 0;
     }
     else
         osd_count[streamId]++;

      SWOSD_MsgRecvHandler();

     if(SWOSD_winDrawHandle(osdHndl, (short*)(pBufInfo))!=0)
     {
            printf(" SWOSD: SWOSD_winDrawHandle Failure................. \n");
            return FAIL;
     }

}

return SUCCESS;
}

static int swosdDisplay(int streamId, SWOSD_Hndl *osdHndl )
{
      int i = 0;

      swosdMakeWinString(streamId);
     //swosdChangeXYParmDetail(streamId, osdHndl);

     if(SWOSD_setBmpWinEnable(osdHndl, SWOSD_WINDOW_ONE, SWOSD_BMPWINENABLE)!=0)
     {
             printf(" SWOSD: SWOSD_setBmpWinEnable Failure................. \n");
             return FAIL;
     } 

     return SUCCESS;
}

static int swosdMakeWinString(int streamId)
{

      if(SWOSD_setBmpchangeWinXYPrm(osdHndl, SWOSD_WINDOW_ONE, 0, 0)!=0)
    {
         printf(" SWOSD: SWOSD_setBmpchangeWinXYPrm Failure................. \n");
         return FAIL;
     }

     return SUCCESS;
}

The input values of above are streamID=0; width=1280;height=720;framerate=30000; pBufInfo=capBuf[0].start

No error return, but the video have no logo display, just have the normal video stream, i don't know why, please help to comment this, thanks.