Table of Contents

Class VFPAPI

Namespace
VisioForge.Core.VideoFingerPrinting
Assembly
VisioForge.Core.dll

Provides platform-agnostic access to the native video fingerprinting library functions.

public static class VFPAPI

Inheritance

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

string

IsLibraryAvailable

Gets a value indicating whether the Video Fingerprinting library is available.

public static bool IsLibraryAvailable { get; }

Property Value

bool

LibraryLoadError

Gets the error message if the library failed to load.

public static string LibraryLoadError { get; }

Property Value

string

PlatformName

Gets the current platform name.

public static string PlatformName { get; }

Property Value

string

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

pLen int

When this method returns, contains the length of the fingerprint data in bytes.

pDataTmp nint

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

pDataTmp nint

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

pData1 nint

Pointer to the first fingerprint data.

iLen1 int

Length of the first fingerprint in bytes.

pData2 nint

Pointer to the second fingerprint data.

iLen2 int

Length of the second fingerprint in bytes.

MaxS int

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

data1 nint

Pointer to the first fingerprint data.

len1 int

Length of the first fingerprint in bytes.

data2 nint

Pointer to the second fingerprint data.

len2 int

Length of the second fingerprint in bytes.

maxShift int

Maximum allowed time shift in seconds for comparison.

mirrorMode int

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

count int

The expected duration of the video in seconds.

pDataTmp nint

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

count int

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

p nint

Pointer to the RGB24 frame data.

w int

Width of the frame in pixels.

h int

Height of the frame in pixels.

s int

Stride (row pitch) of the frame data in bytes.

dTime double

Timestamp of the frame in milliseconds.

pDataTmp nint

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

pLen int

When this method returns, contains the length of the fingerprint data in bytes.

pDataTmp nint

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

pDataTmp nint

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

count int

The expected duration of the video in seconds.

pDataTmp nint

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

count int

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

p nint

Pointer to the RGB24 frame data.

w int

Width of the frame in pixels.

h int

Height of the frame in pixels.

s int

Stride (row pitch) of the frame data in bytes.

dTime double

Timestamp of the frame in milliseconds.

pDataTmp nint

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

pData1 nint

Pointer to the first fingerprint data (needle).

iLen1 int

Length of the first fingerprint in bytes.

iSkip1 int

Number of seconds to skip from the beginning of the first fingerprint.

pData2 nint

Pointer to the second fingerprint data (haystack).

iLen2 int

Length of the second fingerprint in bytes.

iSkip2 int

Number of seconds to skip from the beginning of the second fingerprint.

pDiff double

When this method returns, contains the difference score of the best match.

maxDiff int

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

data1 nint

Pointer to the first fingerprint data (needle).

len1 int

Length of the first fingerprint in bytes.

data2 nint

Pointer to the second fingerprint data (haystack).

len2 int

Length of the second fingerprint in bytes.

diff int

When this method returns, contains the difference score of the best match.

pos int

When this method returns, contains the position where the match was found.

mirrorMode int

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

data1 nint

Pointer to the first fingerprint data (needle).

len1 int

Length of the first fingerprint in bytes.

data2 nint

Pointer to the second fingerprint data (haystack).

len2 int

Length of the second fingerprint in bytes.

diff int

When this method returns, contains the difference score of the best match.

pos int

When this method returns, contains the position where the match was found.

mirrorMode int

When this method returns, contains the detected mirror mode.

duration1 double

Duration of the first video in seconds.

duration2 double

Duration of the second video in seconds.

VFPSetLicenseKey(string)

Sets license key.

public static void VFPSetLicenseKey(string licenseKey)

Parameters

licenseKey string

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

true if the process is 32-bit; false if it is 64-bit.