unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, VideoDisp, Videocap,vfw, Sockets, ACMWaveOut,
ACMWaveIn;
type
TForm1 = class(TForm)
VideoCap: TVideoCap;
VideoDisp: TVideoDisp;
btnStart: TButton;
procedure btnStartClick(Sender: TObject);
procedure VideoCapVideoStream(sender: TObject;
lpVhdr: PVIDEOHDR);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
HasVideo:Boolean;
implementation
{$R *.dfm}
procedure TForm1.btnStartClick(Sender: TObject);
Var
DevList:TStrings;
Vheader:TBitmapInfoHeader;
begin
DevList:=GetDriverList;
If DevList.Count<1 then
HasVideo:=False;
DevList.Clear;
DevList.Free;
VideoCap.DriverOpen:=False;
VideoCap.DriverIndex:=0;
Try
VideoCap.VideoPreview:=True;
Except
On ENotConnectExceptiondo
HasVideo:=False;
end;
If HasVideo then
begin
VHeader:=Videocap.BitMapInfoHeader;
VHeader.bicompression:=bi_RGB;
// Always RGB-Data
VHeader.biBitCount:= 24;
VideoCap.BitMapInfoHeader:= VHeader;
End
else
With VHeaderdo
begin
biSize:=40;
biWidth:=160;
biHeight:=120;
biPlanes:=1;
biBitCount:=24;
biCompression:=0;
biSizeImage:=57600;
biXPelsPerMeter:=0;
biYPelsPerMeter:=0;
biClrUsed:=0;
biClrImportant:=0;
end;
VideoCap.StartCapture ;
VideoDisp.Streaming:= True;
VideoDisp.BitMapInfoHeader:= VHeader;
end;
procedure TForm1.VideoCapVideoStream(sender: TObject;
lpVhdr: PVIDEOHDR);
begin
VideoDisp.DrawStream(lpVhdr^.lpData,True);
//在此怎样压缩、发送(VideoCodec在哪下载)?
end;
end.