invisible

diff src/frame.cc @ 1:fdbd55eaa14e

add frame class, mutices
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Sat, 05 Oct 2013 19:02:40 +0300
parents
children b0b90ef993a0
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/frame.cc	Sat Oct 05 19:02:40 2013 +0300
     1.3 @@ -0,0 +1,27 @@
     1.4 +#include <stdio.h>
     1.5 +#include <pthread.h>
     1.6 +
     1.7 +#include "frame.h"
     1.8 +
     1.9 +static pthread_mutex_t video_mutex = PTHREAD_MUTEX_INITIALIZER;
    1.10 +static pthread_mutex_t depth_mutex = PTHREAD_MUTEX_INITIALIZER;
    1.11 +
    1.12 +void init_frame_mx()
    1.13 +{
    1.14 +	pthread_mutex_init(&video_mutex, NULL);
    1.15 +	pthread_mutex_init(&depth_mutex, NULL);
    1.16 +}
    1.17 +
    1.18 +void video_cb(freenect_device *kin_dev, void *rgb, uint32_t time)
    1.19 +{
    1.20 +	pthread_mutex_lock(&video_mutex);
    1.21 +	printf("Started video.\n");
    1.22 +	pthread_mutex_unlock(&video_mutex);
    1.23 +}
    1.24 +
    1.25 +void depth_cb(freenect_device *kin_dev, void *depth, uint32_t time)
    1.26 +{
    1.27 +	pthread_mutex_lock(&depth_mutex);
    1.28 +	printf("Started depth.\n");
    1.29 +	pthread_mutex_unlock(&depth_mutex);
    1.30 +}