diff options
author | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-02-23 17:19:26 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-02-23 17:19:26 +0100 |
commit | f67ca1ef8a7e220084980847c5c466a9ca1b05b1 (patch) | |
tree | 6ab9c3abc11fc8f066f5c01173a2989c34ba36a6 /src/uca.c | |
parent | aa6ebf67fa2601a5fc087423be3ad40d742e1cd3 (diff) | |
download | uca-f67ca1ef8a7e220084980847c5c466a9ca1b05b1.tar.gz uca-f67ca1ef8a7e220084980847c5c466a9ca1b05b1.tar.bz2 uca-f67ca1ef8a7e220084980847c5c466a9ca1b05b1.tar.xz uca-f67ca1ef8a7e220084980847c5c466a9ca1b05b1.zip |
Scrap accessor functions and replace with get/set_property
Diffstat (limited to 'src/uca.c')
-rw-r--r-- | src/uca.c | 39 |
1 files changed, 31 insertions, 8 deletions
@@ -31,14 +31,8 @@ struct uca_t *uca_init() NULL }; /* Set all function pointers to NULL and thus make the class abstract */ - uca->cam_destroy = NULL; - uca->cam_set_dimensions = NULL; - uca->cam_set_bitdepth = NULL; - uca->cam_set_delay = NULL; - uca->cam_set_exposure = NULL; - uca->cam_acquire_image = NULL; - - uca->camera_name = NULL; + uca->cam_set_property = NULL; + uca->cam_get_property = NULL; int i = 0; while (inits[i] != NULL) { @@ -60,3 +54,32 @@ void uca_destroy(struct uca_t *uca) free(uca); } } + +static const char* property_map[] = { + "name", + "width", + "height", + "max-width", + "max-height", + "bit-depth", + "exposure", + "frame-rate", + NULL +}; + +int32_t uca_get_property_id(const char *property_name) +{ + char *name; + int i = 0; + while (property_map[i] != NULL) { + if (!strcmp(property_map[i], property_name)) + return i; + } + return UCA_PROP_INVALID; +} + +const char* uca_get_property_name(int32_t property_id) +{ + /* TODO: guard that thing */ + return property_map[property_id]; +} |