summaryrefslogtreecommitdiffstats
path: root/bin/gui
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-07-26 09:45:55 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-07-26 09:45:55 +0200
commit9eb6907963360f65ba2d538add0a03d0fd181991 (patch)
tree23f3b3e7b21173d51ff7e90c87c9f5d7059ae5b1 /bin/gui
parentc32a444926402c33c1cd04dc688fa744c8d187db (diff)
downloadlibuca-9eb6907963360f65ba2d538add0a03d0fd181991.tar.gz
libuca-9eb6907963360f65ba2d538add0a03d0fd181991.tar.bz2
libuca-9eb6907963360f65ba2d538add0a03d0fd181991.tar.xz
libuca-9eb6907963360f65ba2d538add0a03d0fd181991.zip
Show frames in chronological order
Diffstat (limited to 'bin/gui')
-rw-r--r--bin/gui/control.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/gui/control.c b/bin/gui/control.c
index b210e16..b8023f7 100644
--- a/bin/gui/control.c
+++ b/bin/gui/control.c
@@ -66,6 +66,7 @@ typedef struct {
gint display_width, display_height;
gdouble zoom_factor;
State state;
+ guint n_recorded;
gboolean data_in_camram;
gint timestamp;
@@ -347,6 +348,7 @@ record_frames (gpointer args)
data = (ThreadData *) args;
ring_buffer_reset (data->buffer);
+ data->n_recorded = 0;
n_max = (guint) gtk_adjustment_get_value (data->count);
while (1) {
@@ -362,6 +364,7 @@ record_frames (gpointer args)
if (error == NULL) {
ring_buffer_proceed (data->buffer);
n_frames++;
+ data->n_recorded++;
}
else
print_and_free_error (&error);
@@ -404,8 +407,14 @@ update_current_frame (ThreadData *data)
{
gpointer buffer;
guint index;
+ guint n_max;
index = (guint) gtk_adjustment_get_value (data->frame_slider);
+ n_max = ring_buffer_get_num_blocks (data->buffer);
+
+ /* Shift index so that we always show the oldest frames first */
+ index = (index + data->n_recorded - n_max) % n_max;
+
ring_buffer_set_current_pointer (data->buffer, index);
buffer = ring_buffer_get_current_pointer (data->buffer);