我这样改了一下,但选择驱动时出错
procedure TVideoForm.OnSelectDevice(sender: TObject);
var
videostreamconfig:iamstreamconfig;
amediatype
am_media_type;
bmiheader: tagbitmapinfoheader;
begin
FilterGraph.ClearGraph;
FilterGraph.Active := false;
Filter.BaseFilter.Moniker := SysDev.GetMoniker(TMenuItem(Sender).tag);
FilterGraph.Active := true;
with FilterGraph as ICaptureGraphBuilder2do
begin
findinterface(@look_downstream_only,nil,Filter as IBaseFilter,IID_IIDivXFilterInterface,videostreamconfig);
//)2.利用Tam_media_type(directshow8)(Tammediatype(directshow9)
在这里出错 Videostreamconfig.getformat(amediatype);
case amediatype.formattype.d1 of
$05589f80:bmiheader:=pvideoinfoheader(amediatype.pbformat)^.bmiheader;
$F72A76A0:bmiheader:=pvideoinfoheader2(amediatype.pbformat)^.bmiheader;
end;
pvideoinfoheader(amediatype.pbformat)^.bmiheader.biwidth:=640;
pvideoinfoheader(amediatype.pbformat)^.bmiheader.biheight:=480;
videostreamconfig.setformat(amediatype^);
deletemediatype(amediatype);
RenderStream(nil, nil, Filter as IBaseFilter, SampleGrabber as IBaseFilter, VideoWindow as IbaseFilter);
FilterGraph.Play;
end;
end;