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.

RTOS/DRA74: update buffer before encode, is right?

Part Number: DRA74


Tool/software: TI-RTOS

hi,

I want to add time watermark. My thought is write is update every frame before  encode frame.but the below method did not work. Please hellp to check the issue !!!

before the encoding, the buffer is YUV , check the vsdk0304 code, I find Draw2D_drawCharYuv420SP function.

I write an funtion as below: 

int Draw2D_draw_watermark( void *pFrame)
{

int status;
Draw2D_Handle draw2DHndl;
draw2DHndl = NULL;
Draw2D_BufInfo bufInfo;
status = Draw2D_create(draw2DHndl);
if (status != SYSTEM_LINK_STATUS_SOK)
{
return status;
}

//bufInfo
bufInfo.bufWidth = 1280;
bufInfo.bufHeight = 720;
//bufInfo.bufPitch[0] = ;
bufInfo.dataFormat = SYSTEM_DF_YUV420SP_UV;
bufInfo.transperentColor = DRAW2D_TRANSPARENT_COLOR;
bufInfo.transperentColorFormat = SYSTEM_DF_YUV420SP_UV;

//set addres 
bufInfo.bufAddr[0] = (UInt32) pFrame;


status = Draw2D_setBufInfo(draw2DHndl, &bufInfo); 

Draw2D_FontProperty font;
// Draw2D_FontPrm Prm;
// Draw2D_getFontProperty(Prm, &font);

Draw2D_getFontProperty12(&font);

Draw2D_drawCharYuv420SP(draw2DHndl, 0, 0, 'A', &font); 
Draw2D_drawCharYuv420SP(draw2DHndl, 30, 0, 'A', &font);
Draw2D_drawCharYuv420SP(draw2DHndl, 60, 0, 'A', &font); 
Draw2D_drawCharYuv420SP(draw2DHndl, 90, 0, 'A', &font); 
Draw2D_drawCharYuv420SP(draw2DHndl, 120, 0, 'A', &font);
Draw2D_drawCharYuv420SP(draw2DHndl, 150, 0,'A', &font); 
Draw2D_drawCharYuv420SP(draw2DHndl, 0, 30, 'A', &font); 
Draw2D_drawCharYuv420SP(draw2DHndl, 0, 60, 'A', &font);
Draw2D_drawCharYuv420SP(draw2DHndl, 0, 90, 'A', &font); 
Vps_printf("watermark added! \n"); 
// Draw2D_clearBuf(draw2DHndl);
status = Draw2D_delete( draw2DHndl );

}

in below position, I add the funciton:

in function  nt32 EncLink_codecQueueFramesToChQue(EncLink_Obj * pObj) added!

for (frameId = 0; frameId < frameList.numBuf; frameId++)
{
pFrame = frameList.buffers[frameId];
vidFrm = pFrame->payload;

pChObj = &pObj->chObj[pFrame->chNum];



Draw2D_draw_watermark( pFrame->payload);

if (SYSTEM_SF_PROGRESSIVE ==
System_Link_Ch_Info_Get_Flag_Scan_Format(
pObj->inQueInfo.chInfo[pFrame->chNum].flags))
{
pChObj->nextFid = 0;
}