请教有关dspack2.1视频捕获的问题!(如何设定视频输入端口 如:s端 av端 tv端) (100分)

  • 主题发起人 主题发起人 oldfly
  • 开始时间 开始时间
O

oldfly

Unregistered / Unconfirmed
GUEST, unregistred user!
请问用dspack2.1中的PlayVideoCap例子实时访问AV视频采集卡时,图像不能出来,
我猜测是端子没有选择的问题,因为用会声会影时要选择av端才行(会声会影中还有
s端等选项),请问在PlayVideoCap例子中如何做,是用什么语句?
我用的是天敏电视卡!

PlayVideoCap例子:
unit main;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, DSUtil, StdCtrls, DSPack, DirectShow, Menus;

type
TVideoForm = class(TForm)
FilterGraph: TFilterGraph;
VideoWindow: TVideoWindow;
MainMenu1: TMainMenu;
Devices: TMenuItem;
Filter: TFilter;
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
private
{ D閏larations priv閑s }
public
{ D閏larations publiques }
procedure OnSelectDevice(sender: TObject);
end;


var
VideoForm: TVideoForm;
SysDev: TSysDevEnum;
implementation

{$R *.dfm}

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);
var
CaptureGraph: ICaptureGraphBuilder2;
SourceFilter, DestFilter: IBaseFilter;
begin

FilterGraph.ClearGraph;
FilterGraph.Active := false;
Filter.BaseFilter.Moniker := SysDev.GetMoniker(TMenuItem(Sender).tag);
FilterGraph.Active := true;
FilterGraph.QueryInterface(ICaptureGraphBuilder2, CaptureGraph);
Filter.QueryInterface(IBaseFilter, SourceFilter);
VideoWindow.QueryInterface(IBaseFilter, DestFilter);
CaptureGraph.RenderStream(nil, nil, SourceFilter, nil, DestFilter);
FilterGraph.Play;
CaptureGraph := nil;
SourceFilter := nil;
DestFilter := nil;
end;


procedure TVideoForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin

SysDev.Free;
FilterGraph.ClearGraph;
FilterGraph.Active := false;
end;


end.
 
那里有dspack2.1下载我最近正在找他
 
http://www.progdigy.com/dspack/
 
你可以得到卡上的PIN脚,然后再render !
sourcefilter.findpin(s_pinname,pin_out);
以下建立filtergraph

capturegraph.connect(pin1,pin2);
capturegraph.connect(pin3,pin4);
........
........
capturegraph.render(pin_out);
 
to coolsoft:
请问:1、s_pinname如何得出?
2、pin1,pin2,pin3.....又如何得出?
我刚学directshow,请多多指教!(如可能代码再全些)
 
to oldfly:
我相信你已经安装了M$的directx8的开发库吧,其中有个graphedit.exe文件,可以帮助
你建立filtergraph,你可以加入你的filter,也就是你的捕捉卡,然后就可以看见所有PIN脚
了!
你可以sourcefilter.findpin(pwchar(widestring(s_pinname)),pin_out)来得到想要的
PIN!
pin1,pin2的方法可以由上面一样得出,只不过sourcefilter为其它的filter罢了,如avimux
,或videorender等等过滤器.
 
to coolsoft:
我运行了graphedit.exe,但还是没搞懂s_pinname怎么取值!你能给我一个实例值吗?
如:s_pinname:=?
最好是能在PlayVideoCap例子的基础上给我点实例!谢谢了。。我再加300分!呵呵!
 
to oldfly:
你已经运行了oK
1.点击工具条中的 '-口-' 样式的图标
2.弹出选择filter的窗口,
3.选持树形结构中的video capture source
4.选择你想要的capture filter(双击)
5.回到graphedit窗口,此时你可以看到一个filter的示意图,图中标有各个PIN的名称
。。。。。。
 
to coolsoft:
好象只有:模拟示频输入 Analog audio in
捕获 预览 VBI

我想做一个通用的小程序,你能不能就在PlayVideoCap例子的基础上给我一个实例啊?
 
to coolsoft:
我这样找到的pin脚对不对?下一步怎么办?
unit main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DSUtil, StdCtrls, DSPack, DirectShow, Menus, ExtCtrls,crossbar;

type
TVideoForm = class(TForm)
FilterGraph: TFilterGraph;
VideoWindow: TVideoWindow;
MainMenu1: TMainMenu;
Devices: TMenuItem;
Filter: TFilter;
Image: TImage;
SampleGrabber: TSampleGrabber;
SnapShot: TButton;
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
procedure SnapShotClick(Sender: TObject);
private
{ D閏larations priv閑s }
public
{ D閏larations publiques }
procedure OnSelectDevice(sender: TObject);
end;


var
VideoForm: TVideoForm;
SysDev: TSysDevEnum;
implementation

{$R *.dfm}

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);
var
pin1:Ipin;
begin

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

//找pin脚
FindInterface(nil,nil,Filter as IBaseFilter,IID_Ipin,pin1);
with FilterGraph as ICaptureGraphBuilder2do

RenderStream(nil, nil, Filter as IBaseFilter, SampleGrabber as IBaseFilter, VideoWindow as IbaseFilter);
FilterGraph.Play;
end;


procedure TVideoForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin

SysDev.Free;
FilterGraph.ClearGraph;
FilterGraph.Active := false;
end;


procedure TVideoForm.SnapShotClick(Sender: TObject);
begin

SampleGrabber.GetBitmap(Image.Picture.Bitmap);
end;


end.
 
你可以使用IAMcrossbar interface 来取得!
用get_pincounts来取得所有的PIN,get_crossbarpinfo 来取得PIN
再用route来启用一个PIN!!!!!!!
PhysConn_Video_SVideo类型的为S端子,
以下是类型
PhysConn_Video_Tuner = 1,
PhysConn_Video_Composite,
PhysConn_Video_SVideo,
PhysConn_Video_RGB,
PhysConn_Video_YRYBY,
PhysConn_Video_SerialDigital,
PhysConn_Video_ParallelDigital,
PhysConn_Video_SCSI,
PhysConn_Video_AUX,
PhysConn_Video_1394,
PhysConn_Video_USB,
PhysConn_Video_VideoDecoder,
PhysConn_Video_VideoEncoder,
PhysConn_Video_SCART,

PhysConn_Audio_Tuner = 4096,
PhysConn_Audio_Line,
PhysConn_Audio_Mic,
PhysConn_Audio_AESDigital,
PhysConn_Audio_SPDIFDigital,
PhysConn_Audio_SCSI,
PhysConn_Audio_AUX,
PhysConn_Audio_1394,
PhysConn_Audio_USB,
PhysConn_Audio_AudioDecoder,

 
to coolsoft:
执行中出现Interface not supported 错误!

unit main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DSUtil, StdCtrls, DSPack, DirectShow, Menus, ExtCtrls,crossbar;

type
TVideoForm = class(TForm)
FilterGraph: TFilterGraph;
VideoWindow: TVideoWindow;
MainMenu1: TMainMenu;
Devices: TMenuItem;
Filter: TFilter;
Image: TImage;
SampleGrabber: TSampleGrabber;
SnapShot: TButton;
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
procedure SnapShotClick(Sender: TObject);
private
{ D閏larations priv閑s }
public
{ D閏larations publiques }
procedure OnSelectDevice(sender: TObject);
end;


var
VideoForm: TVideoForm;
SysDev: TSysDevEnum;
implementation
uses activex;

{$R *.dfm}

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);
var
pin1:Ipin;
pcount1,pcount2:integer;
begin

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


with FilterGraph as IAMCrossbardo
//执行到这句出现Interface not supported 错误!
get_PinCounts(pcount1,pcount2);

with FilterGraph as ICaptureGraphBuilder2do

FindInterface(nil,nil,Filter as IBaseFilter,IID_Ipin,pin1);
with FilterGraph as ICaptureGraphBuilder2do

RenderStream(nil, nil, Filter as IBaseFilter, SampleGrabber as IBaseFilter, VideoWindow as IbaseFilter);
FilterGraph.Play;
end;


procedure TVideoForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin

SysDev.Free;
FilterGraph.ClearGraph;
FilterGraph.Active := false;
end;


procedure TVideoForm.SnapShotClick(Sender: TObject);
begin

SampleGrabber.GetBitmap(Image.Picture.Bitmap);
end;


end.
 
写法有问题!

sourcefilter.queryinterface(iid_iamcrossbar,mycrossbar);
sourcefilter为捕捉卡
或者你可以建立一个clsid_crossbar的propertypage
createcomobject();来取得
再显示这个属性页!
 
CLSID_CrossbarFilterPropertyPage
选建立crossbarfilter,
filter_crossbar:ibasefilter;
tmp_crossbar:iamcrossbar;
filter_crossbarfilter:=createcomobject(clsid_crossbarfilterpropertypage) as ibasefilter;
//可以直接用showfilterpropertypage(filter_corssbarfilter)来显示对话框;
filter_crossbarfilter.queryinterface(iid_iamcrossbar,tmp_crossbar);
再根据上贴所说的方法!
 
还是出现Interface not supported 错误!
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DSUtil, StdCtrls, DSPack, DirectShow, Menus, ExtCtrls,comobj;

var
SysDev: TSysDevEnum;
filter_crossbar:IBaseFilter;
tmp_crossbar:iamcrossbar;
begin

SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
SysDev.SelectIndexCategory(0);//选择 10Moons TV Master Capture 驱动
FilterGraph.ClearGraph;
FilterGraph.Active := false;
Filter.BaseFilter.Moniker := SysDev.GetMoniker(TMenuItem(Sender).tag);
Filter.FilterGraph := FilterGraph;
FilterGraph.Active := true;
//下面这句出现Interface not supported 错误!
filter_crossbar:=createcomobject(CLSID_CrossbarFilterPropertyPage) as ibasefilter;
ShowFilterPropertyPage(Self.Handle, filter_crossbar);

我用的卡是天敏电视卡!
1、TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
SysDev.SelectIndexCategory(0);

//只可选择 10Moons TV Master Capture 驱动
2、TSysDevEnum.Create(CLSID_ActiveMovieCategories);
SysDev.SelectIndexCategory(16);
//选择 WDM 流十字型设备后,待选的是 10Moons TV Master crossbar 驱动



 
CLSID_CrossbarFilterPropertyPage
选建立crossbarfilter,
filter_crossbar:ibasefilter;
tmp_crossbar:iamcrossbar;
filter_crossbarfilter:=createcomobject(clsid_crossbarfilterpropertypage) as ibasefilter;
//可以直接用showfilterpropertypage(filter_corssbarfilter)来显示对话框;
//你也可以用
graphbuilder:Igraphbuilder2;
filtergraph.queryinterface(IGraphbuilder2,graphbuilder);
graphbuilder.findinterface(IID_Iamcrossbar,tmp_crossbar);
.........
再进行操作!
 
或者你可以先得到它的AM_KSCATEGORY_CROSSBAR
TSysDevEnum.Create(AM_KSCATEGORY_CROSSBAR);
SysDev.SelectIndexCategory(0);

得到crossbarfilter
再来进行操作!
三种方法都可以的!
 
问题解决了!
谢谢coolsoft了!!!
等我把两个贴子的分给你!再加你300分!
 
后退
顶部