从网上下了M3JPEG32.dll,安装之后,视频编解码器中能够看到。
代码如下:
m_hic = ICOpen( ICTYPE_VIDEO,
mmioFOURCC('M','J','P','G'),
ICMODE_DECOMPRESS );
memset(m_lpbiIn,0,sizeof(BITMAPINFO));
m_lpbiIn->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_lpbiIn->bmiHeader.biCompression = mmioFOURCC('M','J','P','G');
m_lpbiIn->bmiHeader.biWidth = m_tCapParam.m_bmpCap.bmiHeader.biWidth;
m_lpbiIn->bmiHeader.biHeight = m_tCapParam.m_bmpCap.bmiHeader.biHeight;
m_lpbiIn->bmiHeader.biPlanes = 1;
m_lpbiIn->bmiHeader.biBitCount = 24; m_lpbiIn->bmiHeader.biSizeImage = m_tCapParam.m_bmpCap.bmiHeader.biWidth *
m_tCapParam.m_bmpCap.bmiHeader.biHeight * 3;
m_lpbiIn->bmiHeader.biXPelsPerMeter = 0;
m_lpbiIn->bmiHeader.biYPelsPerMeter = 0;
m_lpbiIn->bmiHeader.biClrUsed = 0;
m_lpbiIn->bmiHeader.biClrImportant = 0;
memset(m_lpbiOut,0,sizeof(BITMAPINFO));
m_lpbiOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_lpbiOut->bmiHeader.biCompression = mmioFOURCC('I','4','2','0');
m_lpbiOut->bmiHeader.biWidth = m_tCapParam.m_bmpCap.bmiHeader.biWidth;
m_lpbiOut->bmiHeader.biHeight = m_tCapParam.m_bmpCap.bmiHeader.biHeight;
m_lpbiOut->bmiHeader.biPlanes = 1;
m_lpbiOut->bmiHeader.biBitCount = 16;
m_lpbiOut->bmiHeader.biSizeImage = m_tCapParam.m_bmpCap.bmiHeader.biWidth * m_tCapParam.m_bmpCap.bmiHeader.biHeight * m_lpbiOut->bmiHeader.biBitCount / 8;
m_lpbiOut->bmiHeader.biXPelsPerMeter = 0;
m_lpbiOut->bmiHeader.biYPelsPerMeter = 0;
m_lpbiOut->bmiHeader.biClrUsed = 0;
m_lpbiOut->bmiHeader.biClrImportant = 0; u32 dwRet = ::ICDecompressBegin(m_hic,m_lpbiIn,m_lpbiOut); 返回dwRet 为ICERR_BADFORMAT,请问一下,为什么会格式错误呢?
代码如下:
m_hic = ICOpen( ICTYPE_VIDEO,
mmioFOURCC('M','J','P','G'),
ICMODE_DECOMPRESS );
memset(m_lpbiIn,0,sizeof(BITMAPINFO));
m_lpbiIn->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_lpbiIn->bmiHeader.biCompression = mmioFOURCC('M','J','P','G');
m_lpbiIn->bmiHeader.biWidth = m_tCapParam.m_bmpCap.bmiHeader.biWidth;
m_lpbiIn->bmiHeader.biHeight = m_tCapParam.m_bmpCap.bmiHeader.biHeight;
m_lpbiIn->bmiHeader.biPlanes = 1;
m_lpbiIn->bmiHeader.biBitCount = 24; m_lpbiIn->bmiHeader.biSizeImage = m_tCapParam.m_bmpCap.bmiHeader.biWidth *
m_tCapParam.m_bmpCap.bmiHeader.biHeight * 3;
m_lpbiIn->bmiHeader.biXPelsPerMeter = 0;
m_lpbiIn->bmiHeader.biYPelsPerMeter = 0;
m_lpbiIn->bmiHeader.biClrUsed = 0;
m_lpbiIn->bmiHeader.biClrImportant = 0;
memset(m_lpbiOut,0,sizeof(BITMAPINFO));
m_lpbiOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_lpbiOut->bmiHeader.biCompression = mmioFOURCC('I','4','2','0');
m_lpbiOut->bmiHeader.biWidth = m_tCapParam.m_bmpCap.bmiHeader.biWidth;
m_lpbiOut->bmiHeader.biHeight = m_tCapParam.m_bmpCap.bmiHeader.biHeight;
m_lpbiOut->bmiHeader.biPlanes = 1;
m_lpbiOut->bmiHeader.biBitCount = 16;
m_lpbiOut->bmiHeader.biSizeImage = m_tCapParam.m_bmpCap.bmiHeader.biWidth * m_tCapParam.m_bmpCap.bmiHeader.biHeight * m_lpbiOut->bmiHeader.biBitCount / 8;
m_lpbiOut->bmiHeader.biXPelsPerMeter = 0;
m_lpbiOut->bmiHeader.biYPelsPerMeter = 0;
m_lpbiOut->bmiHeader.biClrUsed = 0;
m_lpbiOut->bmiHeader.biClrImportant = 0; u32 dwRet = ::ICDecompressBegin(m_hic,m_lpbiIn,m_lpbiOut); 返回dwRet 为ICERR_BADFORMAT,请问一下,为什么会格式错误呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货