2.5.27 IDeckLinkDX9ScreenPreviewHelper Interface

The IDeckLinkDX9ScreenPreviewHelper interface may be used with a simple IDeckLinkScreenPreviewCallback implementation to provide DirectX based preview rendering which is decoupled from the incoming or outgoing video stream being previewed.

A reference to an IDeckLinkDX9ScreenPreviewHelper object is obtained from CoCreateInstance().

Typical usage of IDeckLinkDX9ScreenPreviewHelper is as follows:

D3DPRESENT_PARAMETERS d3dpp;
IDirect3DDevice9* dxDevice;
d3dpp.BackBufferFormat     = D3DFMT_UNKNOWN;
d3dpp.BackBufferCount      = 2;
d3dpp.Windowed             = TRUE;
d3dpp.SwapEffect           = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow        = hwnd;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
  • Create a new device:

CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_ HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED, &d3dpp, &dxDevice);
dxDevice->BeginScene();
IDeckLinkDX9ScreenPreviewHelper::Render();
dxDevice->EndScene();
Related Interfaces

Interface

Interface ID

Description

IDeckLinkVideoFrame

IID_IDeckLinkVideoFrame

An IDeckLinkVideoFrame object interface is set for DirectX preview with IDeckLinkDX9ScreenPreviewHelper::SetFrame()

2.5.27.1 IDeckLinkDX9ScreenPreviewHelper::Initialize method

HRESULT IDeckLinkDX9ScreenPreviewHelper::Initialize(void *device);

The Initialize method sets the IDirect3DDevice9 object to be used by the DeckLink API’s preview helper.

Parameters:

device – The IDirect3DDevice9 object

Return values:

S_OK – Success

2.5.27.2 IDeckLinkDX9ScreenPreviewHelper::Render method

HRESULT IDeckLinkDX9ScreenPreviewHelper::Render(RECT *rc);

The Render method should be called whenever the preview frame needs to be repainted. The frames to be displayed should be provided to IDeckLinkDX9ScreenPreviewHelper::SetFrame()

Parameters:

rc – The display surface rectangle. If rc is NULL, the whole view port / surface is used. If the rc dimensions have changed, the display texture will be resized.

Return values:

S_OK – Success

2.5.27.3 IDeckLinkDX9ScreenPreviewHelper::SetFrame method

HRESULT IDeckLinkDX9ScreenPreviewHelper::SetFrame(IDeckLinkVideoFrame *theFrame);

The SetFrame method will set a 2D or 3D IDeckLinkVideoFrame into a texture. This method is used to set the preview frame to display on the next call to IDeckLinkDX9ScreenPreviewHelper::Render().

Depending on the rate and timing of calls to SetFrame and Render, some frames may not be displayed or may be displayed multiple times.

Parameters:

theFrame – The video frame to preview.

Return values:
  • E_FAIL – Failure

  • S_OK – Success

2.5.27.4 IDeckLinkDX9ScreenPreviewHelper::Set3DPreviewFormat method

HRESULT IDeckLinkDX9ScreenPreviewHelper::Set3DPreviewFormat(BMD3DPreviewFormat previewFormat);

The Set3DPreviewFormat method is used to set the 3D preview format.

Parameters:

previewFormat – The 3D preview format. See BMD3DPreviewFormat for more details.

Return values:

S_OK – Success