| ImageEn, unit ImageEnView |
|
TImageEnView.OnMediaFoundationNotify
Declaration
property OnMediaFoundationNotify: TIEMediaFoundationNotifyEvent;
Description
Occurs whenever Media Foundation sends a new frame or a notification to TImageEnView.
NotifyType is one of:
iemfnFrame (a new sample is available),
iemfnStartingCapture,
iemfnEndOfStream or
iemfnError (capture stopped due to an error, see
LastError).
Example
// handler for TImageEnView.OnMediaFoundationNotify event
procedure TForm1.ImageEnView1MediaFoundationNotify(Sender, MediaFoundationObject: TObject; NotifyType: TIEMediaFountationNotifyType);
var
sample: TIEMFReceivedSample;
begin
if NotifyType = iemfnFrame then // is this a frame?
begin
sample := ImageEnView1.IO.MediaFoundationSourceReader.GetNextSample(); // retrieve frame sample
try
sample.DecodeSample(ImageEnView1.IEBitmap); // convert frame sample to bitmap
ImageEnView1.Update(); // update TImageEnView to show the new bitmap
finally
sample.Free(); // free the sample
end;
end;
end;