ImageEn, unit ieds

TIEDirectShow.GetAverageTimePerFrame

TIEDirectShow.GetAverageTimePerFrame


Declaration

function GetAverageTimePerFrame(): int64;


Description

Returns, when available, the number of milliseconds for each frame.


Example

function AverageTimePerFrameForFile(const Filename: string): int64;
var
  dshow: TIEDirectShow;
begin
  Result := -1;
  dshow := TIEDirectShow.Create;
  try
    dshow.FileInput := AnsiString(FileName);
    dshow.EnableSampleGrabber := true;
    dshow.Connect;
    dshow.Pause;

    dshow.TimeFormat := tfTime;
    if dshow.Duration = 0 then
      exit;
    Result := dshow.GetAverageTimePerFrame;
    dshow.Disconnect;
  finally
    FreeAndNil(dshow);
  end;
end;