delphidspack

DsPack Stop Position


I need to play some video via DsPack from StartPosition to EndPosition. I have written a simple piece of code that allows to specify 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;

But how can I specify StopPosition?


Solution

  • Thanks FreeConsulting for a hint. Here is the final code.

    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;