Skip to content

videofilt_handlingmultiplesources

shekh edited this page Apr 15, 2018 · 1 revision

VirtualDub Plugin SDK 1.2

Handling multiple sources

Starting with the V16 API, it is possible to create video filters that can combine multiple upstream video sources.

Declaring multiple source capability

In order to read from multiple sources, a video filter must declare the ability to do so via the VDXFilterDefinition structure. Two new fields, mSourceCountLowMinus1 and mSourceCountHighMinus1, are used to declare minimum and maximum source counts. As the field names suggest, these must be set to the source counts minus one. For instance, if a filter can take two or three sources, it should set these values to 1 and 2. The high value should always be greater than or equal to the low value.

Changes when multiple sources are present

The V16 API adds the mSourceStreamCount and mpSourceStreams fields to the VDXFilterActivation context. These contain an array of VDXFBitmap structure pointers which represent the input streams in the startProc method. The first pointer is the same as the standard src field and either can be used for the first stream.

The prefetchProc or prefetchProc2 method must be implemented. The formerly unused srcIndex parameter to the prefetch functions is used to select which source stream to prefetch frames from.

In the runProc method, all prefetched video frames appear in the mpSourceFrames array as usual. There is no indication in the source frame array of which source streams each frame came from, so the video filter must rely on the order of the frames or the cookies associated with each frame to determine any necessary associations.

Limitations when processing multiple source frames

In-place filters are always assumed to modify frames from stream 0, and therefore the first frame prefetched for an in-place filter must always be from stream 0.

When pre-initializing the output stream metadata prior to invoking paramProc, the output stream is initialized based on the stream 0 metadata.


Copyright (C) 2007-2012 Avery Lee.

Clone this wiki locally