要实现实时解压缩视频数据的功能,一般用什么方法比较好?服务端捕捉图像后,将每帧的数据以BYTE格式通过广播式的socket发出,客户端接受并显示。
考虑使用VCM来做。
服务端:
BITMAPINFOHEADER bih;
HIC hIC; hIC = ICLocate (ICTYPE_VIDEO, 0L, (LPBITMAPINFOHEADER) &bih,
NULL, ICMODE_FASTCOMPRESS);
... if (ICCompressBegin(hICompressor, lpbiIn,lpbiOut) == ICERR_OK)
{
if (ICCompress(hICompressor, 0, lpbiOut, lpOut, lpbiIn,lpIn,
&dwCkID, &dwCompFlags, 1, 0, 0, NULL, NULL) == ICERR_OK)
{
size = ICCompressGetSize(hICompressor,lpbiIn, lpbiOut);
dvideo.SendVideoData(lpOut,size);
}
else
{
AfxMessageBox("Error in Compression!!", MB_OK);
}
ICCompressEnd(hICompressor); // terminate compression
}
else
{
// Handle the error identifying the unsupported format.
AfxMessageBox("Unsupported fomat!", MB_OK);
}
在ICLocate中第四个参数设为NULL,msdn上说会自动寻找配合bih的压缩图像格式,可也不知道这个格式是什么。
用ICCompressGetSize函数来获得压缩过的字节数,下一个函数需要使用。
在ICCompress中倒数第五个参数,用来帧计数的参数,设为1。因为只需要压缩当前帧的数据。不知道这样可不可以。客户端:
用ICLocate,ICDecompress来解压缩接收到的BYTE数据。因为不能获得输入数据的BITMAPINFOHEADER结构,也不知道如何选择合适的解压缩器,因而不能成功。 如果有别的更好的办法,该怎么做呢?
考虑使用VCM来做。
服务端:
BITMAPINFOHEADER bih;
HIC hIC; hIC = ICLocate (ICTYPE_VIDEO, 0L, (LPBITMAPINFOHEADER) &bih,
NULL, ICMODE_FASTCOMPRESS);
... if (ICCompressBegin(hICompressor, lpbiIn,lpbiOut) == ICERR_OK)
{
if (ICCompress(hICompressor, 0, lpbiOut, lpOut, lpbiIn,lpIn,
&dwCkID, &dwCompFlags, 1, 0, 0, NULL, NULL) == ICERR_OK)
{
size = ICCompressGetSize(hICompressor,lpbiIn, lpbiOut);
dvideo.SendVideoData(lpOut,size);
}
else
{
AfxMessageBox("Error in Compression!!", MB_OK);
}
ICCompressEnd(hICompressor); // terminate compression
}
else
{
// Handle the error identifying the unsupported format.
AfxMessageBox("Unsupported fomat!", MB_OK);
}
在ICLocate中第四个参数设为NULL,msdn上说会自动寻找配合bih的压缩图像格式,可也不知道这个格式是什么。
用ICCompressGetSize函数来获得压缩过的字节数,下一个函数需要使用。
在ICCompress中倒数第五个参数,用来帧计数的参数,设为1。因为只需要压缩当前帧的数据。不知道这样可不可以。客户端:
用ICLocate,ICDecompress来解压缩接收到的BYTE数据。因为不能获得输入数据的BITMAPINFOHEADER结构,也不知道如何选择合适的解压缩器,因而不能成功。 如果有别的更好的办法,该怎么做呢?
http://search.csdn.net/Expert/topic/152/152883.xml?temp=.6373255
ICLocate (ICTYPE_VIDEO,mmioFOURCC('D','I','V','3')(或mmioFOURCC('M','P','4','2')) , ...