ImageEn, unit imageenview

TImageEnView.OnMediaFoundationNotify

TImageEnView.OnMediaFoundationNotify


Declaration

property OnMediaFoundationNotify: TIEMediaFoundationNotifyEvent;


Description

Occurs whenever Media Foundation sends a new frame or a notification to TImageEnView.


Example

// handler for TImageEnView.OnMediaFoundatioNotify 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;