summaryrefslogtreecommitdiffstats
path: root/src/grabbers
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/grabbers
parent1bd51b02d016260772da443c0ada990f3b2e21c8 (diff)
downloadlibuca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.tar.gz
libuca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.tar.bz2
libuca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.tar.xz
libuca-8d478b91633c9e549cbd51fb6e18428707aa0cc8.zip
Fix potential bugs and use generic reorder function
Diffstat (limited to 'src/grabbers')
-rw-r--r--src/grabbers/me4.c10
1 files changed, 6 insertions, 4 deletions
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;