2015년 9월 1일 화요일

video rendering with c++

buffer is PIX_FMT_BGR24 data
m_flipview is dc for rendering

uchar buf[sizeof(BITMAPINFO) + 256 * 4];
BITMAPINFO* bmi = (BITMAPINFO*)buf;
BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);
memset(bmih, 0, sizeof(*bmih));
bmih->biSize = sizeof(BITMAPINFOHEADER);
bmih->biWidth = m_pCodec[DevID]->m_nWidth;
bmih->biHeight = -m_pCodec[DevID]->m_nHeight;
bmih->biPlanes = 1;
bmih->biBitCount = 24;
bmih->biCompression = BI_RGB;

HDC hdc = m_pDlg->m_flipview.GetDC()->m_hDC;
::SetStretchBltMode(hdc, COLORONCOLOR);
::StretchDIBits(hdc, 0, 0, 640, 360,
0, 0, m_pCodec[DevID]->m_nWidth, m_pCodec[DevID]->m_nHeight,
buffer, bmi,
DIB_RGB_COLORS, SRCCOPY);

댓글 없음: