G
guoming790128
Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位大侠,我在使用DSPACK时,在动态创建TFilterGraph和TVideoWindow时,当把它们俩的实列绑定时VideoWindow2.FilterGraph:=FilterGraph2;在FilterGraph2.Play;会出错,不知为何,望解答.列子如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DSPack, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
OpenDialog1: TOpenDialog;
FilterGraph1: TFilterGraph;
VideoWindow1: TVideoWindow;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
if not FilterGraph1.Active then
FilterGraph1.Active:=true;
FilterGraph1.RenderFile(OpenDialog1.FileName);
FilterGraph1.Play;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
FilterGraph2:TFilterGraph;
VideoWindow2: TVideoWindow;
DSVideoWindowEx22: TDSVideoWindowEx2;
begin
if OpenDialog1.Execute then
begin
FilterGraph2:=TFilterGraph.Create(self);
VideoWindow2:=TVideoWindow.Create(self) ;
VideoWindow2.ParentWindow:=form1.Handle;
VideoWindow2.FilterGraph:=FilterGraph2;
if not FilterGraph2.Active then
FilterGraph2.Active:=true;
FilterGraph2.RenderFile(OpenDialog1.FileName);
FilterGraph2.Play;
end;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DSPack, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
OpenDialog1: TOpenDialog;
FilterGraph1: TFilterGraph;
VideoWindow1: TVideoWindow;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
if not FilterGraph1.Active then
FilterGraph1.Active:=true;
FilterGraph1.RenderFile(OpenDialog1.FileName);
FilterGraph1.Play;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
FilterGraph2:TFilterGraph;
VideoWindow2: TVideoWindow;
DSVideoWindowEx22: TDSVideoWindowEx2;
begin
if OpenDialog1.Execute then
begin
FilterGraph2:=TFilterGraph.Create(self);
VideoWindow2:=TVideoWindow.Create(self) ;
VideoWindow2.ParentWindow:=form1.Handle;
VideoWindow2.FilterGraph:=FilterGraph2;
if not FilterGraph2.Active then
FilterGraph2.Active:=true;
FilterGraph2.RenderFile(OpenDialog1.FileName);
FilterGraph2.Play;
end;
end;
end.