48#ifndef LENSSERIOUS_DB_H
49#define LENSSERIOUS_DB_H
85int ls_db_tokenize(
const char *norm,
char *out_tokens,
int max,
int stride);
238 char *model,
size_t model_size);
249 float *min_aperture,
float *max_aperture);
287 char *model,
size_t model_size,
char *variant,
size_t variant_size);
What this is, and what it deliberately is not.
int ls_db_lenses_for_mount(ls_db_t *db, long long mount_id, long long *out_ids, int max)
The lenses made for one mount.
int ls_db_find_lens(ls_db_t *db, const char *maker, const char *model, float crop, ls_lens_t *out)
Find a lens by maker and model, and fill out with its coefficients.
int ls_db_match_lens(ls_db_t *db, const char *maker, const char *model, long long mount_id, float crop, ls_db_match_t *out, int max)
Find the lenses a free-text name most likely refers to.
int ls_db_meta(ls_db_t *db, const char *key, char *out, size_t out_size)
A meta value by key (built_utc, source, lensfun_db_version, ...).
struct ls_db_match_t ls_db_match_t
void ls_db_close(ls_db_t *db)
Release a handle. Safe on NULL.
int ls_db_list_cameras(ls_db_t *db, long long *out_ids, int max)
Enumerate camera ids, for a GUI's camera picker.
int ls_db_list_lenses(ls_db_t *db, long long *out_ids, int max)
Enumerate lens ids, oldest-inserted first, for tests and for a GUI's lens picker.
int ls_db_tokenize(const char *norm, char *out_tokens, int max, int stride)
The tokens ls_db_match_lens() compares, from an already-normalised name.
int ls_db_lens_fits_mount(ls_db_t *db, long long lens_id, long long mount_id)
Does a lens fit a camera's mount, upstream's compatibility table included?
int ls_db_lens_by_id(ls_db_t *db, long long lens_id, ls_lens_t *out)
Load a lens by its database id, for a caller that already resolved one.
int ls_db_mount_name(ls_db_t *db, long long mount_id, char *out, size_t out_size)
A mount's name.
int ls_db_lens_mounts(ls_db_t *db, long long lens_id, char *out, size_t out_size)
The mounts a lens is made for, joined with ", ".
int ls_db_lens_range(ls_db_t *db, long long lens_id, float *min_focal, float *max_focal, float *min_aperture, float *max_aperture)
The lens's focal and aperture range, for a picker that lists it.
int ls_db_schema_version(const ls_db_t *db)
Schema version of the open file, or -1. Bumped when the layout changes.
struct ls_camera_t ls_camera_t
int ls_db_lens_name(ls_db_t *db, long long lens_id, char *maker, size_t maker_size, char *model, size_t model_size)
The lens's maker/model, as stored.
int ls_db_camera_by_id(ls_db_t *db, long long camera_id, ls_camera_t *out)
Load a camera by its database id, for a caller that already resolved one.
size_t ls_db_token_digest(const char *norm, unsigned char *out, size_t out_size)
Pack a normalised name's tokens into the digest stored in lens_name.tokens.
unsigned ls_db_token_hash(const char *token)
FNV-1a of a token, the hash the stored digest and the matcher both use.
ls_db_t * ls_db_open(const char *path)
Open a database for reading.
int ls_db_find_camera(ls_db_t *db, const char *maker, const char *model, ls_camera_t *out)
Find a camera by maker and model.
int ls_db_camera_name(ls_db_t *db, long long camera_id, char *maker, size_t maker_size, char *model, size_t model_size, char *variant, size_t variant_size)
A camera's maker, model and variant, as stored.
size_t ls_db_normalize(const char *in, char *out, size_t out_size)
The comparison form of a name: ASCII case-folded, punctuation dropped, runs of whitespace collapsed t...
const char * ls_db_error(const ls_db_t *db)
The last error on db, as a string owned by db, or NULL.