Olaf
Overly Lightweight Acoustic Fingerprinting
Loading...
Searching...
No Matches
olaf_fp_matcher.h File Reference

Provides an algorithm to match extracted fingerprints with the indexed fingerprints in the database. More...

#include "olaf_fp_extractor.h"
#include "olaf_db.h"
#include "olaf_config.h"

Go to the source code of this file.

Typedefs

typedef void(* Olaf_FP_Matcher_Result_Callback) (int matchCount, float queryStart, float queryStop, const char *path, uint32_t matchIdentifier, float referenceStart, float referenceStop)
 Callback function template to respond to a result.
typedef struct Olaf_FP_Matcher Olaf_FP_Matcher

Functions

Olaf_FP_Matcherolaf_fp_matcher_new (Olaf_Config *config, Olaf_DB *db, Olaf_FP_Matcher_Result_Callback callback)
 Initialize a new matcher.
void olaf_fp_matcher_match (Olaf_FP_Matcher *olaf_fp_matcher, struct extracted_fingerprints *olaf_fps)
 Match fingerprints with the database.
void olaf_fp_matcher_callback_print_header (void)
 Print a header for the CSV output.
void olaf_fp_matcher_callback_print_result (int matchCount, float queryStart, float queryStop, const char *path, uint32_t matchIdentifier, float referenceStart, float referenceStop)
 Prints a match result using the specified format.
void olaf_fp_matcher_print_results (Olaf_FP_Matcher *olaf_fp_matcher)
 Print the current results.
void olaf_fp_matcher_destroy (Olaf_FP_Matcher *olaf_fp_matcher)
 Free used memory and resources, does not close the database resources!

Detailed Description

Provides an algorithm to match extracted fingerprints with the indexed fingerprints in the database.

Typedef Documentation

◆ Olaf_FP_Matcher_Result_Callback

typedef void(* Olaf_FP_Matcher_Result_Callback) (int matchCount, float queryStart, float queryStop, const char *path, uint32_t matchIdentifier, float referenceStart, float referenceStop)

Callback function template to respond to a result.

Parameters
matchCountThe number of matches. If zero, this means an empty result.
queryStartThe match start time, in seconds, in the query.
queryStopThe match end time, in seconds, of the query fingerprint.
pathThe path of the matched resource.
matchIdentifierThe identifier of the matched audio file.
referenceStartThe match start time, in seconds, of the reference fingerprint.
referenceStopThe match end time, in seconds, of the reference fingerprint.

Function Documentation

◆ olaf_fp_matcher_callback_print_result()

void olaf_fp_matcher_callback_print_result ( int matchCount,
float queryStart,
float queryStop,
const char * path,
uint32_t matchIdentifier,
float referenceStart,
float referenceStop )

Prints a match result using the specified format.

This function is an example of a callback function that can be used with olaf_fp_matcher_callback_print_results. It prints a single match result in a specific format.

Parameters
matchCountThe number of matches.
queryStartThe match start time, in seconds, in the query.
queryStopThe match end time, in seconds, of the query fingerprint.
pathThe path of the matched resource.
matchIdentifierThe identifier of the matched audio file.
referenceStartThe match start time, in seconds, of the reference fingerprint.
referenceStopThe match end time, in seconds, of the reference fingerprint.

◆ olaf_fp_matcher_destroy()

void olaf_fp_matcher_destroy ( Olaf_FP_Matcher * olaf_fp_matcher)

Free used memory and resources, does not close the database resources!

Parameters
olaf_fp_matcherThe olaf fp matcher

◆ olaf_fp_matcher_match()

void olaf_fp_matcher_match ( Olaf_FP_Matcher * olaf_fp_matcher,
struct extracted_fingerprints * olaf_fps )

Match fingerprints with the database.

Parameters
olaf_fp_matcherThe olaf fp matcher
olaf_fpsThe fingerprints

◆ olaf_fp_matcher_new()

Olaf_FP_Matcher * olaf_fp_matcher_new ( Olaf_Config * config,
Olaf_DB * db,
Olaf_FP_Matcher_Result_Callback callback )

Initialize a new matcher.

Parameters
configThe current configuration
dbThe database
Returns
A newly initialzed state struct, or undefined if memory could not be allocated.

◆ olaf_fp_matcher_print_results()

void olaf_fp_matcher_print_results ( Olaf_FP_Matcher * olaf_fp_matcher)

Print the current results.

Parameters
olaf_fp_matcherThe olaf fp matcher