DearAll, I am using DVRRDK3.0 with DM8168EVM. Because no capture module, I create my own chains with NullSrcLink in order to test dm8168 OSD function and my chains is run normally.the following is about my chains:
nullsrclink -->....->dsp(osd) --> ... --> enclink-->ipcBit( h264)
After run this chains, I can get the h264 video data, then i playback it with player(BaoFengPlayer).
at last, I find that the osd is overlay successfully but also has some questions seemingly.Mainly from the following three aspects:
NOTE:my chains only overlay one osd.
1. to overlay date "2012-06-15 Fri"(startX=150, startY=300), but the real result is the following image:
2. with "1", I continue to disable this osd, but i find that the saved data is the same with above image.
3. I restart the chains with different osd overlay position(startX=500, startY=500) and find that the original is also exit and the new osd is incorrect!, see the following image:
With question "3", after some test, i find that only if power down 8168, the last osd overlay will remove.
The section code of configure osd:
else if (ch == 'o'){
int tmpOsdCnt = 0;
int status = -1;
int osdW = 256*2;
int osdH = 256*2;
int osdOffsetX = 500;
int osdOffsetY = 500;
int osdChId = 0;
int osdWinNum =USER_OSD_NUM;
Vsys_AllocBufInfo bufInfo;
UTILS_assert(osdWinNum <= 10);
static AlgLink_OsdChWinParams tmpOsdPrm = {0};
tmpOsdPrm.colorKey[0] = 0xfa;//y
tmpOsdPrm.colorKey[1] = 0x7d;//u
tmpOsdPrm.colorKey[2] = 0x7e;//v
tmpOsdPrm.chId = osdChId;
tmpOsdPrm.numWindows = osdWinNum;
totalBufSize = osdW * osdH * 2 * tmpOsdPrm.numWindows;
status = Vsys_allocBuf(0, totalBufSize, 128, &bufInfo);//0 is SR0's ID
if (status != ERROR_NONE){
printf("**** alloc mem failed[%d] ****\n", status);
}else{
osdBufVirtAddr = bufInfo.virtAddr;
//memset(osdBufVirtAddr, 50, totalBufSize);
}
while(1)
{
int osdFlag = 0;
int osdStartFlag = 1;
char ch[128];
printf(gOSD_Menu);
fgets(ch, 128, stdin);
if (ch[1] != '\n' || ch[0] == '\n')
ch[0] = '\n';
if (ch[0] == 'a'){
osdFlag = 1;
osdStartFlag = 0;
}else if (ch[0] == 'b'){
osdFlag = 1;
osdStartFlag = 1;
}else if (ch[0] == 'c'){
osdFlag = 1;
osdStartFlag = 1;
}else if (ch[0] == 'q'){
break;
}else{
continue;
}
if (osdFlag != 0)
{
//AlgLink_CreateParams_Init();
printf("**** set osd start ****\n");
for(tmpOsdCnt=0; tmpOsdCnt<tmpOsdPrm.numWindows; tmpOsdCnt++)
{
tmpOsdPrm.winPrm[tmpOsdCnt].format = SYSTEM_DF_YUV420SP_UV;
if (tmpOsdPrm.winPrm[tmpOsdCnt].format == SYSTEM_DF_YUV420SP_UV){
printf("**** winPrm.format[SYSTEM_DF_YUV420SP_UV] ****\n");
tmpOsdPrm.winPrm[tmpOsdCnt].addr[0][0] = bufInfo.physAddr + osdW*osdH*2*tmpOsdCnt;
tmpOsdPrm.winPrm[tmpOsdCnt].addr[0][1] = bufInfo.physAddr + (osdW*osdH) + osdW*osdH*2*tmpOsdCnt;
}else {
printf("**** winPrm.format[other] ****\n");
}
tmpOsdPrm.winPrm[tmpOsdCnt].startX = osdOffsetX + (osdW+10)*tmpOsdCnt;
tmpOsdPrm.winPrm[tmpOsdCnt].startY = osdOffsetY;
tmpOsdPrm.winPrm[tmpOsdCnt].width = osdW;
tmpOsdPrm.winPrm[tmpOsdCnt].height = osdH;
tmpOsdPrm.winPrm[tmpOsdCnt].lineOffset = tmpOsdPrm.winPrm[tmpOsdCnt].width;
tmpOsdPrm.winPrm[tmpOsdCnt].globalAlpha = 0x80;//0x80:Max Alpha, only show OSD
tmpOsdPrm.winPrm[tmpOsdCnt].transperencyEnable = TRUE;
tmpOsdPrm.winPrm[tmpOsdCnt].enableWin = osdStartFlag;
#if 1
printf("####win[%d]:\n", tmpOsdCnt);
printf("==>1.startX[%d]\n", tmpOsdPrm.winPrm[tmpOsdCnt].startX);
printf("==>2.startY[%d]\n", tmpOsdPrm.winPrm[tmpOsdCnt].startY);
printf("==>3.width[%d]\n", tmpOsdPrm.winPrm[tmpOsdCnt].width);
printf("==>4.height[%d]\n", tmpOsdPrm.winPrm[tmpOsdCnt].height);
printf("==>5.lineOffset[%d]\n", tmpOsdPrm.winPrm[tmpOsdCnt].lineOffset);
printf("==>6.globalAlpha[%d]\n", tmpOsdPrm.winPrm[tmpOsdCnt].globalAlpha);
printf("==>7.transperencyEnable[%d]\n", tmpOsdPrm.winPrm[tmpOsdCnt].transperencyEnable);
printf("==>8.enableWin[%d]\n\n", tmpOsdPrm.winPrm[tmpOsdCnt].enableWin);
#endif
}
/* draw osd with win0*/
int osdType=3;
curVirtAddr = bufInfo.virtAddr;
dynamicFont = &ascii_420sp_1078_28;
tmpOsdPrm.winPrm[0].format = SYSTEM_DF_YUV420SP_UV;
if (osdType == 1)
{
printf("\nto set 1-mode(chinese)\n");
{
char cnExample[20] = "通道一二三四五";
char channel[6];
unsigned int length = strlen(cnExample);
sprintf(channel,"%02d", 0);
printf("\n1==========>[%s]\n", channel);
cnExample[length++] = channel[0];
cnExample[length++] = 0;
cnExample[length++] = channel[1];
cnExample[length++] = 0;
Demo_text_draw(cn_420sp_420_30, &tmpOsdPrm.winPrm[0],
cnExample, length/2, (char*)curVirtAddr,padingColor);
printf("\n2==========>[%d]\n", length/2);
}
}
else if (osdType == 2)//osd date
{
printf("\nto set 2-mode(date)\n");
Demo_text_draw(*dynamicFont, &tmpOsdPrm.winPrm[0],
"2012-06-15 Fri", 14, (char*)curVirtAddr,padingColor);
}
else if (osdType == 3)
{
printf("\nto set 3-mode(time)\n");
Demo_text_draw(*dynamicFont, &tmpOsdPrm.winPrm[0],
"00:00:00", 8, (char*)curVirtAddr,padingColor);
}
status = System_linkControl(dspAlgId, ALG_LINK_OSD_CMD_SET_CHANNEL_WIN_PRM,&tmpOsdPrm,sizeof(AlgLink_OsdChWinParams),TRUE);
if (status != ERROR_NONE){
printf("**** System_linkControl with OSD Failed[%d] ****\n", status);
}
printf("**** set osd link end ****\n");
}
}//while
}//osd_end
SO, is it question?or is it due to NullSrcLink?Why?
Please give me some suggestions, ThankX!!!

