Struct vapoursynth4_sys::VSAPI
source · #[repr(C)]pub struct VSAPI {Show 113 fields
pub createVideoFilter: unsafe extern "system" fn(out: *mut VSMap, name: *const c_char, vi: *const VSVideoInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore),
pub createVideoFilter2: unsafe extern "system" fn(name: *const c_char, vi: *const VSVideoInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore) -> *mut VSNode,
pub createAudioFilter: unsafe extern "system" fn(out: *mut VSMap, name: *const c_char, ai: *const VSAudioInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore),
pub createAudioFilter2: unsafe extern "system" fn(name: *const c_char, ai: *const VSAudioInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore) -> *mut VSNode,
pub setLinearFilter: unsafe extern "system" fn(node: *mut VSNode) -> c_int,
pub setCacheMode: unsafe extern "system" fn(node: *mut VSNode, mode: VSCacheMode),
pub setCacheOptions: unsafe extern "system" fn(node: *mut VSNode, fixedSize: c_int, maxSize: c_int, maxHistorySize: c_int),
pub freeNode: unsafe extern "system" fn(node: *mut VSNode),
pub addNodeRef: unsafe extern "system" fn(node: *mut VSNode) -> *mut VSNode,
pub getNodeType: unsafe extern "system" fn(node: *mut VSNode) -> VSMediaType,
pub getVideoInfo: unsafe extern "system" fn(node: *mut VSNode) -> *const VSVideoInfo,
pub getAudioInfo: unsafe extern "system" fn(node: *mut VSNode) -> *const VSAudioInfo,
pub newVideoFrame: unsafe extern "system" fn(format: *const VSVideoFormat, width: c_int, height: c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame,
pub newVideoFrame2: unsafe extern "system" fn(format: *const VSVideoFormat, width: c_int, height: c_int, planeSrc: *const *const VSFrame, planes: *const c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame,
pub newAudioFrame: unsafe extern "system" fn(format: *const VSAudioFormat, numSamples: c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame,
pub newAudioFrame2: unsafe extern "system" fn(format: *const VSAudioFormat, numSamples: c_int, channelSrc: *const *const VSFrame, channels: *const c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame,
pub freeFrame: unsafe extern "system" fn(f: *const VSFrame),
pub addFrameRef: unsafe extern "system" fn(f: *const VSFrame) -> *mut VSFrame,
pub copyFrame: unsafe extern "system" fn(f: *const VSFrame, core: *mut VSCore) -> *mut VSFrame,
pub getFramePropertiesRO: unsafe extern "system" fn(f: *const VSFrame) -> *const VSMap,
pub getFramePropertiesRW: unsafe extern "system" fn(f: *mut VSFrame) -> *mut VSMap,
pub getStride: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> isize,
pub getReadPtr: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> *const u8,
pub getWritePtr: unsafe extern "system" fn(f: *mut VSFrame, plane: c_int) -> *mut u8,
pub getVideoFrameFormat: unsafe extern "system" fn(f: *const VSFrame) -> *const VSVideoFormat,
pub getAudioFrameFormat: unsafe extern "system" fn(f: *const VSFrame) -> *const VSAudioFormat,
pub getFrameType: unsafe extern "system" fn(f: *const VSFrame) -> VSMediaType,
pub getFrameWidth: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> c_int,
pub getFrameHeight: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> c_int,
pub getFrameLength: unsafe extern "system" fn(f: *const VSFrame) -> c_int,
pub getVideoFormatName: unsafe extern "system" fn(format: *const VSVideoFormat, buffer: *mut c_char) -> c_int,
pub getAudioFormatName: unsafe extern "system" fn(format: *const VSAudioFormat, buffer: *mut c_char) -> c_int,
pub queryVideoFormat: unsafe extern "system" fn(format: *mut VSVideoFormat, colorFamily: VSColorFamily, sampleType: VSSampleType, bitsPerSample: c_int, subSamplingW: c_int, subSamplingH: c_int, core: *mut VSCore) -> c_int,
pub queryAudioFormat: unsafe extern "system" fn(format: *mut VSAudioFormat, sampleType: VSSampleType, bitsPerSample: c_int, channelLayout: u64, core: *mut VSCore) -> c_int,
pub queryVideoFormatID: unsafe extern "system" fn(colorFamily: VSColorFamily, sampleType: VSSampleType, bitsPerSample: c_int, subSamplingW: c_int, subSamplingH: c_int, core: *mut VSCore) -> u32,
pub getVideoFormatByID: unsafe extern "system" fn(format: *mut VSVideoFormat, id: u32, core: *mut VSCore) -> c_int,
pub getFrame: unsafe extern "system" fn(n: c_int, node: *mut VSNode, errorMsg: *mut c_char, bufSize: c_int) -> *const VSFrame,
pub getFrameAsync: unsafe extern "system" fn(n: c_int, node: *mut VSNode, callback: VSFrameDoneCallback, userData: *mut c_void),
pub getFrameFilter: unsafe extern "system" fn(n: c_int, node: *mut VSNode, frameCtx: *mut VSFrameContext) -> *const VSFrame,
pub requestFrameFilter: unsafe extern "system" fn(n: c_int, node: *mut VSNode, frameCtx: *mut VSFrameContext),
pub releaseFrameEarly: unsafe extern "system" fn(node: *mut VSNode, n: c_int, frameCtx: *mut VSFrameContext),
pub cacheFrame: unsafe extern "system" fn(frame: *const VSFrame, n: c_int, frameCtx: *mut VSFrameContext),
pub setFilterError: unsafe extern "system" fn(errorMessage: *const c_char, frameCtx: *mut VSFrameContext),
pub createFunction: unsafe extern "system" fn(func: VSPublicFunction, userData: *mut c_void, free: VSFreeFunctionData, core: *mut VSCore) -> *mut VSFunction,
pub freeFunction: unsafe extern "system" fn(f: *mut VSFunction),
pub addFunctionRef: unsafe extern "system" fn(f: *mut VSFunction) -> *mut VSFunction,
pub callFunction: unsafe extern "system" fn(func: *mut VSFunction, in_: *const VSMap, out: *mut VSMap),
pub createMap: unsafe extern "system" fn() -> *mut VSMap,
pub freeMap: unsafe extern "system" fn(map: *mut VSMap),
pub clearMap: unsafe extern "system" fn(map: *mut VSMap),
pub copyMap: unsafe extern "system" fn(src: *const VSMap, dst: *mut VSMap),
pub mapSetError: unsafe extern "system" fn(map: *mut VSMap, errorMessage: *const c_char),
pub mapGetError: unsafe extern "system" fn(map: *const VSMap) -> *const c_char,
pub mapNumKeys: unsafe extern "system" fn(map: *const VSMap) -> c_int,
pub mapGetKey: unsafe extern "system" fn(map: *const VSMap, index: c_int) -> *const c_char,
pub mapDeleteKey: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char) -> c_int,
pub mapNumElements: unsafe extern "system" fn(map: *const VSMap, key: *const c_char) -> c_int,
pub mapGetType: unsafe extern "system" fn(map: *const VSMap, key: *const c_char) -> VSPropertyType,
pub mapSetEmpty: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, type_: VSPropertyType) -> c_int,
pub mapGetInt: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> i64,
pub mapGetIntSaturated: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_int,
pub mapGetIntArray: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, error: *mut VSMapPropertyError) -> *const i64,
pub mapSetInt: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, i: i64, append: VSMapAppendMode) -> c_int,
pub mapSetIntArray: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, i: *const i64, size: c_int) -> c_int,
pub mapGetFloat: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_double,
pub mapGetFloatSaturated: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_float,
pub mapGetFloatArray: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, error: *mut VSMapPropertyError) -> *const c_double,
pub mapSetFloat: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, d: c_double, append: VSMapAppendMode) -> c_int,
pub mapSetFloatArray: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, d: *const c_double, size: c_int) -> c_int,
pub mapGetData: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *const c_char,
pub mapGetDataSize: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_int,
pub mapGetDataTypeHint: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> VSDataTypeHint,
pub mapSetData: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, data: *const c_char, size: c_int, type_: VSDataTypeHint, append: VSMapAppendMode) -> c_int,
pub mapGetNode: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *mut VSNode,
pub mapSetNode: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, node: *mut VSNode, append: VSMapAppendMode) -> c_int,
pub mapConsumeNode: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, node: *mut VSNode, append: VSMapAppendMode) -> c_int,
pub mapGetFrame: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *const VSFrame,
pub mapSetFrame: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, f: *const VSFrame, append: VSMapAppendMode) -> c_int,
pub mapConsumeFrame: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, f: *const VSFrame, append: VSMapAppendMode) -> c_int,
pub mapGetFunction: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *mut VSFunction,
pub mapSetFunction: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, func: *mut VSFunction, append: VSMapAppendMode) -> c_int,
pub mapConsumeFunction: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, func: *mut VSFunction, append: VSMapAppendMode) -> c_int,
pub registerFunction: unsafe extern "system" fn(name: *const c_char, args: *const c_char, returnType: *const c_char, argsFunc: VSPublicFunction, functionData: *mut c_void, plugin: *mut VSPlugin) -> c_int,
pub getPluginByID: unsafe extern "system" fn(identifier: *const c_char, core: *mut VSCore) -> *mut VSPlugin,
pub getPluginByNamespace: unsafe extern "system" fn(ns: *const c_char, core: *mut VSCore) -> *mut VSPlugin,
pub getNextPlugin: unsafe extern "system" fn(plugin: *mut VSPlugin, core: *mut VSCore) -> *mut VSPlugin,
pub getPluginName: unsafe extern "system" fn(plugin: *mut VSPlugin) -> *const c_char,
pub getPluginID: unsafe extern "system" fn(plugin: *mut VSPlugin) -> *const c_char,
pub getPluginNamespace: unsafe extern "system" fn(plugin: *mut VSPlugin) -> *const c_char,
pub getNextPluginFunction: unsafe extern "system" fn(func: *mut VSPluginFunction, plugin: *mut VSPlugin) -> *mut VSPluginFunction,
pub getPluginFunctionByName: unsafe extern "system" fn(name: *const c_char, plugin: *mut VSPlugin) -> *mut VSPluginFunction,
pub getPluginFunctionName: unsafe extern "system" fn(func: *mut VSPluginFunction) -> *const c_char,
pub getPluginFunctionArguments: unsafe extern "system" fn(func: *mut VSPluginFunction) -> *const c_char,
pub getPluginFunctionReturnType: unsafe extern "system" fn(func: *mut VSPluginFunction) -> *const c_char,
pub getPluginPath: unsafe extern "system" fn(plugin: *const VSPlugin) -> *const c_char,
pub getPluginVersion: unsafe extern "system" fn(plugin: *const VSPlugin) -> c_int,
pub invoke: unsafe extern "system" fn(plugin: *mut VSPlugin, name: *const c_char, args: *const VSMap) -> *mut VSMap,
pub createCore: unsafe extern "system" fn(flags: c_int) -> *mut VSCore,
pub freeCore: unsafe extern "system" fn(core: *mut VSCore),
pub setMaxCacheSize: unsafe extern "system" fn(bytes: i64, core: *mut VSCore) -> i64,
pub setThreadCount: unsafe extern "system" fn(threads: c_int, core: *mut VSCore) -> c_int,
pub getCoreInfo: unsafe extern "system" fn(core: *mut VSCore, info: *mut VSCoreInfo),
pub getAPIVersion: unsafe extern "system" fn() -> c_int,
pub logMessage: unsafe extern "system" fn(msgType: VSMessageType, msg: *const c_char, core: *mut VSCore),
pub addLogHandler: unsafe extern "system" fn(handler: VSLogHandler, free: VSLogHandlerFree, userData: *mut c_void, core: *mut VSCore) -> *mut VSLogHandle,
pub removeLogHandler: unsafe extern "system" fn(handle: *mut VSLogHandle, core: *mut VSCore) -> c_int,
pub getNodeCreationFunctionName: unsafe extern "system" fn(node: *mut VSNode, level: c_int) -> *const c_char,
pub getNodeCreationFunctionArguments: unsafe extern "system" fn(node: *mut VSNode, level: c_int) -> *const VSMap,
pub getNodeName: unsafe extern "system" fn(node: *mut VSNode) -> *const c_char,
pub getNodeFilterMode: unsafe extern "system" fn(node: *mut VSNode) -> VSFilterMode,
pub getNodeFilterTime: unsafe extern "system" fn(node: *mut VSNode) -> i64,
pub getNodeDependencies: unsafe extern "system" fn(node: *mut VSNode) -> *const VSFilterDependency,
pub getNumNodeDependencies: unsafe extern "system" fn(node: *mut VSNode) -> c_int,
}
Expand description
This giant struct is the way to access VapourSynth
’s public API.
Fields§
§createVideoFilter: unsafe extern "system" fn(out: *mut VSMap, name: *const c_char, vi: *const VSVideoInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore)
Creates a new video filter node.
Arguments
-
out
- Output map for the filter node. -
name
- Instance name. Please make it the same as the filter’s name for easy identification. -
vi
- The output format of the filter. -
getFrame
- The filter’s “getFrame” function. Must not beNULL
. -
free
- The filter’s “free” function. Can beNULL
. -
filterMode
- One ofVSFilterMode
. Indicates the level of parallelism supported by the filter. -
dependencies
- An array of nodes the filter requests frames from and the access pattern. Used to more efficiently configure caches. -
numDeps
- Length of the dependencies array. -
instanceData
- A pointer to the private filter data. This pointer will be passed to thegetFrame
andfree
functions. It should be freed by the free function.
After this function returns, out
will contain the new node appended to
the “clip” property, or an error, if something went wrong.
createVideoFilter2: unsafe extern "system" fn(name: *const c_char, vi: *const VSVideoInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore) -> *mut VSNode
Identical to createVideoFilter()
except that
the new node is returned instead of appended to the out map.
Returns NULL
on error.
createAudioFilter: unsafe extern "system" fn(out: *mut VSMap, name: *const c_char, ai: *const VSAudioInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore)
Creates a new video filter node.
Arguments
-
out
- Output map for the filter node. -
name
- Instance name. Please make it the same as the filter’s name for easy identification. -
ai
- The output format of the filter. -
getFrame
- The filter’s “getFrame” function. Must not beNULL
. -
free
- The filter’s “free” function. Can beNULL
. -
filterMode
- One ofVSFilterMode
. Indicates the level of parallelism supported by the filter. -
dependencies
- An array of nodes the filter requests frames from and the access pattern. Used to more efficiently configure caches. -
numDeps
- Length of the dependencies array. -
instanceData
- A pointer to the private filter data. This pointer will be passed to thegetFrame
andfree
functions. It should be freed by the free function.
After this function returns, out will contain the new node appended to the “clip” property, or an error, if something went wrong.
createAudioFilter2: unsafe extern "system" fn(name: *const c_char, ai: *const VSAudioInfo, getFrame: VSFilterGetFrame, free: VSFilterFree, filterMode: VSFilterMode, dependencies: *const VSFilterDependency, numDeps: c_int, instanceData: *mut c_void, core: *mut VSCore) -> *mut VSNode
Identical to createAudioFilter()
except that
the new node is returned instead of appended to the out map.
Returns NULL
on error.
setLinearFilter: unsafe extern "system" fn(node: *mut VSNode) -> c_int
Must be called immediately after audio or video filter creation.
Returns the upper bound of how many additional frames it is reasonable to pass to
cacheFrame()
when trying to make a request more linear.
setCacheMode: unsafe extern "system" fn(node: *mut VSNode, mode: VSCacheMode)
Determines the strategy for frame caching. Pass a VSCacheMode
constant.
Mostly useful for cache debugging since the auto mode should
work well in just about all cases. Calls to this function may also be silently ignored.
Resets the cache to default options when called, discarding
setCacheOptions
changes.
setCacheOptions: unsafe extern "system" fn(node: *mut VSNode, fixedSize: c_int, maxSize: c_int, maxHistorySize: c_int)
Call after setCacheMode or the changes will be discarded. Sets internal details of a node’s associated cache. Calls to this function may also be silently ignored.
Arguments
-
fixedSize
- Set to non-zero to make the cache always holdmaxSize
frames. -
maxSize
- The maximum number of frames to cache. Note that this value is automatically adjusted using an internal algorithm unless fixedSize is set. -
maxHistorySize
- How many frames that have been recently evicted from the cache to keep track off. Used to determine if growing or shrinking the cache is beneficial. Has no effect whenfixedSize
is set.
freeNode: unsafe extern "system" fn(node: *mut VSNode)
Decreases the reference count of a node and destroys it once it reaches 0.
It is safe to pass NULL
.
addNodeRef: unsafe extern "system" fn(node: *mut VSNode) -> *mut VSNode
Increment the reference count of a node. Returns the same node for convenience.
getNodeType: unsafe extern "system" fn(node: *mut VSNode) -> VSMediaType
Returns VSMediaType
. Used to determine if a node is of audio or video type.
getVideoInfo: unsafe extern "system" fn(node: *mut VSNode) -> *const VSVideoInfo
Returns a pointer to the video info associated with a node. The pointer is valid as long as the node lives. It is undefined behavior to pass a non-video node.
getAudioInfo: unsafe extern "system" fn(node: *mut VSNode) -> *const VSAudioInfo
Returns a pointer to the audio info associated with a node. The pointer is valid as long as the node lives. It is undefined behavior to pass a non-audio node.
newVideoFrame: unsafe extern "system" fn(format: *const VSVideoFormat, width: c_int, height: c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame
Creates a new video frame, optionally copying the properties attached to another frame. It is a fatal error to pass invalid arguments to this function.
The new frame contains uninitialised memory.
Arguments
-
format
- The desired colorspace format. Must not beNULL
. -
width
- -
height
- The desired dimensions of the frame, in pixels. Must be greater than 0 and have a suitable multiple for the subsampling in format. -
propSrc
- A frame from which properties will be copied. Can beNULL
.
Returns a pointer to the created frame. Ownership of the new frame is transferred to the caller.
See also newVideoFrame2()
.
newVideoFrame2: unsafe extern "system" fn(format: *const VSVideoFormat, width: c_int, height: c_int, planeSrc: *const *const VSFrame, planes: *const c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame
Creates a new video frame, optionally copying the properties attached to another frame. It is a fatal error to pass invalid arguments to this function.
The new frame contains uninitialised memory.
Arguments
-
format
- The desired colorspace format. Must not beNULL
. -
width
- -
height
- The desired dimensions of the frame, in pixels. Must be greater than 0 and have a suitable multiple for the subsampling in format. -
planeSrc
- Array of frames from which planes will be copied. If any elements of the array areNULL
, the corresponding planes in the new frame will contain uninitialised memory. -
planes
- Array of plane numbers indicating which plane to copy from the corresponding source frame. -
propSrc
- A frame from which properties will be copied. Can beNULL
.
Returns a pointer to the created frame. Ownership of the new frame is transferred to the caller.
Example
(assume frameA, frameB, frameC are existing frames):
const VSFrame * frames[3] = { frameA, frameB, frameC };
const int planes[3] = { 1, 0, 2 };
VSFrame *newFrame = vsapi->newVideoFrame2(f, w, h, frames, planes, frameB, core);
The newFrame’s first plane is now a copy of frameA’s second plane, the second plane is a copy of frameB’s first plane, the third plane is a copy of frameC’s third plane and the properties have been copied from frameB.
newAudioFrame: unsafe extern "system" fn(format: *const VSAudioFormat, numSamples: c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame
Creates a new audio frame, optionally copying the properties attached to another frame. It is a fatal error to pass invalid arguments to this function.
The new frame contains uninitialised memory.
Arguments
-
format
- The desired audio format. Must not beNULL
. -
numSamples
- The number of samples in the frame. All audio frames apart from the last one returned by a filter must haveVS_AUDIO_FRAME_SAMPLES
. -
propSrc
- A frame from which properties will be copied. Can beNULL
.
Returns a pointer to the created frame. Ownership of the new frame is transferred to the caller.
See also newAudioFrame2()
.
newAudioFrame2: unsafe extern "system" fn(format: *const VSAudioFormat, numSamples: c_int, channelSrc: *const *const VSFrame, channels: *const c_int, propSrc: *const VSFrame, core: *mut VSCore) -> *mut VSFrame
Creates a new audio frame, optionally copying the properties attached to another frame. It is a fatal error to pass invalid arguments to this function.
The new frame contains uninitialised memory.
Arguments
-
format
- The desired audio format. Must not beNULL
. -
numSamples
- The number of samples in the frame. All audio frames apart from the last one returned by a filter must haveVS_AUDIO_FRAME_SAMPLES
. -
propSrc
- A frame from which properties will be copied. Can beNULL
. -
channelSrc
- Array of frames from which channels will be copied. If any elements of the array areNULL
, the corresponding planes in the new frame will contain uninitialised memory. -
channels
- Array of channel numbers indicating which channel to copy from the corresponding source frame. Note that the number refers to the nth channel and not a channel name constant.
Returns a pointer to the created frame. Ownership of the new frame is transferred to the caller.
freeFrame: unsafe extern "system" fn(f: *const VSFrame)
Decrements the reference count of a frame and deletes it when it reaches 0.
It is safe to pass NULL
.
addFrameRef: unsafe extern "system" fn(f: *const VSFrame) -> *mut VSFrame
Increments the reference count of a frame. Returns f as a convenience.
copyFrame: unsafe extern "system" fn(f: *const VSFrame, core: *mut VSCore) -> *mut VSFrame
Duplicates the frame (not just the reference). As the frame buffer is shared in a copy-on-write fashion, the frame content is not really duplicated until a write operation occurs. This is transparent for the user.
Returns a pointer to the new frame. Ownership is transferred to the caller.
getFramePropertiesRO: unsafe extern "system" fn(f: *const VSFrame) -> *const VSMap
Returns a read-only pointer to a frame’s properties. The pointer is valid as long as the frame lives.
getFramePropertiesRW: unsafe extern "system" fn(f: *mut VSFrame) -> *mut VSMap
Returns a read/write pointer to a frame’s properties. The pointer is valid as long as the frame lives.
getStride: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> isize
Returns the distance in bytes between two consecutive lines of a plane of a video frame. The stride is always positive.
Returns 0 if the requested plane doesn’t exist or if it isn’t a video frame.
getReadPtr: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> *const u8
Returns a read-only pointer to a plane or channel of a frame.
Returns NULL
if an invalid plane or channel number is passed.
Note
Don’t assume all three planes of a frame are allocated in one contiguous chunk (they’re not).
getWritePtr: unsafe extern "system" fn(f: *mut VSFrame, plane: c_int) -> *mut u8
Returns a read-write pointer to a plane or channel of a frame.
Returns NULL
if an invalid plane or channel number is passed.
Note
Don’t assume all three planes of a frame are allocated in one contiguous chunk (they’re not).
getVideoFrameFormat: unsafe extern "system" fn(f: *const VSFrame) -> *const VSVideoFormat
Retrieves the format of a video frame.
getAudioFrameFormat: unsafe extern "system" fn(f: *const VSFrame) -> *const VSAudioFormat
Retrieves the format of an audio frame.
getFrameType: unsafe extern "system" fn(f: *const VSFrame) -> VSMediaType
Returns a value from VSMediaType
to distinguish audio and video frames.
getFrameWidth: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> c_int
Returns the width of a plane of a given video frame, in pixels. The width depends on the plane number because of the possible chroma subsampling.
Returns 0 for audio frames.
getFrameHeight: unsafe extern "system" fn(f: *const VSFrame, plane: c_int) -> c_int
Returns the height of a plane of a given video frame, in pixels. The height depends on the plane number because of the possible chroma subsampling.
Returns 0 for audio frames.
getFrameLength: unsafe extern "system" fn(f: *const VSFrame) -> c_int
Returns the number of audio samples in a frame. Always returns 1 for video frames.
getVideoFormatName: unsafe extern "system" fn(format: *const VSVideoFormat, buffer: *mut c_char) -> c_int
Tries to output a fairly human-readable name of a video format.
Arguments
format
- The input video format.buffer
- Destination buffer. At most 32 bytes including terminatingNUL
will be written.
Returns non-zero on success.
getAudioFormatName: unsafe extern "system" fn(format: *const VSAudioFormat, buffer: *mut c_char) -> c_int
Tries to output a fairly human-readable name of an audio format.
Arguments
format
- The input audio format.buffer
- Destination buffer. At most 32 bytes including terminatingNUL
will be written.
Returns non-zero on success.
queryVideoFormat: unsafe extern "system" fn(format: *mut VSVideoFormat, colorFamily: VSColorFamily, sampleType: VSSampleType, bitsPerSample: c_int, subSamplingW: c_int, subSamplingH: c_int, core: *mut VSCore) -> c_int
Fills out a [sic] VSVideoInfo
struct based on the provided arguments.
Validates the arguments before filling out format.
Arguments
-
format
- The struct to fill out. -
colorFamily
- One ofVSColorFamily
. -
sampleType
- One ofVSSampleType
. -
bitsPerSample
- Number of meaningful bits for a single component. The valid range is 8-32.For floating point formats only 16 or 32 bits are allowed.
-
subSamplingW
- log2 of the horizontal chroma subsampling. 0 == no subsampling. The valid range is 0-4. -
subSamplingH
- log2 of the vertical chroma subsampling. 0 == no subsampling. The valid range is 0-4.Note
RGB formats are not allowed to be subsampled in VapourSynth.
Returns non-zero on success.
queryAudioFormat: unsafe extern "system" fn(format: *mut VSAudioFormat, sampleType: VSSampleType, bitsPerSample: c_int, channelLayout: u64, core: *mut VSCore) -> c_int
Fills out a VSAudioFormat
struct based on the provided arguments.
Validates the arguments before filling out format.
Arguments
-
format
- The struct to fill out. -
sampleType
- One ofVSSampleType
. -
bitsPerSample
- Number of meaningful bits for a single component. The valid range is 8-32.For floating point formats only 32 bits are allowed.
-
channelLayout
- A bitmask constructed from bitshifted constants inVSAudioChannels
. For example stereo is expressed as(1 << acFrontLeft) | (1 << acFrontRight)
.
Returns non-zero on success.
queryVideoFormatID: unsafe extern "system" fn(colorFamily: VSColorFamily, sampleType: VSSampleType, bitsPerSample: c_int, subSamplingW: c_int, subSamplingH: c_int, core: *mut VSCore) -> u32
Get the id associated with a video format. Similar to
queryVideoFormat()
except that it returns a format id
instead of filling out a VSVideoInfo
struct.
Arguments
-
colorFamily
- One ofVSColorFamily
. -
sampleType
- One ofVSSampleType
. -
bitsPerSample
- Number of meaningful bits for a single component. The valid range is 8-32.For floating point formats only 16 or 32 bits are allowed.
-
subSamplingW
- log2 of the horizontal chroma subsampling. 0 == no subsampling. The valid range is 0-4. -
subSamplingH
- log2 of the vertical chroma subsampling. 0 == no subsampling. The valid range is 0-4.Note
RGB formats are not allowed to be subsampled in VapourSynth.
Returns a valid format id if the provided arguments are valid, on error 0 is returned.
getVideoFormatByID: unsafe extern "system" fn(format: *mut VSVideoFormat, id: u32, core: *mut VSCore) -> c_int
Fills out the VSVideoFormat struct passed to format based
Arguments
-
format
- The struct to fill out. -
id
- The format identifier: one ofVSPresetVideoFormat
or a value gotten fromqueryVideoFormatID()
.
Returns 0 on failure and non-zero on success.
getFrame: unsafe extern "system" fn(n: c_int, node: *mut VSNode, errorMsg: *mut c_char, bufSize: c_int) -> *const VSFrame
Fetches a frame synchronously. The frame is available when the function returns.
This function is meant for external applications using the core as a library, or if frame requests are necessary during a filter’s initialization.
Thread-safe.
Arguments
-
n
- The frame number. Negative values will cause an error. -
node
- The node from which the frame is requested. -
errorMsg
- Pointer to a buffer ofbufSize
bytes to store a possible error message. Can beNULL
if no error message is wanted. -
bufSize
- Maximum length for the error message, in bytes (including the trailing ‘0’). Can be 0 if no error message is wanted.
Returns a reference to the generated frame, or NULL
in case of failure.
The ownership of the frame is transferred to the caller.
Warning
Never use inside a filter’s “getFrame” function.
getFrameAsync: unsafe extern "system" fn(n: c_int, node: *mut VSNode, callback: VSFrameDoneCallback, userData: *mut c_void)
Requests the generation of a frame. When the frame is ready, a user-provided function is called. Note that the completion callback will only be called from a single thread at a time.
This function is meant for applications using VapourSynth as a library.
Thread-safe.
Arguments
-
n
- Frame number. Negative values will cause an error. -
node
- The node from which the frame is requested. -
callback
- SeeVSFrameDoneCallback
. -
userData
- Pointer passed to the callback.
Warning
Never use inside a filter’s “getFrame” function.
getFrameFilter: unsafe extern "system" fn(n: c_int, node: *mut VSNode, frameCtx: *mut VSFrameContext) -> *const VSFrame
Retrieves a frame that was previously requested with
requestFrameFilter()
.
Only use inside a filter’s “getFrame” function.
A filter usually calls this function when its activation reason is
VSActivationReason::AllFramesReady
.
See VSActivationReason
.
It is safe to retrieve a frame more than once, but each reference needs to be freed.
Arguments
-
n
- The frame number. -
node
- The node from which the frame is retrieved. -
frameCtx
- The context passed to the filter’s “getFrame” function.
Returns a pointer to the requested frame, or NULL
if the requested frame is
not available for any reason. The ownership of the frame is transferred to the caller.
requestFrameFilter: unsafe extern "system" fn(n: c_int, node: *mut VSNode, frameCtx: *mut VSFrameContext)
Requests a frame from a node and returns immediately.
Only use inside a filter’s “getFrame” function.
A filter usually calls this function when its activation reason is arInitial.
The requested frame can then be retrieved using
getFrameFilter()
, when the filter’s activation reason is
VSActivationReason::AllFramesReady
.
It is best to request frames in ascending order, i.e. n, n+1, n+2, etc.
Arguments
-
n
- The frame number. Negative values will cause an error. -
node
- The node from which the frame is requested. -
frameCtx
- The context passed to the filter’s “getFrame” function.
releaseFrameEarly: unsafe extern "system" fn(node: *mut VSNode, n: c_int, frameCtx: *mut VSFrameContext)
By default all requested frames are referenced until a filter’s frame request is done. In extreme cases where a filter needs to reduce 20+ frames into a single output frame it may be beneficial to request these in batches and incrementally process the data instead.
Should rarely be needed.
Only use inside a filter’s “getFrame” function.
Arguments
-
n
- The frame number. Negative values will cause an error. -
node
- The node from which the frame is requested. -
frameCtx
- The context passed to the filter’s “getFrame” function.
cacheFrame: unsafe extern "system" fn(frame: *const VSFrame, n: c_int, frameCtx: *mut VSFrameContext)
Pushes a not requested frame into the cache. This is useful for (source) filters that greatly benefit from completely linear access and producing all output in linear order.
This function may only be used in filters that were created with
setLinearFilter
.
Only use inside a filter’s “getFrame” function.
setFilterError: unsafe extern "system" fn(errorMessage: *const c_char, frameCtx: *mut VSFrameContext)
Adds an error message to a frame context, replacing the existing message, if any.
This is the way to report errors in a filter’s “getFrame” function. Such errors are not necessarily fatal, i.e. the caller can try to request the same frame again.
createFunction: unsafe extern "system" fn(func: VSPublicFunction, userData: *mut c_void, free: VSFreeFunctionData, core: *mut VSCore) -> *mut VSFunction
Arguments
-
func
- User-defined function that may be called in any context. -
userData
- Pointer passed tofunc
. -
free
- Callback tasked with freeing userData. Can beNULL
.
freeFunction: unsafe extern "system" fn(f: *mut VSFunction)
Decrements the reference count of a function and deletes it when it reaches 0.
It is safe to pass NULL
.
addFunctionRef: unsafe extern "system" fn(f: *mut VSFunction) -> *mut VSFunction
Increments the reference count of a function. Returns f as a convenience.
callFunction: unsafe extern "system" fn(func: *mut VSFunction, in_: *const VSMap, out: *mut VSMap)
Calls a function. If the call fails out will have an error set.
Arguments
-
func
- Function to be called. -
in_
- Arguments passed tofunc
. -
out
- Returned values fromfunc
.
createMap: unsafe extern "system" fn() -> *mut VSMap
Creates a new property map. It must be deallocated later with freeMap()
.
freeMap: unsafe extern "system" fn(map: *mut VSMap)
Frees a map and all the objects it contains.
clearMap: unsafe extern "system" fn(map: *mut VSMap)
Deletes all the keys and their associated values from the map, leaving it empty.
copyMap: unsafe extern "system" fn(src: *const VSMap, dst: *mut VSMap)
copies all values in src to dst, if a key already exists in dst it’s replaced
mapSetError: unsafe extern "system" fn(map: *mut VSMap, errorMessage: *const c_char)
Adds an error message to a map. The map is cleared first. The error message is copied. In this state the map may only be freed, cleared or queried for the error message.
For errors encountered in a filter’s “getFrame” function, use
setFilterError()
.
mapGetError: unsafe extern "system" fn(map: *const VSMap) -> *const c_char
Returns a pointer to the error message contained in the map,
or NULL
if there is no error set. The pointer is valid until
the next modifying operation on the map.
mapNumKeys: unsafe extern "system" fn(map: *const VSMap) -> c_int
Returns the number of keys contained in a property map.
mapGetKey: unsafe extern "system" fn(map: *const VSMap, index: c_int) -> *const c_char
Returns the nth key from a property map.
Passing an invalid index will cause a fatal error.
The pointer is valid as long as the key exists in the map.
mapDeleteKey: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char) -> c_int
Removes the property with the given key. All values associated with the key are lost.
Returns 0 if the key isn’t in the map. Otherwise it returns 1.
mapNumElements: unsafe extern "system" fn(map: *const VSMap, key: *const c_char) -> c_int
Returns the number of elements associated with a key in a property map.
Returns -1 if there is no such key in the map.
mapGetType: unsafe extern "system" fn(map: *const VSMap, key: *const c_char) -> VSPropertyType
Returns a value from VSPropertyType
representing type of elements in the given key.
If there is no such key in the map, the returned value is
VSPropertyType::Unset
).
Note that also empty arrays created with mapSetEmpty are typed.
mapSetEmpty: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, type_: VSPropertyType) -> c_int
Creates an empty array of type in key.
Returns non-zero value on failure due to key already existing or having an invalid name.
mapGetInt: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> i64
Retrieves an integer from a specified key in a map.
Returns the number on success, or 0 in case of error.
If the map has an error set (i.e. if mapGetError()
returns non-NULL
), VapourSynth will die with a fatal error.
Arguments
-
index
- Zero-based index of the element.Use
mapNumElements()
to know the total number of elements associated with a key. -
error
- One ofVSMapPropertyError
,VSMapPropertyError::Success
on success.You may pass
NULL
here, but then any problems encountered while retrieving the property will cause VapourSynth to die with a fatal error.
mapGetIntSaturated: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_int
Works just like mapGetInt()
except that the value returned is
also converted to an integer using saturation.
mapGetIntArray: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, error: *mut VSMapPropertyError) -> *const i64
Retrieves an array of integers from a map. Use this function if there are a lot of numbers
associated with a key, because it is faster than calling
mapGetInt()
in a loop.
Returns a pointer to the first element of the array on success,
or NULL
in case of error. Use mapNumElements()
to
know the total number of elements associated with a key.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapSetInt: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, i: i64, append: VSMapAppendMode) -> c_int
Sets an integer to the specified key in a map.
Multiple values can be associated with one key, but they must all be the same type.
Arguments
-
key
- Name of the property. Alphanumeric characters and underscore may be used. -
i
- Value to store. -
append
- One ofVSMapAppendMode
.
Returns 0 on success, or 1 if trying to append to a property with the wrong type to an existing key.
mapSetIntArray: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, i: *const i64, size: c_int) -> c_int
Adds an array of integers to a map. Use this function if there are a lot of numbers
to add because it is faster than calling mapSetInt()
in a loop.
If map already contains a property with this key, that property will be overwritten and all old values will be lost.
Arguments
-
key
- Name of the property. Alphanumeric characters and underscore may be used. -
i
- Pointer to the first element of the array to store. -
size
- Number of integers to read from the array. It can be 0, in which case no integers are read from the array, and the property will be created empty.
Returns 0 on success, or 1 if size is negative.
mapGetFloat: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_double
Retrieves a floating point number from a map.
Returns the number on success, or 0 in case of error.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapGetFloatSaturated: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_float
Works just like mapGetFloat()
except that the value returned
is also converted to a float.
mapGetFloatArray: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, error: *mut VSMapPropertyError) -> *const c_double
Retrieves an array of floating point numbers from a map. Use this function if there are
a lot of numbers associated with a key, because it is faster than calling
mapGetFloat()
in a loop.
Returns a pointer to the first element of the array on success,
or NULL
in case of error. Use mapNumElements()
to
know the total number of elements associated with a key.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapSetFloat: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, d: c_double, append: VSMapAppendMode) -> c_int
Sets a float to the specified key in a map.
See mapSetInt()
for a complete description of
the arguments and general behavior.
mapSetFloatArray: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, d: *const c_double, size: c_int) -> c_int
Adds an array of floating point numbers to a map. Use this function if there are
a lot of numbers to add, because it is faster than calling
mapSetFloat()
in a loop.
If map already contains a property with this key, that property will be overwritten and all old values will be lost.
Arguments
-
key
- Name of the property. Alphanumeric characters and underscore may be used. -
d
- Pointer to the first element of the array to store. -
size
- Number of floating point numbers to read from the array. It can be 0, in which case no numbers are read from the array, and the property will be created empty.
Returns 0 on success, or 1 if size is negative.
mapGetData: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *const c_char
Retrieves arbitrary binary data from a map. Checking
mapGetDataTypeHint()
may provide a hint about
whether or not the data is human readable.
Returns a pointer to the data on success, or NULL
in case of error.
The array returned is guaranteed to be NULL
-terminated.
The NULL
byte is not considered to be part of the array
(mapGetDataSize
doesn’t count it).
The pointer is valid until the map is destroyed, or until the corresponding key is removed from the map or altered.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapGetDataSize: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> c_int
Returns the size in bytes of a property of type ptData (see VSPropertyType
),
or 0 in case of error. The terminating NULL
byte added by
mapSetData()
is not counted.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapGetDataTypeHint: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> VSDataTypeHint
Returns the size in bytes of a property of type ptData (see VSPropertyType
),
or 0 in case of error. The terminating NULL
byte added by
mapSetData()
is not counted.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapSetData: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, data: *const c_char, size: c_int, type_: VSDataTypeHint, append: VSMapAppendMode) -> c_int
Sets binary data to the specified key in a map.
Multiple values can be associated with one key, but they must all be the same type.
Arguments
-
key
- Name of the property. Alphanumeric characters and the underscore may be used. -
data
- Value to store.This function copies the data, so the pointer should be freed when no longer needed. A terminating
NULL
is always added to the copied data but not included in the total size to make string handling easier. -
size
- The number of bytes to copy. If this is negative, everything up to the firstNULL
byte will be copied. -
type
- One ofVSDataTypeHint
to hint whether or not it is human readable data. -
append
- One ofVSMapAppendMode
.
Returns 0 on success, or 1 if trying to append to a property with the wrong type.
mapGetNode: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *mut VSNode
Retrieves a node from a map.
Returns a pointer to the node on success, or NULL
in case of error.
This function increases the node’s reference count, so freeNode()
must be used when the node is no longer needed.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapSetNode: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, node: *mut VSNode, append: VSMapAppendMode) -> c_int
Sets a node to the specified key in a map.
See mapSetInt()
for a complete description of
the arguments and general behavior.
mapConsumeNode: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, node: *mut VSNode, append: VSMapAppendMode) -> c_int
Sets a node to the specified key in a map and decreases the reference count.
See mapSetInt()
for a complete description of
the arguments and general behavior.
Note: always consumes the reference, even on error
mapGetFrame: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *const VSFrame
Retrieves a frame from a map.
Returns a pointer to the frame on success, or NULL
in case of error.
This function increases the frame’s reference count, so
freeFrame()
must be used when the frame is no longer needed.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapSetFrame: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, f: *const VSFrame, append: VSMapAppendMode) -> c_int
Sets a frame to the specified key in a map.
See mapSetInt()
for a complete description of
the arguments and general behavior.
mapConsumeFrame: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, f: *const VSFrame, append: VSMapAppendMode) -> c_int
Sets a frame to the specified key in a map and decreases the reference count.
See mapSetInt()
for a complete description of
the arguments and general behavior.
mapGetFunction: unsafe extern "system" fn(map: *const VSMap, key: *const c_char, index: c_int, error: *mut VSMapPropertyError) -> *mut VSFunction
Retrieves a function from a map.
Returns a pointer to the function on success, or NULL
in case of error.
This function increases the function’s reference count, so
freeFunction()
must be used when the function is no longer needed.
See mapGetInt()
for a complete description of
the arguments and general behavior.
mapSetFunction: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, func: *mut VSFunction, append: VSMapAppendMode) -> c_int
Sets a function object to the specified key in a map.
See mapSetInt()
for a complete description of
the arguments and general behavior.
mapConsumeFunction: unsafe extern "system" fn(map: *mut VSMap, key: *const c_char, func: *mut VSFunction, append: VSMapAppendMode) -> c_int
Sets a function object to the specified key in a map and decreases the reference count.
See mapSetInt()
for a complete description of
the arguments and general behavior.
registerFunction: unsafe extern "system" fn(name: *const c_char, args: *const c_char, returnType: *const c_char, argsFunc: VSPublicFunction, functionData: *mut c_void, plugin: *mut VSPlugin) -> c_int
Function that registers a filter exported by the plugin.
A plugin can export any number of filters. This function may only be called during
the plugin loading phase unless the VSPluginConfigFlags::Modifiable
flag was
set by configPlugin
.
Arguments
-
name
- Filter name. The characters allowed are letters, numbers, and the underscore. The first character must be a letter. In other words: ^[a-zA-Z][a-zA-Z0-9_]*$Filter names should be PascalCase.
-
args
- String containing the filter’s list of arguments.Arguments are separated by a semicolon. Each argument is made of several fields separated by a colon. Don’t insert additional whitespace characters, or VapourSynth will die.
Fields:
-
The argument name.
The same characters are allowed as for the filter’s name. Argument names should be all lowercase and use only letters and the underscore.
-
The type.
- “int”: int64_t
- “float”: double
- “data”: const char*
- “anode”: const
VSNode
* (audio type) - “vnode”: const
VSNode
* (video type) - “aframe”: const
VSFrame
* (audio type) - “vframe”: const
VSFrame
* (video type) - “func”: const
VSFunction
*
It is possible to declare an array by appending “[]” to the type.
-
“opt”
If the parameter is optional.
-
“empty”
For arrays that are allowed to be empty.
-
“any”
Can only be placed last without a semicolon after. Indicates that all remaining arguments that don’t match should also be passed through.
Example
The following example declares the arguments “blah”, “moo”, and “asdf”:
blah:vnode;moo:int[]:opt;asdf:float:opt;
The following example declares the arguments “blah” and accepts all other arguments no matter the type:
blah:vnode;any
-
-
returnType
- Specifies works similarly toargs
but instead specifies which keys and what type will be returned. Typically this will be:clip:vnode;
for video filters. It is important to not simply specify “any” for all filters since this information is used for better auto-completion in many editors.
-
argsFunc
- SeeVSPublicFunction
. -
functionData
- Pointer to user data that gets passed toargsFunc
when creating a filter. Useful to register multiple filters using a singleargsFunc
function. -
plugin
- Pointer to the plugin object in the core, as passed toVapourSynthPluginInit2()
.
getPluginByID: unsafe extern "system" fn(identifier: *const c_char, core: *mut VSCore) -> *mut VSPlugin
Returns a pointer to the plugin with the given identifier, or NULL if not found.
Arguments
identifier
- Reverse URL that uniquely identifies the plugin.
getPluginByNamespace: unsafe extern "system" fn(ns: *const c_char, core: *mut VSCore) -> *mut VSPlugin
Returns a pointer to the plugin with the given namespace, or NULL
if not found.
getPluginByID
is generally a better option.
Arguments
ns
- Namespace.
getNextPlugin: unsafe extern "system" fn(plugin: *mut VSPlugin, core: *mut VSCore) -> *mut VSPlugin
Used to enumerate over all currently loaded plugins. The order is fixed but provides no other guarantees.
Arguments
plugin
- Current plugin. Pass `NULLw to get the first plugin.
Returns a pointer to the next plugin in order or
NULL
if the final plugin has been reached.
getPluginName: unsafe extern "system" fn(plugin: *mut VSPlugin) -> *const c_char
Returns the name of the plugin that was passed to
configPlugin
.
getPluginID: unsafe extern "system" fn(plugin: *mut VSPlugin) -> *const c_char
Returns the identifier of the plugin that was passed to
configPlugin
.
getPluginNamespace: unsafe extern "system" fn(plugin: *mut VSPlugin) -> *const c_char
Returns the namespace the plugin currently is loaded in.
getNextPluginFunction: unsafe extern "system" fn(func: *mut VSPluginFunction, plugin: *mut VSPlugin) -> *mut VSPluginFunction
Used to enumerate over all functions in a plugin. The order is fixed but provides no other guarantees.
Arguments
-
func
- Current function. PassNULL
to get the first function. -
plugin
- The plugin to enumerate functions in.
Returns a pointer to the next function in order or
NULL
if the final function has been reached.
getPluginFunctionByName: unsafe extern "system" fn(name: *const c_char, plugin: *mut VSPlugin) -> *mut VSPluginFunction
Get a function belonging to a plugin by its name.
getPluginFunctionName: unsafe extern "system" fn(func: *mut VSPluginFunction) -> *const c_char
Returns the name of the function that was passed to
registerFunction()
.
getPluginFunctionArguments: unsafe extern "system" fn(func: *mut VSPluginFunction) -> *const c_char
Returns the argument string of the function that was passed to
registerFunction()
.
getPluginFunctionReturnType: unsafe extern "system" fn(func: *mut VSPluginFunction) -> *const c_char
Returns the return type string of the function that was passed to
registerFunction()
.
getPluginPath: unsafe extern "system" fn(plugin: *const VSPlugin) -> *const c_char
Returns the absolute path to the plugin, including the plugin’s file name. This is the real location of the plugin, i.e. there are no symbolic links in the path.
Path elements are always delimited with forward slashes.
VapourSynth retains ownership of the returned pointer.
getPluginVersion: unsafe extern "system" fn(plugin: *const VSPlugin) -> c_int
Returns the version of the plugin.
This is the same as the version number passed to
configPlugin()
.
invoke: unsafe extern "system" fn(plugin: *mut VSPlugin, name: *const c_char, args: *const VSMap) -> *mut VSMap
Invokes a filter.
invoke()
checks that the args passed to the filter are consistent
with the argument list registered by the plugin that contains the filter,
calls the filter’s “create” function, and checks that
the filter returns the declared types.
If everything goes smoothly, the filter will be ready to generate frames after
invoke()
returns.
Arguments
-
plugin
- A pointer to the plugin where the filter is located. Must not beNULL
.See
getPluginByID()
. -
name
- Name of the filter to invoke. -
args
- Arguments for the filter.
Returns a map containing the filter’s return value(s).
The caller takes ownership of the map.
Use mapGetError()
to check if the filter was invoked successfully.
Most filters will either set an error, or one or more clips with the key “clip”.
The exception to this are functions, for example LoadPlugin
,
which doesn’t return any clips for obvious reasons.
createCore: unsafe extern "system" fn(flags: c_int) -> *mut VSCore
Creates the VapourSynth processing core and returns a pointer to it. It is possible to create multiple cores but in most cases it shouldn’t be needed.
Arguments
flags
-VSCoreCreationFlags
ORed together if desired. Pass 0 for sane defaults that should suit most uses.
freeCore: unsafe extern "system" fn(core: *mut VSCore)
Frees a core. Should only be done after all frame requests have completed and all objects belonging to the core have been released.
setMaxCacheSize: unsafe extern "system" fn(bytes: i64, core: *mut VSCore) -> i64
Sets the maximum size of the framebuffer cache.
Note: the total cache size at which vapoursynth more aggressively tries to reclaim memory, it is not a hard limit
Return:
the new maximum size.
setThreadCount: unsafe extern "system" fn(threads: c_int, core: *mut VSCore) -> c_int
Sets the number of threads used for processing. Pass 0 to automatically detect. Returns the number of threads that will be used for processing.
getCoreInfo: unsafe extern "system" fn(core: *mut VSCore, info: *mut VSCoreInfo)
Returns information about the VapourSynth core.
getAPIVersion: unsafe extern "system" fn() -> c_int
Returns the highest VAPOURSYNTH_API_VERSION
the library support.
logMessage: unsafe extern "system" fn(msgType: VSMessageType, msg: *const c_char, core: *mut VSCore)
Send a message through VapourSynth’s logging framework.
See addLogHandler
.
Arguments
-
msgType
- The type of message. One ofVSMessageType
.If
msgType
isVSMessageType::Fatal
, VapourSynth will callabort()
after delivering the message. -
msg
- The message.
addLogHandler: unsafe extern "system" fn(handler: VSLogHandler, free: VSLogHandlerFree, userData: *mut c_void, core: *mut VSCore) -> *mut VSLogHandle
Installs a custom handler for the various error messages VapourSynth emits.
The message handler is per VSCore
instance. Returns a unique handle.
If no log handler is installed up to a few hundred messages are cached and will be delivered as soon as a log handler is attached. This behavior exists mostly so that warnings when auto-loading plugins (default behavior) won’t disappear-
Arguments
-
handler
- Custom message handler. If this isNULL
, the default message handler will be restored. -
free
- Called when a handler is removed. -
userData
- Pointer that gets passed to the message handler.
removeLogHandler: unsafe extern "system" fn(handle: *mut VSLogHandle, core: *mut VSCore) -> c_int
Removes a custom handler. Return non-zero on success and zero if the handle is invalid.
Arguments
handle
- Handle obtained fromaddLogHandler()
.
getNodeCreationFunctionName: unsafe extern "system" fn(node: *mut VSNode, level: c_int) -> *const c_char
vs-graph
only.level=0 returns the name of the function that created the filter,
specifying a higher level will retrieve the function above that
invoked it or NULL
if a non-existent level is requested
getNodeCreationFunctionArguments: unsafe extern "system" fn(node: *mut VSNode, level: c_int) -> *const VSMap
vs-graph
only.level=0 returns a copy of the arguments passed to the function that created the filter,
returns NULL
if a non-existent level is requested
getNodeName: unsafe extern "system" fn(node: *mut VSNode) -> *const c_char
vs-graph
only.the name passed to create*Filter*
getNodeFilterMode: unsafe extern "system" fn(node: *mut VSNode) -> VSFilterMode
vs-graph
only.getNodeFilterTime: unsafe extern "system" fn(node: *mut VSNode) -> i64
vs-graph
only.time spent processing frames in nanoseconds
getNodeDependencies: unsafe extern "system" fn(node: *mut VSNode) -> *const VSFilterDependency
vs-graph
only.getNumNodeDependencies: unsafe extern "system" fn(node: *mut VSNode) -> c_int
vs-graph
only.Implementations§
source§impl VSAPI
impl VSAPI
sourcepub unsafe fn is_same_video_preset_format(
&self,
preset_format: VSPresetVideoFormat,
v: &VSVideoFormat,
core: *mut VSCore
) -> bool
pub unsafe fn is_same_video_preset_format( &self, preset_format: VSPresetVideoFormat, v: &VSVideoFormat, core: *mut VSCore ) -> bool
Convenience function to check if a clip has the same format as a format id
Safety
core
must be valid