summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cameras/pco.c18
-rw-r--r--src/grabbers/me4.c10
-rw-r--r--test/control.c3
-rw-r--r--test/grab.c2
4 files changed, 18 insertions, 15 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;
diff --git a/test/control.c b/test/control.c
index 7f013e2..2d954f9 100644
--- a/test/control.c
+++ b/test/control.c
@@ -75,6 +75,9 @@ void reallocate_buffers(ThreadData *td, int width, int height)
td->pixels = gdk_pixbuf_get_pixels(td->pixbuf);
gtk_image_set_from_pixbuf(GTK_IMAGE(td->image), td->pixbuf);
memset(td->buffer, 0, num_bytes);
+
+ if (uca_cam_alloc(td->cam, 20) != UCA_NO_ERROR)
+ g_print("Couldn't allocate buffer for 20 frames\n");
}
static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
diff --git a/test/grab.c b/test/grab.c
index 34b90c8..8c5e78c 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
/* take first camera */
struct uca_camera *cam = u->cameras;
- uint32_t val = 2000;
+ uint32_t val = 5000;
handle_error(cam->set_property(cam, UCA_PROP_EXPOSURE, &val));
val = 0;
handle_error(cam->set_property(cam, UCA_PROP_DELAY, &val));