P
poplarni
Unregistered / Unconfirmed
GUEST, unregistred user!
//determin the ouput format
self.m_OutFormatSize := VFW.ICDecompressGetFormatSize(self.m_CV.hic,
@self.m_InInfo.bmiHeader);
GetMem(m_pOutInfo, m_OutFormatSize);
zeromemory(m_pOutInfo, m_OutFormatSize);
VFW.ICDecompressGetFormat(self.m_CV.hic, @self.m_InInfo,
@self.m_pOutInfo^.bmiHeader);
WriteLn(format('out format:%d', [self.m_pOutInfo.bmiHeader.biHeight]));
self.m_OutBufSize := self.m_pOutInfo.bmiHeader.biSizeImage;
GetMem(m_pOutBuf, m_OutBufSize);
ZeroMemory(m_pOutBuf, m_OutBufSize);
ICSendMessage(m_CV.hic, $60C9, $F7329ACE, $ACDEAEA2);
m_cv.dwFlags := ICMF_COMPVARS_VALID;
VFW.ICDecompressbegin
(self.m_CV.hic, @self.m_InInfo,
@self.m_pOutInfo^.bmiHeader);
//获取数据解压
Socket.ReceiveBuf(VideoData, SizeOf(TVIDEO_DATA));
Inc(m_RecvLength, VideoData.nUsedSize);
if (VideoData.nUsedSize > 0) and (VideoData.nUsedSize < 4084) then
Ret := VFW.ICDecompress(m_CV.hic, 0, @m_InInfo.bmiHeader, @VideoData.Buf,
@m_pOutInfo.bmiHeader, m_pOutBuf);
//绘制
dc := GetDc(p.Handle);
h := VFW.DrawDibOpen();
Self.m_cv.lQ := 100;
VFW.DrawDibDraw(h, dc, 0, 0, m_pOutInfo.bmiHeader.biWidth,
m_pOutInfo.bmiHeader.biHeight, @m_pOutInfo^.bmiHeader, Buf, 0, 0,
m_pOutInfo.bmiHeader.biWidth,
m_pOutInfo.bmiHeader.biHeight, DDF_NOTKEYFRAME);
DrawDibClose(h);
ReleaseDC(p.Handle, dc);
这是在网上看到的vfw视频传输解压缩代码,我用在服务器端,有个udpread事件,以上代码该怎么用进去啊?开始事件还是udpread事件?
我菜鸟一个,不要骂我。还有就是drawdibdraw里面的buf是什么啊?之前也没出现过。
原来不解压显示的时候udpread事件代码如下,可以讲视频保存为mpeg格式。
begin
try
MyBmp := TBitmap.Create;
MyJpg := TJPEGImage.Create;
MyJpg.LoadFromStream(adata);
MyBmp.Assign(MyJpg);
if savempeg.Checked then
begin
MyMpeg.AddIImage(MyBmp);
MyMpeg.Keep(2);
end;
Image1.Picture.Bitmap.Assign(MyBmp);
MyJpg.Free;
MyBmp.Free;
except
end;
self.m_OutFormatSize := VFW.ICDecompressGetFormatSize(self.m_CV.hic,
@self.m_InInfo.bmiHeader);
GetMem(m_pOutInfo, m_OutFormatSize);
zeromemory(m_pOutInfo, m_OutFormatSize);
VFW.ICDecompressGetFormat(self.m_CV.hic, @self.m_InInfo,
@self.m_pOutInfo^.bmiHeader);
WriteLn(format('out format:%d', [self.m_pOutInfo.bmiHeader.biHeight]));
self.m_OutBufSize := self.m_pOutInfo.bmiHeader.biSizeImage;
GetMem(m_pOutBuf, m_OutBufSize);
ZeroMemory(m_pOutBuf, m_OutBufSize);
ICSendMessage(m_CV.hic, $60C9, $F7329ACE, $ACDEAEA2);
m_cv.dwFlags := ICMF_COMPVARS_VALID;
VFW.ICDecompressbegin
(self.m_CV.hic, @self.m_InInfo,
@self.m_pOutInfo^.bmiHeader);
//获取数据解压
Socket.ReceiveBuf(VideoData, SizeOf(TVIDEO_DATA));
Inc(m_RecvLength, VideoData.nUsedSize);
if (VideoData.nUsedSize > 0) and (VideoData.nUsedSize < 4084) then
Ret := VFW.ICDecompress(m_CV.hic, 0, @m_InInfo.bmiHeader, @VideoData.Buf,
@m_pOutInfo.bmiHeader, m_pOutBuf);
//绘制
dc := GetDc(p.Handle);
h := VFW.DrawDibOpen();
Self.m_cv.lQ := 100;
VFW.DrawDibDraw(h, dc, 0, 0, m_pOutInfo.bmiHeader.biWidth,
m_pOutInfo.bmiHeader.biHeight, @m_pOutInfo^.bmiHeader, Buf, 0, 0,
m_pOutInfo.bmiHeader.biWidth,
m_pOutInfo.bmiHeader.biHeight, DDF_NOTKEYFRAME);
DrawDibClose(h);
ReleaseDC(p.Handle, dc);
这是在网上看到的vfw视频传输解压缩代码,我用在服务器端,有个udpread事件,以上代码该怎么用进去啊?开始事件还是udpread事件?
我菜鸟一个,不要骂我。还有就是drawdibdraw里面的buf是什么啊?之前也没出现过。
原来不解压显示的时候udpread事件代码如下,可以讲视频保存为mpeg格式。
begin
try
MyBmp := TBitmap.Create;
MyJpg := TJPEGImage.Create;
MyJpg.LoadFromStream(adata);
MyBmp.Assign(MyJpg);
if savempeg.Checked then
begin
MyMpeg.AddIImage(MyBmp);
MyMpeg.Keep(2);
end;
Image1.Picture.Bitmap.Assign(MyBmp);
MyJpg.Free;
MyBmp.Free;
except
end;