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.
我猜测是端子没有选择的问题,因为用会声会影时要选择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.