Skip to content

videofilt_vdxframe_gettingstarted

shekh edited this page Apr 15, 2018 · 1 revision

VirtualDub Plugin SDK 1.2

Getting started with the VDXFrame video filter wrappers

The video filter API is intended to be implemented directly by filters. However, doing so can be inconvenient, because it requires writing a series of entry points in function style. The VDXFrame static library contains wrappers to simplify the writing of video filters.

Including the VDXFrame static library

Since VDXFrame is a static library, you need to link it into your DLL. Project files are included for both Visual C++ 6.0 and Visual Studio 2005. To use VDXFrame, add the project to your workspace or solution, and then set your DLL project to depend on the VDXFrame project. The include path for your project must also include the include directory of the Plugin SDK where the vd2/VDXFrame directory is located; you should already have this included if you are using the main video filter plugin headers.

Note: Because VDXFrame is a static library, its code is linked into your DLL and thus isn't part of the video filter API itself. Regardless of whether you use VDXFrame or not, your filter exports the same entry points and looks the same to the host.

Wrapper operation

The VDXFrame video filter wrappers are designed to be used as base classes. Your filter derives from them, and the wrapper base handles the translation between function entry points in the API and virtual methods in the derived class. In particular, this avoids the need to manually shuttle instance data around in (void *) pointers and cast to and from structure pointers.

As an example, video filters can store instance data in the fa->filter_data pointer. Every entry point must be written as a straight function, which then must access and unpack the filter_data pointer to access instance data:

int runProc(const VDXFilterActivation *fa, const VDXFilterFunctions *ff) {
    MyFilterData *mfd = (MyFilterData *)fa->filter_data;
    
    int brightness = mfd->mBrightnessSetting;
    int contrast = mfd->mContrastSetting;
    
    // ...
}

In contrast, the VideoFilter wrapper allows data to be accessed directly through the implicit this pointer of a class method:

void MyFilter::Run() {
    int brightness = mBrightnessSetting;
    int contrast = mContrastSetting;
    
    // ...
}

Copyright (C) 2007-2012 Avery Lee.

Clone this wiki locally