diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-01-17 01:04:15 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-01-29 22:25:04 +0000 |
commit | 68435c2aa880d15575e4eccbe7670439c23f97d0 (patch) | |
tree | 641100586a0a7afa8b0dff58ab7d76fbc12a26b1 /src/backend.h | |
parent | 4cf06693f5b8c7910c354ba5715ed4446bda799c (diff) | |
download | imv-68435c2aa880d15575e4eccbe7670439c23f97d0.tar.gz |
Define sources & backends
Diffstat (limited to 'src/backend.h')
-rw-r--r-- | src/backend.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/backend.h b/src/backend.h new file mode 100644 index 0000000..0da2244 --- /dev/null +++ b/src/backend.h @@ -0,0 +1,30 @@ +#ifndef IMV_BACKEND_H +#define IMV_BACKEND_H + +struct imv_source; + +enum backend_result { + BACKEND_SUCCESS = 0, /* successful load */ + BACKEND_BAD_PATH = 1, /* no such file, bad permissions, etc. */ + BACKEND_UNSUPPORTED = 2, /* unsupported file format */ +}; + +/* A backend is responsible for taking a path, or a raw data pointer, and + * converting that into a source that imv can handle. Each backend + * may be powered by a different image library and support different + * image formats. + */ +struct imv_backend { + /* Name of the backend, for debug and user informational purposes */ + const char *name; + + /* Input: path to open + * Output: initialises the imv_source instance passed in + */ + enum backend_result (*open_path)(const char *path, struct imv_source **src); + + /* Clean up this backend */ + void (*free)(struct imv_backend *backend); +}; + +#endif |