0

我需要通过 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?

4

1 回答 1

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;
于 2014-02-21T19:40:52.873 回答