以下改自 DSPack/Demos/D6-D7/SampleGrabber, 调试通过:
with (FilterGraph as ICaptureGraphBuilder2) do
begin
CheckDSError(RenderStream(@PIN_CATEGORY_PREVIEW, nil, Filter as IBaseFilter, nil, VideoWindow as IbaseFilter));
if Succeeded(FindInterface(@PIN_CATEGORY_PREVIEW, @MEDIATYPE_Video,
Filter as IBaseFilter, IID_IAMStreamConfig, pConfig)) then
begin
pConfig.GetFormat(pmt);
pvih := pmt.pbFormat;
pvih.bmiHeader.biWidth := 640;
pvih.bmiHeader.biHeight := 480;
pvih.bmiHeader.biSizeImage := 480 * BytesPerScanline(640, pvih.bmiHeader.biBitCount, 32);
if Succeeded(pConfig.SetFormat(pmt^)) then
begin
Caption := '640 * 480';
end;
DeleteMediaType(pmt);
end;
end;