Decklink Keyer Sample

The purpose of this sample is to demonstrate a basic keying application using a custom interface on the Decklink video render filter.

A DirectShow graph is built using either a file source for avi movies, or a custom source for bitmap stills.  The infinite pin tee filter is used to provide streams to both the Decklink video render filter and the default screen renderer.  The Decklink video renderer blends the source with the video present on the input of the card and the default screen renderer is used to provide a preview on the desktop.  The desktop preview is generated by using a checker pattern from another custom bitmap source and getting the default screen renderer to blend this with the actual keying source.  This way the desktop resembles the keying output of the Decklink card.

The custom source is based on the PushSource sample from the DirectShow SDK.  The IFileSourceFilter interface is supported so the filter can load and stream the bitmap.  This method can be called repeatedly even while the filter is streaming to update or change the source image.  The transition happens seamlessly which avoids graph rebuilding and disturbance to the output video of the Decklink card.  The filter also supports IAMStreamControl interface so that the stream can be controlled.  This was added purely to permit looping of avi movies.  The checker source will issue an end of stream message at the same time as the avi movie.  This event is caught in the application, the stream reset and restarted giving the impression the the avi is looping.  Without the stream control of the checker bitmap source this event would never occur and the movie could not be looped.

When the application starts the IDecklinkKeyer interface is acquired and the keying ability of the card is determined.  The UI is updated to reflect the cards ability.  Keying can be enabled or disabled and the level of opacity of the keyed image can be set through the IDecklink keyer interface.  There are a few other methods available but it is not the purpose of this sample to demonstrate them.


Blackmagic Design.