From 961e60a89bc60e760707892539ccd7c6d283ef01 Mon Sep 17 00:00:00 2001
From: Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
Date: Thu, 13 Feb 2014 14:54:34 +0100
Subject: Fix #28: Add buffered recording to base class

This change adds new properties ::buffered and ::num-buffers to the base class.
If ::buffered is TRUE, uca_camera_start_recording will spawn a new thread which
will call the camera-specific grab. Any call to uca_camera_grab will return the
next item from the ring buffer.
---
 bin/gui/control.c | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'bin/gui')

diff --git a/bin/gui/control.c b/bin/gui/control.c
index d4191a1..b02c42d 100644
--- a/bin/gui/control.c
+++ b/bin/gui/control.c
@@ -752,6 +752,7 @@ record_frames (gpointer args)
 
         buffer = uca_ring_buffer_get_write_pointer (data->buffer);
         uca_camera_grab (data->camera, buffer, NULL);
+        uca_ring_buffer_write_advance (data->buffer);
 
         if (error == NULL) {
             n_frames++;
@@ -949,6 +950,7 @@ download_frames (ThreadData *data)
     while (error == NULL) {
         buffer = uca_ring_buffer_get_write_pointer (data->buffer);
         uca_camera_grab (data->camera, buffer, &error);
+        uca_ring_buffer_write_advance (data->buffer);
 
         gdk_threads_enter ();
         gtk_adjustment_set_value (data->download_adjustment, current_frame++);
-- 
cgit v1.2.3