|
Olaf
Overly Lightweight Acoustic Fingerprinting
|
Olaf fingerprint database. More...
#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | Olaf_Resource_Meta_data |
| A struct containing meta data on indexed audio files. More... | |
Typedefs | |
| typedef struct Olaf_DB | Olaf_DB |
| typedef struct Olaf_Resource_Meta_data | Olaf_Resource_Meta_data |
Functions | |
| Olaf_DB * | olaf_db_new (const char *db_file_folder, bool readonly) |
| void | olaf_db_destroy (Olaf_DB *db) |
| void | olaf_db_store_meta_data (Olaf_DB *db, uint32_t *key, Olaf_Resource_Meta_data *value) |
| void | olaf_db_find_meta_data (Olaf_DB *db, uint32_t *key, Olaf_Resource_Meta_data *value) |
| void | olaf_db_delete_meta_data (Olaf_DB *db, uint32_t *key) |
| bool | olaf_db_has_meta_data (Olaf_DB *db, uint32_t *key) |
| void | olaf_db_stats_meta_data (Olaf_DB *db, bool verbose) |
| void | olaf_db_store (Olaf_DB *db, uint64_t *keys, uint64_t *values, size_t size) |
| void | olaf_db_delete (Olaf_DB *db, uint64_t *keys, uint64_t *values, size_t size) |
| size_t | olaf_db_find (Olaf_DB *db, uint64_t start_key, uint64_t stop_key, uint64_t *results, size_t results_size) |
| bool | olaf_db_find_single (Olaf_DB *db, uint64_t start_key, uint64_t stop_key) |
| void | olaf_db_stats (Olaf_DB *db, bool verbose) |
| uint32_t | olaf_db_string_hash (const char *key, size_t len) |
Olaf fingerprint database.
The interface to a data store with fingerprints. There are two implementations included in Olaf. A persistent key value store backed by a B-tree (LMDB) or an in memory store.
The data store is a list of fingerprint hashes (uint64_t) pointing to a value (also uint64_t) The value consists of: *
Hash collisions are possible so duplicates should be allowed.
| void olaf_db_delete | ( | Olaf_DB * | db, |
| uint64_t * | keys, | ||
| uint64_t * | values, | ||
| size_t | size ) |
Delete a list of elements in the data store.
| db | The database. |
| keys | A list of keys: the 64bit fingerprint hash. |
| values | A list of values: Typically the highest 32bits contain a timestamp, the lowest 32bits an audio identifier. |
| size | The size of both the keys and values arrays. |
| void olaf_db_delete_meta_data | ( | Olaf_DB * | db, |
| uint32_t * | key ) |
Delete meta-data.
| db | The database. |
| key | The audio identifier to delete meta-data for.- |
| void olaf_db_destroy | ( | Olaf_DB * | db | ) |
Free database related memory resources and close files or other resources.
| db | the database to close. |
| size_t olaf_db_find | ( | Olaf_DB * | db, |
| uint64_t | start_key, | ||
| uint64_t | stop_key, | ||
| uint64_t * | results, | ||
| size_t | results_size ) |
Find a list of elements in the database store
| db | The database. |
| start_key | The begin key to start returning results from. |
| stop_key | The end key, should be greater than start_key. |
| results | An array to store the results in. |
| results_size | the maximum size of the results array. |
| void olaf_db_find_meta_data | ( | Olaf_DB * | db, |
| uint32_t * | key, | ||
| Olaf_Resource_Meta_data * | value ) |
Search meta-data.
| db | The database. |
| key | The audio identifier. |
| value | Where to store meta-data information on the audio. |
| bool olaf_db_find_single | ( | Olaf_DB * | db, |
| uint64_t | start_key, | ||
| uint64_t | stop_key ) |
Checks if a hash is present in the database.
| db | The database. |
| start_key | The begin key to start returning results from. |
| stop_key | The end key, should be greater than start_key. |
| bool olaf_db_has_meta_data | ( | Olaf_DB * | db, |
| uint32_t * | key ) |
Check if there is meta data for a key.
| db | The database. |
| key | The audio identifier. |
| Olaf_DB * olaf_db_new | ( | const char * | db_file_folder, |
| bool | readonly ) |
Creates a new database, if the file name exists, read the contents
| db_file_folder | The folder used to store database files |
| readonly | The mode to open the database, if no write operations are expected this should be true. |
| void olaf_db_stats | ( | Olaf_DB * | db, |
| bool | verbose ) |
Print database statistics.
| db | The database. |
| verbose | Print more information than usual. |
| void olaf_db_stats_meta_data | ( | Olaf_DB * | db, |
| bool | verbose ) |
Print meta database statistics.
| db | The database. |
| verbose | Print more information than usual. |
| void olaf_db_store | ( | Olaf_DB * | db, |
| uint64_t * | keys, | ||
| uint64_t * | values, | ||
| size_t | size ) |
Store a list of elements in the data store.
| db | The database. |
| keys | A list of keys: the 64bit fingerprint hash. |
| values | A list of values: Typically the highest 32bits contain a timestamp, the lowest 32bits an audio identifier. |
| size | The size of both the keys and values arrays. |
| void olaf_db_store_meta_data | ( | Olaf_DB * | db, |
| uint32_t * | key, | ||
| Olaf_Resource_Meta_data * | value ) |
Store meta-data.
| db | The database to store info in. |
| key | The audio identifier. |
| value | The meta-data with information on the audio. |
| uint32_t olaf_db_string_hash | ( | const char * | key, |
| size_t | len ) |
Hash a string into a 32 bit integer e.g. using a Jenkins hash. This can be practial to convert an audio file name into an identifier.
| key | The list of characters. |
| len | The length of the string. |