小弟在做视频采集,这是我看别人的代码,但是到这得到了帧数据,但是怎么显示出来!!!(200分)

F

fan27

Unregistered / Unconfirmed
GUEST, unregistred user!
function capVideoStreamCallback(HWND:hWnd;
lpVHdr:pVIDEOHDR):longint;stdcall;
var
DataPoint:^byte;
//DibLen:integer;
begin

//转换从回调函数中得到的指针
VideoStr:=PVIDEOHDR(lpVHdr);
//得到返回的数据大小
//DibLen:=VideoStr^.dwBufferLength;
GetMem(DataPoint,64000);
//将帧数据COPY到一个内存中,注意DATAPOINT要先分配空间
CopyMemory(DataPoint,VideoStr^.lpData,videostr^.dwBufferLength);
end;

 
使用videocapture控件
 
用专门的控件方便
 
procedure FrameToBitmap(Bitmap: TBitmap;
FrameBuffer: pointer;
BitmapInfo: TBitmapInfo);
begin

if bitmapInfo.bmiHeader.BiCompression = bi_RGB then

with Bitmapdo

setDiBits(canvas.handle, handle, 0, BitmapInfo.bmiHeader.biheight,
FrameBuffer, BitmapInfo, DIB_RGB_COLORS);
end;


调用方式:
var
bmp: TBitmap;
info: TBitmapInfo;
begin

...
FrameToBitmap(bmp, lpvhdr^.lpData, info);
...
end;
 
下载以下文件:
http://user1.7host.com/tjmovieclub/forum/image/VOIP.RAR.PNG
这是RAR文件
下载后去掉.PNG后缀即可。


VideoDisp.DrawStream(VideoStr^.lpData,KeyFrame);
 
多人接受答案了。
 
顶部