-
Notifications
You must be signed in to change notification settings - Fork 12
ref_vfmethod_prefetchProc
VirtualDub Plugin SDK 1.2
prefetchProc video filter method
Retrieves the input frame number required to produce a given output frame.
sint64 prefetchProc(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, sint64 frame);
fa | Pointer to filter activation structure. |
ff | Pointer to callback function structure. |
This method is not thread-safe.
This function must not throw exceptions (see Except()).
The source frame required for the given output frame.
Requires V12 or later.
If omitted, the source frame is automatically chosen based on the output frame timestamp. This makes the frame numbers equal if the filter does not change the video frame rate.
The purpose of prefetchProc
is to allow the filter to direct the host
in how to prefetch source frames for processing by a filter. For each
output frame, prefetchProc
specifies which source frame is needed to
produce that output frame. This is similar to what would be passed to a
GetFrame() function except that the actual frame fetching is
asynchronous. By default, when prefetchProc
is omitted, the host
assumes that the source frame with the nearest timestamp to that of the
output frame should be used.
prefetchProc
is used to implement frame reordering, particularly in
the case where the frame rate is modified by the filter. In most cases
the default behavior suffices, but for some filters, particularly those
that process fields, prefetchProc
should be overridden to ensure exact
frame timing.
There are some big gotchas with implementing this function:
- Unlike most callbacks,
prefetchProc
must be implemented as thread-safe. Prefetching can occur at any time during execution and in parallel to frame processing, in particularrunProc
. Any mutable data that is accessed, like a cache, must be properly synchronized with a mutex or other mutual exclusion mechanism. - Prefetching can't depend on frame processing. For instance, a filter can't analyze previous frames in order to determine the next frame to fetch.
- The prefetch pattern must be constant. Between
startProc
andendProc
, a particular output frame must always map to the same source frame, no matter how many timesprefetchProc
is called and in what order. - Unused, extra prefetches can occur. A filter must not rely on a
prefetch resulting in a call to
runProc
on the prefetched frame.
Audio is not reordered along with the frames, so this is not intended to allow for editing.
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