在多线程中动态创建相关的VideoWindow控件,FilterGraph控件,播放一段时间后播放位置发生改变,请教一下大侠是什么原因?
本人代码如下:
if not Assigned(FFilter[FListIndex]) then
begin
FFilter[FListIndex]:=TFilterGraph.Create(APanel.pnlMain);
FFilter[FListIndex].AutoCreate:=False;
FFilter[FListIndex].GraphEdit:=False;
FFilter[FListIndex].Mode := gmNormal;
end;
if not Assigned(FVideoWindow[FListIndex]) then
FVideoWindow[FListIndex]:=TVideoWindow.Create(APanel.pnlMain);
with FVideoWindow[FListIndex] do
begin
visible:=False;
Parent:=FPanel.pnlMain; // OnMouseMove:=APanel.OnMouseMove;
BringToFront;
Left:=0;
Top:=0; Width:=APanel.pnlMain.Width;
Height:=APanel.pnlMain.Height;
// Align:=alClient;
FilterGraph:=FFilter[FListIndex];
end; if FFilter[FListIndex].Active then
FFilter[FListIndex].Active:=False;
with FFilter[FListIndex] do
begin
ClearGraph; Active:=true;
Sleep(2);
try
hr:=RenderFile(FileName);
if hr<>0 then
begin
Active:=False;
exit;
end;
except
Exit;
end;
end;
本人代码如下:
if not Assigned(FFilter[FListIndex]) then
begin
FFilter[FListIndex]:=TFilterGraph.Create(APanel.pnlMain);
FFilter[FListIndex].AutoCreate:=False;
FFilter[FListIndex].GraphEdit:=False;
FFilter[FListIndex].Mode := gmNormal;
end;
if not Assigned(FVideoWindow[FListIndex]) then
FVideoWindow[FListIndex]:=TVideoWindow.Create(APanel.pnlMain);
with FVideoWindow[FListIndex] do
begin
visible:=False;
Parent:=FPanel.pnlMain; // OnMouseMove:=APanel.OnMouseMove;
BringToFront;
Left:=0;
Top:=0; Width:=APanel.pnlMain.Width;
Height:=APanel.pnlMain.Height;
// Align:=alClient;
FilterGraph:=FFilter[FListIndex];
end; if FFilter[FListIndex].Active then
FFilter[FListIndex].Active:=False;
with FFilter[FListIndex] do
begin
ClearGraph; Active:=true;
Sleep(2);
try
hr:=RenderFile(FileName);
if hr<>0 then
begin
Active:=False;
exit;
end;
except
Exit;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货