夜
夜
Unregistered / Unconfirmed
GUEST, unregistred user!
使用如下代码可以设置摄像头的分辨率,但如果播放视频文件时,更改分辨率却出错了。
这个问题可以有1200分。
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
bmp:TBitmap;
vcf:IAMStreamConfig;
pvihVideoInfoHeader;
aMediaTypeAMMediaType;
cgb:ICaptureGraphBuilder2;
begin
FilterGraph1.ClearGraph;
FilterGraph1.Active := False;
FilterGraph1.Active := True;
FilterGraph1.RenderFile('E:/Music/vcd/AVSEQ09.DAT');
FilterGraph1.Play;
cgb:=FilterGraph1 as ICaptureGraphBuilder2;//异常:Interface not supported.
if Succeeded(cgb.FindInterface(@PIN_CATEGORY_VIDEOPORT_VBI,nil,Filter1 as IBaseFilter,IAMStreamConfig,vcf)) then
begin
New(aMediaType);
vcf.GetFormat(aMediaType);
pvih:=PVideoInfoHeader(aMediaType.pbFormat);
pvih.bmiheader.biwidth:=160;
pvih.bmiheader.biheight:=120;
pVih.bmiHeader.biSizeImage:=160*120*pVih.bmiHeader.biBitCount div 8;//必要
vcf.SetFormat(aMediaType^);
DeleteMediaType(aMediaType);
end;
with(Self.FilterGraph1 as ICaptureGraphBuilder2)do
begin
RenderStream(@PIN_CATEGORY_CAPTURE, nil, Self.Filter1 as IBaseFilter,
Self.SampleGrabber1 as IBaseFilter, Self.VideoWindow1 as IbaseFilter);
end;
Self.FilterGraph1.Play;
bmp:=TBitmap.Create;
try
Self.SampleGrabber1.GetBitmap(bmp);
Self.Image1.Picture.Graphic:=bmp;
Self.Memo1.Lines.Add(Format('W:%D H:%D',[bmp.Width,bmp.Height]));
finally
bmp.Free;
end;
end;
这个问题可以有1200分。
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
bmp:TBitmap;
vcf:IAMStreamConfig;
pvihVideoInfoHeader;
aMediaTypeAMMediaType;
cgb:ICaptureGraphBuilder2;
begin
FilterGraph1.ClearGraph;
FilterGraph1.Active := False;
FilterGraph1.Active := True;
FilterGraph1.RenderFile('E:/Music/vcd/AVSEQ09.DAT');
FilterGraph1.Play;
cgb:=FilterGraph1 as ICaptureGraphBuilder2;//异常:Interface not supported.
if Succeeded(cgb.FindInterface(@PIN_CATEGORY_VIDEOPORT_VBI,nil,Filter1 as IBaseFilter,IAMStreamConfig,vcf)) then
begin
New(aMediaType);
vcf.GetFormat(aMediaType);
pvih:=PVideoInfoHeader(aMediaType.pbFormat);
pvih.bmiheader.biwidth:=160;
pvih.bmiheader.biheight:=120;
pVih.bmiHeader.biSizeImage:=160*120*pVih.bmiHeader.biBitCount div 8;//必要
vcf.SetFormat(aMediaType^);
DeleteMediaType(aMediaType);
end;
with(Self.FilterGraph1 as ICaptureGraphBuilder2)do
begin
RenderStream(@PIN_CATEGORY_CAPTURE, nil, Self.Filter1 as IBaseFilter,
Self.SampleGrabber1 as IBaseFilter, Self.VideoWindow1 as IbaseFilter);
end;
Self.FilterGraph1.Play;
bmp:=TBitmap.Create;
try
Self.SampleGrabber1.GetBitmap(bmp);
Self.Image1.Picture.Graphic:=bmp;
Self.Memo1.Lines.Add(Format('W:%D H:%D',[bmp.Width,bmp.Height]));
finally
bmp.Free;
end;
end;