TIEDirectShow.GetAverageTimePerFrame
Declaration
function GetAverageTimePerFrame(): Int64;
Description
Returns, when available, the average duration of each frame in 100-nanosecond units (e.g. 400000 for 25 fps). Divide by 10000 for milliseconds. Returns 0 if it is not known.
If the media type does not specify it, and the input is a file (
FileInput) that is not being written to
FileOutput, it is estimated by running the graph briefly. A stopped or paused graph is returned to its state and position afterwards (a running graph keeps running). This estimate is approximate.
Example
function AverageTimePerFrameForFile(const Filename: string): Int64;
var
dshow: TIEDirectShow;
begin
Result := -1;
dshow := TIEDirectShow.Create();
try
dshow.FileInput := 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;