From c1b6c87c62f544fa6353bdb45bd9a21139eb1fa9 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Wed, 27 Apr 2011 09:00:22 +0200 Subject: Do state handling only once in uca.c instead of all camera implementations --- src/cameras/dummy.c | 4 ---- src/cameras/pco.c | 13 +------------ 2 files changed, 1 insertion(+), 16 deletions(-) (limited to 'src/cameras') diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c index 0283989..f0e8545 100644 --- a/src/cameras/dummy.c +++ b/src/cameras/dummy.c @@ -159,8 +159,6 @@ static void *uca_dummy_grab_thread(void *arg) static uint32_t uca_dummy_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data) { uint32_t err = UCA_ERR_CAMERA | UCA_ERR_PROP; - if (cam->state == UCA_CAM_RECORDING) - return err | UCA_ERR_IS_RECORDING; switch (property) { case UCA_PROP_WIDTH: @@ -235,7 +233,6 @@ static uint32_t uca_dummy_start_recording(struct uca_camera_priv *cam) #endif } cam->current_frame = 0; - cam->state = UCA_CAM_RECORDING; return UCA_NO_ERROR; } @@ -247,7 +244,6 @@ static uint32_t uca_dummy_stop_recording(struct uca_camera_priv *cam) free(dc->buffer); dc->buffer = NULL; } - cam->state = UCA_CAM_ARMED; return UCA_NO_ERROR; } diff --git a/src/cameras/pco.c b/src/cameras/pco.c index 9de6467..c11ba24 100644 --- a/src/cameras/pco.c +++ b/src/cameras/pco.c @@ -228,8 +228,6 @@ static uint32_t uca_pco_get_property(struct uca_camera_priv *cam, enum uca_prope static uint32_t uca_pco_start_recording(struct uca_camera_priv *cam) { uint32_t err = UCA_ERR_CAMERA | UCA_ERR_INIT; - if (cam->state == UCA_CAM_RECORDING) - return err | UCA_ERR_IS_RECORDING; struct pco_edge *pco = GET_PCO(cam); if (pco_arm_camera(pco) != PCO_NOERROR) @@ -237,32 +235,23 @@ static uint32_t uca_pco_start_recording(struct uca_camera_priv *cam) if (pco_set_rec_state(pco, 1) != PCO_NOERROR) return err | UCA_ERR_UNCLASSIFIED; - cam->state = UCA_CAM_RECORDING; return cam->grabber->acquire(cam->grabber, -1); } static uint32_t uca_pco_stop_recording(struct uca_camera_priv *cam) { - if ((cam->state == UCA_CAM_RECORDING) && (pco_set_rec_state(GET_PCO(cam), 0) != PCO_NOERROR)) + if (pco_set_rec_state(GET_PCO(cam), 0) != PCO_NOERROR) return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_UNCLASSIFIED; - - cam->state = UCA_CAM_CONFIGURABLE; return UCA_NO_ERROR; } static uint32_t uca_pco_trigger(struct uca_camera_priv *cam) { - if (cam->state != UCA_CAM_RECORDING) - return UCA_ERR_CAMERA | UCA_ERR_TRIGGER | UCA_ERR_NOT_RECORDING; - return cam->grabber->trigger(cam->grabber); } static uint32_t uca_pco_grab(struct uca_camera_priv *cam, char *buffer, void *meta_data) { - if (cam->state != UCA_CAM_RECORDING) - return UCA_ERR_CAMERA | UCA_ERR_NOT_RECORDING; - uint16_t *frame; uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame); if (err != UCA_NO_ERROR) -- cgit v1.2.3