Class VFPAPI
- Namespace
- VisioForge.Core.VideoFingerPrinting
- Assembly
- VisioForge.Core.dll
Provides platform-agnostic access to the native video fingerprinting library functions.
public static class VFPAPIInheritance
Inherited Members
Remarks
The VisioForge.Core.VideoFingerPrinting.VFPAPI class acts as a wrapper that automatically selects the appropriate native library (x86 or x64) based on the current process architecture. It provides a unified interface for all video fingerprinting operations including search, comparison, and image comparison functionality. All methods delegate to either VisioForge.Core.VideoFingerPrinting.VFPAPI86 or VisioForge.Core.VideoFingerPrinting.VFPAPI64 depending on the platform. Supports Windows, Linux, and macOS platforms with automatic native library resolution.
Properties
ExpectedLibraryName
Gets the expected native library name for the current platform.
public static string ExpectedLibraryName { get; }Property Value
IsLibraryAvailable
Gets a value indicating whether the Video Fingerprinting library is available.
public static bool IsLibraryAvailable { get; }Property Value
LibraryLoadError
Gets the error message if the library failed to load.
public static string LibraryLoadError { get; }Property Value
PlatformName
Gets the current platform name.
public static string PlatformName { get; }Property Value
Methods
Initialize()
Initializes the Video Fingerprinting native library.
public static bool Initialize()Returns
- bool
-
True if initialization succeeded, false otherwise.
VFPCompare_Build(out int, nint)
Builds a comparison fingerprint from processed frame data.
public static nint VFPCompare_Build(out int pLen, nint pDataTmp)Parameters
pLenint-
When this method returns, contains the length of the fingerprint data in bytes.
pDataTmpnint-
Pointer to the comparison data structure containing processed frames.
Returns
- nint
-
A pointer to the fingerprint data. The data remains valid until the comparison structure is cleared.
VFPCompare_Clear(nint)
Clears and releases a comparison data structure.
public static void VFPCompare_Clear(nint pDataTmp)Parameters
pDataTmpnint-
Pointer to the comparison data structure to clear.
Remarks
This method properly cleans up the native comparison structure and releases any internal resources. It should be called when the comparison data is no longer needed.
VFPCompare_Compare(nint, int, nint, int, int)
Compares two video fingerprints to determine their similarity.
public static double VFPCompare_Compare(nint pData1, int iLen1, nint pData2, int iLen2, int MaxS)Parameters
pData1nint-
Pointer to the first fingerprint data.
iLen1int-
Length of the first fingerprint in bytes.
pData2nint-
Pointer to the second fingerprint data.
iLen2int-
Length of the second fingerprint in bytes.
MaxSint-
Maximum allowed time shift in seconds for comparison.
Returns
- double
-
A similarity score between 0 and 100, where 100 indicates identical videos and lower values indicate greater differences.
VFPCompare_CompareMirror(nint, int, nint, int, int, out int)
Compares two video fingerprints with mirror detection support.
public static double VFPCompare_CompareMirror(nint data1, int len1, nint data2, int len2, int maxShift, out int mirrorMode)Parameters
data1nint-
Pointer to the first fingerprint data.
len1int-
Length of the first fingerprint in bytes.
data2nint-
Pointer to the second fingerprint data.
len2int-
Length of the second fingerprint in bytes.
maxShiftint-
Maximum allowed time shift in seconds for comparison.
mirrorModeint-
When this method returns, contains the detected mirror mode.
Returns
- double
-
A similarity score between 0 and 100, where 100 indicates identical videos and lower values indicate greater differences.
VFPCompare_Init(int, nint)
Initializes a comparison data structure with the specified video duration.
public static void VFPCompare_Init(int count, nint pDataTmp)Parameters
countint-
The expected duration of the video in seconds.
pDataTmpnint-
Pointer to pre-allocated memory for the comparison data structure.
Remarks
This method is used for whole-video comparison operations rather than search operations. The memory must be allocated with the correct size for the platform.
VFPCompare_Init2(int)
Initializes and allocates a new comparison data structure.
public static nint VFPCompare_Init2(int count)Parameters
countint-
The expected duration of the video in seconds.
Returns
- nint
-
A pointer to the newly allocated and initialized comparison data structure. The caller is responsible for freeing this memory using VisioForge.Core.VideoFingerPrinting.VFPAPI.VFPCompare_Clear(System.IntPtr).
VFPCompare_Process(nint, int, int, int, double, nint)
Processes a video frame for comparison fingerprint generation.
public static int VFPCompare_Process(nint p, int w, int h, int s, double dTime, nint pDataTmp)Parameters
pnint-
Pointer to the RGB24 frame data.
wint-
Width of the frame in pixels.
hint-
Height of the frame in pixels.
sint-
Stride (row pitch) of the frame data in bytes.
dTimedouble-
Timestamp of the frame in milliseconds.
pDataTmpnint-
Pointer to the comparison data structure.
Returns
- int
-
Returns a non-zero value on success, 0 on failure.
VFPSearch_Build(out int, nint)
Builds a search fingerprint from processed frame data.
public static nint VFPSearch_Build(out int pLen, nint pDataTmp)Parameters
pLenint-
When this method returns, contains the length of the fingerprint data in bytes.
pDataTmpnint-
Pointer to the search data structure containing processed frames.
Returns
- nint
-
A pointer to the fingerprint data. The data remains valid until the search structure is cleared.
VFPSearch_Clear(nint)
Clears and releases a search data structure.
public static void VFPSearch_Clear(nint pDataTmp)Parameters
pDataTmpnint-
Pointer to the search data structure to clear.
Remarks
This method properly cleans up the native search structure and releases any internal resources. It should be called when the search data is no longer needed.
VFPSearch_Init(int, nint)
Initializes a search data structure with the specified video duration.
public static void VFPSearch_Init(int count, nint pDataTmp)Parameters
countint-
The expected duration of the video in seconds.
pDataTmpnint-
Pointer to pre-allocated memory for the search data structure.
Remarks
This method initializes the native search structure in pre-allocated memory. The memory must be allocated with the correct size for the platform (48 bytes for x86, 80 bytes for x64).
Exceptions
- InvalidOperationException
-
Thrown when the native library is not available.
VFPSearch_Init2(int)
Initializes and allocates a new search data structure.
public static nint VFPSearch_Init2(int count)Parameters
countint-
The expected duration of the video in seconds.
Returns
- nint
-
A pointer to the newly allocated and initialized search data structure. The caller is responsible for freeing this memory using VisioForge.Core.VideoFingerPrinting.VFPAPI.VFPSearch_Clear(System.IntPtr).
VFPSearch_Process(nint, int, int, int, double, nint)
Processes a video frame for search fingerprint generation.
public static int VFPSearch_Process(nint p, int w, int h, int s, double dTime, nint pDataTmp)Parameters
pnint-
Pointer to the RGB24 frame data.
wint-
Width of the frame in pixels.
hint-
Height of the frame in pixels.
sint-
Stride (row pitch) of the frame data in bytes.
dTimedouble-
Timestamp of the frame in milliseconds.
pDataTmpnint-
Pointer to the search data structure.
Returns
- int
-
Returns a non-zero value on success, 0 on failure.
VFPSearch_Search(nint, int, int, nint, int, int, out double, int)
Searches for a video fragment within another video using fingerprints.
public static int VFPSearch_Search(nint pData1, int iLen1, int iSkip1, nint pData2, int iLen2, int iSkip2, out double pDiff, int maxDiff)Parameters
pData1nint-
Pointer to the first fingerprint data (needle).
iLen1int-
Length of the first fingerprint in bytes.
iSkip1int-
Number of seconds to skip from the beginning of the first fingerprint.
pData2nint-
Pointer to the second fingerprint data (haystack).
iLen2int-
Length of the second fingerprint in bytes.
iSkip2int-
Number of seconds to skip from the beginning of the second fingerprint.
pDiffdouble-
When this method returns, contains the difference score of the best match.
maxDiffint-
Maximum allowed difference threshold for a valid match.
Returns
- int
-
The position in seconds where the match was found, or a large value if no match found.
VFPSearch_SearchMirror(nint, int, nint, int, out int, out int, out int)
Searches for a video fragment within another video with mirror detection.
public static void VFPSearch_SearchMirror(nint data1, int len1, nint data2, int len2, out int diff, out int pos, out int mirrorMode)Parameters
data1nint-
Pointer to the first fingerprint data (needle).
len1int-
Length of the first fingerprint in bytes.
data2nint-
Pointer to the second fingerprint data (haystack).
len2int-
Length of the second fingerprint in bytes.
diffint-
When this method returns, contains the difference score of the best match.
posint-
When this method returns, contains the position where the match was found.
mirrorModeint-
When this method returns, contains the detected mirror mode.
VFPSearch_SearchMirror2(nint, int, nint, int, out int, out int, out int, double, double)
Searches for a video fragment within another video with mirror detection and duration hints.
public static void VFPSearch_SearchMirror2(nint data1, int len1, nint data2, int len2, out int diff, out int pos, out int mirrorMode, double duration1, double duration2)Parameters
data1nint-
Pointer to the first fingerprint data (needle).
len1int-
Length of the first fingerprint in bytes.
data2nint-
Pointer to the second fingerprint data (haystack).
len2int-
Length of the second fingerprint in bytes.
diffint-
When this method returns, contains the difference score of the best match.
posint-
When this method returns, contains the position where the match was found.
mirrorModeint-
When this method returns, contains the detected mirror mode.
duration1double-
Duration of the first video in seconds.
duration2double-
Duration of the second video in seconds.
VFPSetLicenseKey(string)
Sets license key.
public static void VFPSetLicenseKey(string licenseKey)Parameters
licenseKeystring-
License key.
Exceptions
- InvalidOperationException
-
Thrown when the native library is not available.
X86()
Determines whether the current process is running as a 32-bit (x86) application.
public static bool X86()Returns
- bool
-
trueif the process is 32-bit;falseif it is 64-bit.