How to get the input channel of a frame

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

elbatech

  • Posts: 2
  • Joined: Tue Dec 12, 2023 7:20 am
  • Real Name: Marco Sartore

How to get the input channel of a frame

PostTue Dec 12, 2023 7:30 am

Hi,
I am developing a C++ application based upon the QuadPreview sample code.
I Work with a DeckLink Duo with 4 input channels connected to 4 cameras.
In the setFrame() function, which is called every time a new input frame arrived:

void DeckLinkOpenGLWidget::setFrame(com_ptr<IDeckLinkVideoFrame> frame)

I need to know which camera the actual frame comes from.
How can I grab this information from the frame variable ?

Many thanks,
Marco
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 443
  • Joined: Mon Sep 04, 2017 4:05 am

Re: How to get the input channel of a frame

PostTue Dec 19, 2023 2:48 am

Hi Marco,

QuadPreview works by having 4 instances of DeckLinkInputPage, one for each quadrant. Each instance infers its own capture device (DeckLinkInputDevice) and screen preview (DeckLinkOpenGLWidget). It does not need to know the index of the capture device because the device/preview relationship is constrained within the DeckLinkInputPage hierarchy.

There is one caveat to this - on macOS, starting in Desktop Video SDK 12.3, the preview uses the IDeckLinkMetalScreenPreviewHelper to provide the capture preview. The difference here is that there is no equivalent to QOpenGLWidget, the Metal preview is drawn with viewport determined from the geometry of the underlying preview widget. In this case we do need to know the index of the view so we can match the preview frame with the viewport.

I suggest reviewing the Mac version of QuadPreview to see how the view index is passed between the DeckLinkInputPage and DeckLinkPreviewWidget object.

The simplest way to overcome is to pass the index to the constructor of your class that implements IDeckLinkScreenPreviewCallback interface, store this value as a member. On IDeckLinkScreenPreviewCallback::DrawFrame callback, pass the index to your underlying preview code.

Regards
Cameron

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 17 guests