DsPack停止位置

时间:2014-02-21 18:03:03

标签: delphi dspack

我需要通过DsPack从StartPosition到EndPosition播放一些视频。我编写了一段简单的代码,允许指定StartPosition:

  FilterGraph1.Active := true;
  VideoWindow1.FilterGraph:= FilterGraph1;
  FilterGraph1.RenderFile('C:\Users\idsa\Documents\ENGLISH_2\ENGLISH_2\0001\0.avi');
  FilterGraph1.Position := 10000;
  FilterGraph1.Play;

但是如何指定StopPosition?

1 个答案:

答案 0 :(得分:1)

感谢 FreeConsulting 提示。这是最终的代码。

uses DirectShow9;

...

procedure TForm1.FormShow(Sender: TObject);
var
  MediaSeeking: IMediaSeeking;
  Start: Int64;
  Stop: Int64;
begin
  FilterGraph1.Active := true;
  VideoWindow1.FilterGraph:= FilterGraph1;
  FilterGraph1.RenderFile('fileName');
  FilterGraph1.QueryInterface(IMediaSeeking, MediaSeeking);

  Start := 0;
  Stop := 10 * 10000000;

  MediaSeeking.SetPositions(Start, AM_SEEKING_AbsolutePositioning, Stop, AM_SEEKING_AbsolutePositioning);

  FilterGraph1.Play;
end;