diff options
author | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-18 11:10:00 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-18 11:10:00 +0100 |
commit | ef5dfb7febd8881158e493451a27a2500ced14cb (patch) | |
tree | 142d3fce467aa076a4f38437058a5e93f1fecdb7 /src/uca-cam.c | |
parent | 750080d576dadb9c29ac5f565b8e16c8b9aa4a7d (diff) | |
download | libuca-ef5dfb7febd8881158e493451a27a2500ced14cb.tar.gz libuca-ef5dfb7febd8881158e493451a27a2500ced14cb.tar.bz2 libuca-ef5dfb7febd8881158e493451a27a2500ced14cb.tar.xz libuca-ef5dfb7febd8881158e493451a27a2500ced14cb.zip |
Initialize all camera fields with NULL to catch errors early on
Diffstat (limited to 'src/uca-cam.c')
-rw-r--r-- | src/uca-cam.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/uca-cam.c b/src/uca-cam.c index eb76fad..b26b826 100644 --- a/src/uca-cam.c +++ b/src/uca-cam.c @@ -19,3 +19,31 @@ enum uca_cam_state uca_cam_get_state(struct uca_camera *cam) return cam->state; } +struct uca_camera *uca_cam_new(void) +{ + struct uca_camera *cam = (struct uca_camera *) malloc(sizeof(struct uca_camera)); + + cam->next = NULL; + + /* Set all function pointers to NULL so we know early on, if something has + * not been implemented. */ + cam->set_property = NULL; + cam->get_property = NULL; + cam->start_recording = NULL; + cam->stop_recording = NULL; + cam->grab = NULL; + cam->register_callback = NULL; + cam->destroy = NULL; + + cam->user = NULL; + + cam->grabber = NULL; + cam->state = UCA_CAM_CONFIGURABLE; + cam->current_frame = 0; + + /* No callbacks and user data associated yet */ + cam->callback = NULL; + cam->callback_user = NULL; + + return cam; +} |