5,530
社区成员
发帖
与我相关
我的任务
分享
BOOL CBobDeinterlace::OnNewFrame(IMediaSample* pSample){
CAutoLock lockit(&m_CritSec);
BYTE *pData;
long samplesize;
samplesize=pSample->GetActualDataLength();
pSample->GetPointer(&pData);
void *pdat=(void*)pData;
long nDataSize = 320*240*3;
int iPixel = 32; //RGB24
/*BITMAPFILEHEADER bmfh; //File header
ZeroMemory(&bmfh, sizeof(BITMAPFILEHEADER));
bmfh.bfType = 'MB';
bmfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
bmfh.bfSize = bmfh.bfOffBits + (320 * 240) * iPixel / */
BITMAPINFOHEADER bmih; //Information header
bmih.biSize = sizeof(BITMAPINFOHEADER);
bmih.biWidth = 320; //Image width
bmih.biHeight = 240; //Image height
bmih.biPlanes = 1;
bmih.biBitCount = iPixel; //RGB24
bmih.biCompression = BI_RGB;
bmih.biSizeImage = 0; //Uncompressed RGB bitmaps
bmih.biXPelsPerMeter = 0;
bmih.biYPelsPerMeter = 0;
bmih.biClrUsed = 0;
bmih.biClrImportant = 0;
BITMAPINFO bmif;
// int iSize = sizeof(BITMAPINFO) + 2 * sizeof(RGBQUAD);
//BITMAPINFO* pBMI = (BITMAPINFO*) malloc(iSize);
// memset(pBMI,0,iSize);
//pBMI->bmiHeader=bmih;
// pBMI->bmiColors[0].rgbBlue=0xff;
// pBMI->bmiColors[1].rgbGreen=0xff;
// pBMI->bmiColors[2].rgbRed=0xff;
// pBMI->bmiColors->rgbReserved=1;
//CBitmap dps;
HBITMAP hdps=CreateDIBitmap(m_pDisplaydc,&bmih,CBM_INIT,pdat,&bmif,DIB_RGB_COLORS);
//dps.Attach(hdps);
HBITMAP hBitmapOld= SelectBitmap(m_pDisplaydc, hdps);
BitBlt(m_pDisplaydc,0,0,320,300,m_image,0,0,SRCCOPY);
//i=0;
return true;
}