用Direct Show的DSPACK采集图像后抓图,为什么只能抓360*288大小的图,能更大吗?(100分)

  • 主题发起人 主题发起人 sntmpl
  • 开始时间 开始时间
S

sntmpl

Unregistered / Unconfirmed
GUEST, unregistred user!
用Direct Show的DSPACK采集图像后抓图,为什么只能抓360*288大小的图,能更大吗?
 
你用的是dspack吗?
 
是!!!
 
你用过里面的asf capture吗?
怎么将声音录进去?
 
没用过,你能解答我上面的问题吗
asf capture在哪
 
asf capture在dspack2.3 的demos里面
 
我用的是dspack2.01,对了,你的2.3可以给我一个吗
用Direct Show的DSPACK采集图像后抓图,为什么只能抓360*288大小的图,能更大吗?
 
http://www.progdigy.com/dspack/ 可以下载dspack2.3
把你的QQ告诉我,我们聊聊
我的QQ:28784287
 
http://kuga.51.net/
 
为什么没人回答?????[:(]
 
看不下去了!
给你一段代码!!!
利用Iamstreamconfig代码
1.得到Iamstreamconfig接口
var
videostreamconfig:iamstreamconfig;
capturegraphbuilder2.findinterface(@look_downstream_only,nil,source,IID_IAMsteamconfig,videostreamconfig);
)2.利用Tam_media_type(directshow8)(Tammediatype(directshow9)
var
amediatype:pam_media_type;
Videostreamconfig.getformat(amediatype);
case amediatype.formattype.d1 of
$05589f80:bmiheader:=pvideoinfoheader(amediatype.pbformat)^.bmiheader;
$F72A76A0:bmiheader:=pvideoinfoheader2(amediatype.pbformat)^.bmiheader;
pvideoinfoheader(amediatype.pbformat)^.bmiheader.biwidth:=W;
pvideoinfoheader(amediatype.pbformat)^.bmiheader.biheight:=h;
videostreamconfig.setformat(amediatype^);
deletemediatype(amediatype);
给分哟!
 
COOLSOFT兄:请孰小弟才疏学浅。怎么用啊!!!!!!!!如何加到代码中啊!!!!!!
 
不会吧,你在run一个filtergraph之前,调用这代码!
w,是要设置的宽度,H是你要设置的高度
你可以用filtergraph来queryinterface(Icapturegraphbuiler2)得到
Icapturegraphbuilder2接口.
然后剩下的就简单了,照 上面的写就行了!
这段代码绝对没问题!!!!!
 
不好意思,我看不明白,这样吧,有这样的代码你帮助我看看好吗
procedure TVideoForm.FormCreate(Sender: TObject);
var
i: integer;
Device: TMenuItem;
begin

SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
if SysDev.CountFilters > 0 then

for i := 0 to SysDev.CountFilters - 1do

begin

Device := TMenuItem.Create(Devices);
Device.Caption := SysDev.Filters.FriendlyName;
Device.Tag := i;
Device.OnClick := OnSelectDevice;
Devices.Add(Device);
end;

end;


procedure TVideoForm.OnSelectDevice(sender: TObject);
begin

FilterGraph.ClearGraph;
FilterGraph.Active := false;
Filter.BaseFilter.Moniker := SysDev.GetMoniker(TMenuItem(Sender).tag);
FilterGraph.Active := true;
with FilterGraph as ICaptureGraphBuilder2do

RenderStream(nil, nil, Filter as IBaseFilter, SampleGrabber as IBaseFilter, VideoWindow as IbaseFilter);
FilterGraph.Play;
end;
 
复制以下的过程!~!!!!!
procedure TVideoForm.OnSelectDevice(sender: TObject);
var
videostreamconfig:iamstreamconfig;
amediatype:pam_media_type;

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,source,IID_IAMsteamconfig,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;
pvideoinfoheader(amediatype.pbformat)^.bmiheader.biwidth:=W;

pvideoinfoheader(amediatype.pbformat)^.bmiheader.biheight:=h;

videostreamconfig.setformat(amediatype^);
deletemediatype(amediatype);
RenderStream(nil, nil, Filter as IBaseFilter, SampleGrabber as IBaseFilter, VideoWindow as IbaseFilter);
FilterGraph.Play;

end;


end;
 
findinterface(@look_downstream_only,nil,source,IID_IAMsteamconfig,videostreamconfig);
运行时出错
我这样改对吗
findinterface(@look_downstream_only,nil,Filter as IBaseFilter,IID_IIDivXFilterInterface,videostreamconfig);
 
我这样改了一下,但选择驱动时出错
procedure TVideoForm.OnSelectDevice(sender: TObject);
var
videostreamconfig:iamstreamconfig;
amediatype:pam_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;
 
我试了一下是下面的这句话有问题
findinterface(@look_downstream_only,nil,Filter as IBaseFilter,IID_IPersistStream,videostreamconfig)
这句话加载不成功,可是为什么,怎么改呢
 
source是你的捕捉卡!
videostreamconfig必须定义!
Videostreamconfig:Iamstreamconfig;
findinterface(@look_downstream_only,nil,source as Ibasefilter,IID_IAMsteamconfig,videostreamconfig);
如果出错说明你的卡不支持Iamstreamconfig接口!!!
你用的是什么捕捉卡?
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部