invisible

diff src/kinect.cc @ 1:fdbd55eaa14e

add frame class, mutices
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Sat, 05 Oct 2013 19:02:40 +0300
parents 80df8030105b
children b0b90ef993a0
line diff
     1.1 --- a/src/kinect.cc	Sat Oct 05 16:03:08 2013 +0300
     1.2 +++ b/src/kinect.cc	Sat Oct 05 19:02:40 2013 +0300
     1.3 @@ -1,13 +1,9 @@
     1.4  #include <stdio.h>
     1.5  #include <pthread.h>
     1.6  #include <libfreenect.h>
     1.7 +
     1.8  #include "kinect.h"
     1.9 -
    1.10 -static void video_cb(freenect_device *kin_dev, void *rgb, uint32_t time);
    1.11 -static void depth_cb(freenect_device *kin_dev, void *depth, uint32_t time);
    1.12 -
    1.13 -static pthread_mutex_t video_mutex = PTHREAD_MUTEX_INITIALIZER;
    1.14 -static pthread_mutex_t depth_mutex = PTHREAD_MUTEX_INITIALIZER;
    1.15 +#include "frame.h"
    1.16  
    1.17  bool init_kinect(freenect_context **kin_ctx, freenect_device **kin_dev, KinectParams *kin_params)
    1.18  {
    1.19 @@ -42,8 +38,7 @@
    1.20  		return false;
    1.21  	}
    1.22  
    1.23 -	pthread_mutex_init(&video_mutex, NULL);
    1.24 -	pthread_mutex_init(&depth_mutex, NULL);
    1.25 +	init_frame_mx();
    1.26  
    1.27  	freenect_set_video_callback(*kin_dev, video_cb);
    1.28  	freenect_set_depth_callback(*kin_dev, depth_cb);
    1.29 @@ -86,17 +81,3 @@
    1.30  	freenect_close_device(kin_dev);
    1.31  	freenect_shutdown(kin_ctx);
    1.32  }
    1.33 -
    1.34 -void video_cb(freenect_device *kin_dev, void *rgb, uint32_t time)
    1.35 -{
    1.36 -	pthread_mutex_lock(&video_mutex);
    1.37 -	printf("Started video.\n");
    1.38 -	pthread_mutex_unlock(&video_mutex);
    1.39 -}
    1.40 -
    1.41 -void depth_cb(freenect_device *kin_dev, void *depth, uint32_t time)
    1.42 -{
    1.43 -	pthread_mutex_lock(&depth_mutex);
    1.44 -	printf("Started depth.\n");
    1.45 -	pthread_mutex_unlock(&depth_mutex);
    1.46 -}