- Posts: 3
- Joined: Mon Sep 03, 2018 5:23 am
- Real Name: Rene Christen
Hi Rene,
To improve performance you need to move rendering functions out of IDeckLinkInputCallback::VideoInputFrameArrived() callback. The issue is that it is expected that VideoInputFrameArrived completes within a frame period to avoid queuing of frames and eventual dropped frames.
Instead, create a class that subclasses IDeckLinkScreenPreviewCallback and implement functions to update your preview window. The key difference of the DrawFrame callback is that the DeckLinkAPI does not queue frames if in case you don't return from the callback within the frame period. This makes the callback more suitable for rendering tasks. You register your callback with IDeckLinkInput::SetScreenPreviewCallback() method. Inside the DrawFrame callback you call IDeckLinkGLScreenPreviewHelper::SetFrame, set GL rendering context and call PaintGL(). Have a look at the Windows CapturePreview sample for an example how this is done.
Alternatively, we have the IDeckLinkCocoaScreenPreviewCallback helper that abstracts the OpenGL calls for displaying the preview in a Cocoa application. Please see the Mac CapturePreview sample for usage.
Regards
Cameron