OnEndOfFile event on TocvFileSource does not fire when video completes.
Think this could be the solution but still not reliable for some reason
procedure TocvFileSource.SetEnabled (Value: Boolean);
Var
pFileName: PAnsiChar;
begin
if FEnabled <> Value then begin
if not(csDesigning in ComponentState) then begin
if Assigned (FCapture) and FEnabled then begin
(FSourceThread as TocvCaptureThread).Capture := nil;
cvReleaseCapture (FCapture);
FCapture := Nil;
end;
if Value and FileExists (FileName) then begin
pFileName := PAnsiChar (@(AnsiString(FileName)[1]));
FCapture := cvCreateFileCapture (pFileName);
if Assigned (FCapture) then begin
(FSourceThread as TocvCaptureThread).Capture := FCapture;
(FSourceThread as TocvCaptureThread).OnNoData := OnNoData;// Here is the addition
FSourceThread.Resume;
end;
end;
end;
FEnabled := Value;
end;
end;
OnEndOfFile event on TocvFileSource does not fire when video completes.
Think this could be the solution but still not reliable for some reason
procedure TocvFileSource.SetEnabled (Value: Boolean); Var pFileName: PAnsiChar; begin if FEnabled <> Value then begin if not(csDesigning in ComponentState) then begin if Assigned (FCapture) and FEnabled then begin (FSourceThread as TocvCaptureThread).Capture := nil; cvReleaseCapture (FCapture); FCapture := Nil; end; if Value and FileExists (FileName) then begin pFileName := PAnsiChar (@(AnsiString(FileName)[1])); FCapture := cvCreateFileCapture (pFileName); if Assigned (FCapture) then begin (FSourceThread as TocvCaptureThread).Capture := FCapture; (FSourceThread as TocvCaptureThread).OnNoData := OnNoData;// Here is the addition FSourceThread.Resume; end; end; end; FEnabled := Value; end; end;