Skip to content

OnFrameBitmap

event

Delphi
property OnFrameBitmap: TOnFrameBitmap read FOnFrameBitmap write FOnFrameBitmap;
C++Builder
__property TOnFrameBitmap OnFrameBitmap = {read=FOnFrameBitmap, write=FOnFrameBitmap};
typedef void __fastcall (__closure *TOnFrameBitmap)(System::TObject* Sender, pFrameInfo FrameInfo, pFrameBitmapInfo BitmapInfo);
C#
public event OnFrameBitmapEventHandler OnFrameBitmap;
public delegate void OnFrameBitmapEventHandler(object sender, TOnFrameBitmapEventArgs e);
VB.NET
Public Event OnFrameBitmap As OnFrameBitmapEventHandler
Public Delegate Sub OnFrameBitmapEventHandler(sender As Object, e As TOnFrameBitmapEventArgs)
C++/Qt
void SetOnFrameBitmap (TOnFrameBitmapCb OnFrameBitmapCb);
typedef void CALLBACK TOnFrameBitmapCb (void *Object, void *Sender, TFrameInfo *FrameInfo, TFrameBitmapInfo *BitmapInfo);

Occurs for each frame bitmap when the FrameGrabber is enabled.

To preserve performance while offering a lot of useful values, the event returns 2 parameters that are pointers to structures:

  • FrameInfo: a pointer to a TFrameInfo structure, which returns time and frame number information about the current video frame.

  • BitmapInfo: a pointer to a TFrameBitmapInfo structure, which returns all the useful bitmap information, and also the current mouse information (current position, last clicked position, button states, mouse down, etc.).

Powerful bitmap tasks can be performed from this event, such as line drawing, mouse-based drawing, pixel modifications, etc.

A lot of sample code is available in the OnFrameBitmap event of the MainDemo project (search "FrameBitmap" in the MainForm). To activate this sample code, run the MainDemo project: the checkboxes are located in the "Overlay" tab.

Notes:

  • From this event, do not perform any action with the potential to block: do not hold a critical section or wait on another thread.

  • Do not call any GDI or USER32.DLL API that might cause a window to move.

  • Do not invoke component properties that send messages, e.g. do not read the ItemIndex property of a ListBox component. To read such a property, set an intermediate variable when the property changes, and then read the intermediate variable from this event.

  • To perform blocking operations from this event, enable the OnFrameBitmapEventSynchrone property. Enabling OnFrameBitmapEventSynchrone may slow down the application and/or introduce latency in the video stream.

The event is not raised for the frames kept in NV12: 4K / 8K video played with FrameGrabberRGBFormat = fgf_Default (default setting), or FrameGrabberRGBFormat = fgf_NV12 (a warning is reported by OnLog when it is assigned before opening the video). Set FrameGrabberRGBFormat = fgf_RGB32 before opening the video to receive the event for every video.