Z
zhenh
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.FormCreate(Sender: TObject);
var
i:integer;
begin
SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
if sysdev.CountFilters>0 then
for i:=0 to sysdev.CountFilters-1do
begin
combobox1.Items.Text:=SysDev.Filters.FriendlyName;
combobox1.ItemIndex:=i;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FilterGraph1.ClearGraph;
FilterGraph1.Active := false;
Filter1.BaseFilter.Moniker := SysDev.GetMoniker(combobox1.ItemIndex);
FilterGraph1.Active := true;
with FilterGraph1 as ICaptureGraphBuilder2do
begin
if Filter1.BaseFilter.DataLength > 0 then
RenderStream(@PIN_CATEGORY_PREVIEW, nil, Filter1 as IBaseFilter,
nil , VideoWindow1 as IBaseFilter);
// Connect Video capture streams
if Filter1.FilterGraph <> nil then
RenderStream(@PIN_CATEGORY_CAPTURE, nil, Filter1 as IBaseFilter,
nil, VideoWindow1 as IBaseFilter);
end;
FilterGraph1.Play;
end;
var
i:integer;
begin
SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
if sysdev.CountFilters>0 then
for i:=0 to sysdev.CountFilters-1do
begin
combobox1.Items.Text:=SysDev.Filters.FriendlyName;
combobox1.ItemIndex:=i;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FilterGraph1.ClearGraph;
FilterGraph1.Active := false;
Filter1.BaseFilter.Moniker := SysDev.GetMoniker(combobox1.ItemIndex);
FilterGraph1.Active := true;
with FilterGraph1 as ICaptureGraphBuilder2do
begin
if Filter1.BaseFilter.DataLength > 0 then
RenderStream(@PIN_CATEGORY_PREVIEW, nil, Filter1 as IBaseFilter,
nil , VideoWindow1 as IBaseFilter);
// Connect Video capture streams
if Filter1.FilterGraph <> nil then
RenderStream(@PIN_CATEGORY_CAPTURE, nil, Filter1 as IBaseFilter,
nil, VideoWindow1 as IBaseFilter);
end;
FilterGraph1.Play;
end;