....
//读取文件的属性
count = fread(buff_8,sizeof(char),8,fOsdFile);
if (count != 8)
return 0;
size = buff_8[1]<<8*2 | buff_8[2]<<8 | buff_8[3];
rc_dest.cX = buff_8[4] << 8 | buff_8[5];
rc_dest.cY = buff_8[6] << 8 | buff_8[7];
if (0 == size)
return 0;
//创建DMA缓冲区
if(fsetpos(fOsdFile,&pos))
return 0;
PVOID phys;
hr = pMemAlloc->GetDMABuffer(size,(void**)&pshared,&phys);
if (pshared == NULL)
{
return 0;
}
//写到卡
//将数据读取到缓冲
fread(pshared,sizeof(char),size,fOsdFile);
pOSD->Play();
ULONG ret;
HEADER hdr;
ZeroMemory(&hdr,sizeof(hdr));
RMOVERLAPIO ovr = {0,0,0,0,CreateEvent(NULL,TRUE,FALSE,NULL)};
hdr.multi.Count = 1;
hdr.multi.Size = sizeof(HEADER);
hdr.header.Size = sizeof(RMSTREAM_HEADER);
hdr.header.pData = pshared;
hdr.header.FrameExtent = size;
// Send whole bitmapdo
wn
//
pOSD->Write(&hdr.multi,&ovr);
// Wait for completion
//
ret = WaitForSingleObject(ovr.hEvent,10000);
if (ret == WAIT_TIMEOUT)
{
// printf(" !!! TIMEOUT/n");
}
pDevice->SetAttributes(MpegAttrOsdDest,(long)&rc_dest);
pDevice->SetAttributes(MpegAttrOsdON,1);
/*
if (m_bShowOSD)
pDevice->SetAttributes(MpegAttrOsdON,1);
else
pDevice->SetAttributes(MpegAttrOsdOFF,1);
*/
CloseHandle(ovr.hEvent);
pOSD->Stop();
m_bShowOSD=true;
.................