小弟在网上看到用IAMStreamConfig接口实现的方法,代码如下:
var
VideoStreamConfig : IAMStreamConfig;
AMMEdiaType : PAMMediaType;
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_IAMStreamConfig, VideoStreamConfig);
VideoStreamConfig.GetFormat(AMMEdiaType);
PVideoInfoHeader(AMMEdiaType.pbFormat)^.bmiHeader.biWidth:= 768;
PVideoInfoHeader(AMMEdiaType.pbFormat)^.bmiHeader.biHeight:= 576;
AMMEdiaType.subtype := MEDIASUBTYPE_RGB24;
VideoStreamConfig.SetFormat(AMMEdiaType^);
DeleteMediaType(AMMEdiaType);
RenderStream(@PIN_CATEGORY_PREVIEW, nil, Filter as IBaseFilter, SampleGrabber as IBaseFilter, VideoWindow as IbaseFilter);
end;
FilterGraph.Play;
============
我用ShowMessage看了一下,bmiHeader.biWidth和bmiHeader.biHeight倒设置成功了, 但效果一样。如果把VideoStreamConfig.SetFormat(AMMEdiaType^)一句注释掉,bmiHeader.biWidth和bmiHeader.biHeight的值是默认值(320*240)。为什么设置成功了,但不起作用呢?