-
Notifications
You must be signed in to change notification settings - Fork 12
videofilt_vdxframe_creatingavideofilter
VirtualDub Plugin SDK 1.2
Creating a filter
Once you have the entry point in place, you can begin writing the video filters themselves.
To create a video filter, first derive from the VDXVideoFilter
base
class to produce the derived class for your filter. There are two
methods on the wrapper base class that must be overridden, GetParams()
and Run()
. These correspond to the paramProc
and runProc
entry
points, respectively. Therefore, this is the minimal filter
implementation:
#include <vd2/VDXFrame/VideoFilter.h>
class EmptyFilter : public VDXVideoFilter {
public:
virtual uint32 GetParams();
virtual void Run();
};
uint32 EmptyFilter::GetParams() {
return FILTERPARAM_SWAP_BUFFERS;
}
void EmptyFilter::Run() {
}
The VDXVideoFilter
class contains protected fields called fa
and
ff
that correspond to the filter activation and functions structures
traditionally passed to the filter entry points. This avoids having to
declare them on every method and allows code written to use those
variables to port directly over to the wrappers.
Other entry points in the video filter API are also exposed in the
VideoFilter base class, and can be implemented as simply as overloading
the appropriate base class method. The base class methods are sometimes
simplified — for instance, both the stringProc
and stringProc2
API
methods can be implemented by overloading
VDXVideoFilter::GetSettingsString()
.
Once you have the video filter class in place, the video filter
definition can be created using the VDXVideoFilterDefinition
template:
extern VDXFilterDefinition filterDef_emptyFilter =
VDXVideoFilterDefinition<EmptyFilter>(
"My Name",
"Sample: Empty Filter",
"Sample filter from the VirtualDub Plugin SDK: Does nothing");
The three arguments to the constructor are author, name, and description. All other fields are derived from the filter class.
That's it — you should now have a working video filter.
Copyright (C) 2007-2012 Avery Lee.
Setting up your development environment
Conventions
Plugin initialization
Dynamic loading
Reference counting
Using CPU extensions
Introduction
What's new
Breaking changes
Gotchas
Deprecated features
Migrating from the old Filter SDK
Programming model
Handling bitmaps
Creating a video filter
Setting filter parameters
Processing video frames
Managing filter data
Creating time-varying filters
Handling aspect ratio
Prefetching multiple source frames
Handling multiple sources
Making a filter configurable
Scripting support
CPU dependent optimization
VDXA index omitted
Getting started
Writing the module entry point
Creating a video filter
Adding configurability
Adding script support
Introduction
What's new
Autodetect
Direct mode
Video frames vs. samples
Video decodint model
Video decoder