summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-22 12:24:52 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-22 12:24:52 +0100
commit8d478b91633c9e549cbd51fb6e18428707aa0cc8 (patch)
treee6462b4d4e9b7c89c8d6f18eeaacf3b4f8c0dc5f /src
parent1bd51b02d016260772da443c0ada990f3b2e21c8 (diff)
downloaduca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.tar.gz
uca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.tar.bz2
uca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.tar.xz
uca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.zip
Fix potential bugs and use generic reorder function
Diffstat (limited to 'src')
-rw-r--r--src/cameras/pco.c18
-rw-r--r--src/grabbers/me4.c10
2 files changed, 14 insertions, 14 deletions
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
index 3801157..2424300 100644
--- a/src/cameras/pco.c
+++ b/src/cameras/pco.c
@@ -7,7 +7,7 @@
#include "uca-grabber.h"
#include "pco.h"
-#define GET_PCO(uca) ((struct pco_edge_t *)(uca->user))
+#define GET_PCO(uca) ((struct pco_edge *)(uca->user))
#define set_void(p, type, value) { *((type *) p) = (type) value; }
@@ -84,7 +84,7 @@ static uint32_t uca_pco_set_property(struct uca_camera *cam, enum uca_property_i
static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_ids property, void *data, size_t num)
{
- struct pco_edge_t *pco = GET_PCO(cam);
+ struct pco_edge *pco = GET_PCO(cam);
struct uca_grabber *grabber = cam->grabber;
switch (property) {
@@ -197,7 +197,7 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
uint32_t uca_pco_start_recording(struct uca_camera *cam)
{
- struct pco_edge_t *pco = GET_PCO(cam);
+ struct pco_edge *pco = GET_PCO(cam);
if (pco_arm_camera(pco) != PCO_NOERROR)
return UCA_ERR_CAM_ARM;
if (pco_set_rec_state(pco, 1) != PCO_NOERROR)
@@ -218,9 +218,8 @@ uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data)
uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
if (err != UCA_NO_ERROR)
return err;
- /* FIXME: choose according to data format */
- //pco_reorder_image_5x16((uint16_t *) buffer, frame, cam->frame_width, cam->frame_height);
- memcpy(buffer, frame, cam->frame_width*cam->frame_height*2);
+
+ GET_PCO(cam)->reorder_image((uint16_t *) buffer, frame, cam->frame_width, cam->frame_height);
return UCA_NO_ERROR;
}
@@ -240,10 +239,9 @@ uint32_t uca_pco_init(struct uca_camera **cam, struct uca_grabber *grabber)
if (grabber == NULL)
return UCA_ERR_CAM_NOT_FOUND;
- struct pco_edge_t *pco = pco_init();
- if (pco == NULL) {
+ struct pco_edge *pco = pco_init();
+ if (pco == NULL)
return UCA_ERR_CAM_NOT_FOUND;
- }
if ((pco->serial_ref == NULL) || !pco_is_active(pco)) {
pco_destroy(pco);
@@ -274,7 +272,7 @@ uint32_t uca_pco_init(struct uca_camera **cam, struct uca_grabber *grabber)
int val = UCA_CL_8BIT_FULL_10;
grabber->set_property(grabber, UCA_GRABBER_CAMERALINK_TYPE, &val);
- val = UCA_FORMAT_GRAY8;
+ val = UCA_FORMAT_GRAY8;;
grabber->set_property(grabber, UCA_GRABBER_FORMAT, &val);
val = UCA_TRIGGER_FREERUN;
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
index 4c6420e..cc7af2c 100644
--- a/src/grabbers/me4.c
+++ b/src/grabbers/me4.c
@@ -99,15 +99,17 @@ uint32_t uca_me4_get_property(struct uca_grabber *grabber, enum uca_grabber_cons
uint32_t uca_me4_alloc(struct uca_grabber *grabber, uint32_t pixel_size, uint32_t n_buffers)
{
- if (GET_MEM(grabber) != NULL)
- /* FIXME: invent better error code */
- return UCA_ERR_PROP_GENERAL;
+ dma_mem *mem = GET_MEM(grabber);
+ /* If buffers are already allocated, we are freeing every buffer and start
+ * again. */
+ if (mem != NULL)
+ Fg_FreeMemEx(GET_FG(grabber), mem);
uint32_t width, height;
uca_me4_get_property(grabber, UCA_GRABBER_WIDTH, &width);
uca_me4_get_property(grabber, UCA_GRABBER_HEIGHT, &height);
- dma_mem *mem = Fg_AllocMemEx(GET_FG(grabber), n_buffers*width*height*pixel_size, n_buffers);
+ mem = Fg_AllocMemEx(GET_FG(grabber), n_buffers*width*height*pixel_size, n_buffers);
if (mem != NULL) {
((struct fg_apc_data *) grabber->user)->mem = mem;
return UCA_NO_ERROR;