summaryrefslogtreecommitdiffstats
path: root/src/grabbers/me4.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-28 17:48:55 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-28 17:48:55 +0100
commit28873ccf3f3f32486049eb40cd639bbab86e09dc (patch)
tree1411086a03efeee7ce8051a362bc2f83ac2a929b /src/grabbers/me4.c
parentf6f2bafe19fd57c56201e79be6b7692f16f16099 (diff)
downloadlibuca-28873ccf3f3f32486049eb40cd639bbab86e09dc.tar.gz
libuca-28873ccf3f3f32486049eb40cd639bbab86e09dc.tar.bz2
libuca-28873ccf3f3f32486049eb40cd639bbab86e09dc.tar.xz
libuca-28873ccf3f3f32486049eb40cd639bbab86e09dc.zip
Start grab interface
Diffstat (limited to 'src/grabbers/me4.c')
-rw-r--r--src/grabbers/me4.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
index 5b46c79..2196172 100644
--- a/src/grabbers/me4.c
+++ b/src/grabbers/me4.c
@@ -1,5 +1,6 @@
#include <stdlib.h>
+#include <string.h>
#include <clser.h>
#include <fgrab_struct.h>
#include <fgrab_prototyp.h>
@@ -49,6 +50,21 @@ uint32_t uca_me4_alloc(struct uca_grabber_t *grabber, uint32_t n_buffers)
return UCA_ERR_PROP_GENERAL;
}
+uint32_t uca_me4_acquire(struct uca_grabber_t *grabber, int32_t n_frames, bool async)
+{
+ if (GET_MEM(grabber) != NULL) {
+ if (Fg_AcquireEx(GET_FG(grabber), 0, n_frames, ACQ_STANDARD, GET_MEM(grabber)) != FG_OK)
+ return UCA_NO_ERROR;
+ }
+ return UCA_ERR_PROP_GENERAL;
+}
+
+uint32_t uca_me4_grab(struct uca_grabber_t *grabber, char *buffer, size_t n_bytes)
+{
+ uint32_t last_frame = Fg_getLastPicNumber(GET_FG(grabber), PORT_A);
+ memcpy(buffer, Fg_getImagePtrEx(GET_FG(grabber), last_frame, PORT_A, GET_MEM(grabber)), n_bytes);
+}
+
uint32_t uca_me4_init(struct uca_grabber_t **grabber)
{
/* FIXME: find out if this board/grabber is running */
@@ -66,6 +82,8 @@ uint32_t uca_me4_init(struct uca_grabber_t **grabber)
uca->set_property = &uca_me4_set_property;
uca->get_property = &uca_me4_get_property;
uca->alloc = &uca_me4_alloc;
+ uca->acquire = &uca_me4_acquire;
+ uca->grab = &uca_me4_grab;
*grabber = uca;
return UCA_NO_ERROR;