invisible
diff src/kinect.cc @ 2:b0b90ef993a0
backup
author | Eleni Maria Stea <eleni@mutantstargoat.com> |
---|---|
date | Wed, 09 Oct 2013 22:56:42 +0300 |
parents | fdbd55eaa14e |
children | 700127288dc5 |
line diff
1.1 --- a/src/kinect.cc Sat Oct 05 19:02:40 2013 +0300 1.2 +++ b/src/kinect.cc Wed Oct 09 22:56:42 2013 +0300 1.3 @@ -33,12 +33,16 @@ 1.4 } 1.5 1.6 if(freenect_set_led(*kin_dev, kin_params->led_color) < 0) { 1.7 + fprintf(stderr, "Failed to set kinect LED\n"); 1.8 stop_kinect(*kin_ctx, *kin_dev); 1.9 - fprintf(stderr, "Failed to set kinect LED\n"); 1.10 return false; 1.11 } 1.12 1.13 - init_frame_mx(); 1.14 + return true; 1.15 +} 1.16 + 1.17 +bool init_kinect_frames(freenect_context **kin_ctx, freenect_device **kin_dev, 1.18 + KinectParams *kin_params) { 1.19 1.20 freenect_set_video_callback(*kin_dev, video_cb); 1.21 freenect_set_depth_callback(*kin_dev, depth_cb); 1.22 @@ -46,7 +50,6 @@ 1.23 if(freenect_set_video_mode(*kin_dev, 1.24 freenect_find_video_mode(kin_params->video_res, 1.25 kin_params->video_format)) < 0) { 1.26 - stop_kinect(*kin_ctx, *kin_dev); 1.27 fprintf(stderr, "Failed to set kinect video mode.\n"); 1.28 return false; 1.29 } 1.30 @@ -54,7 +57,6 @@ 1.31 if(freenect_set_depth_mode(*kin_dev, 1.32 freenect_find_depth_mode(kin_params->depth_res, 1.33 kin_params->depth_format)) < 0) { 1.34 - stop_kinect(*kin_ctx, *kin_dev); 1.35 fprintf(stderr, "Failed to set kinect depth mode.\n"); 1.36 return false; 1.37 } 1.38 @@ -72,12 +74,25 @@ 1.39 return true; 1.40 } 1.41 1.42 +void stop_kinect_video_frames(freenect_device *kin_dev) 1.43 +{ 1.44 + freenect_stop_video(kin_dev); 1.45 +} 1.46 + 1.47 +void stop_kinect_depth_frames(freenect_device *kin_dev) 1.48 +{ 1.49 + freenect_stop_depth(kin_dev); 1.50 +} 1.51 + 1.52 +void stop_kinect_frames(freenect_device *kin_dev) 1.53 +{ 1.54 + stop_kinect_video_frames(kin_dev); 1.55 + stop_kinect_depth_frames(kin_dev); 1.56 +} 1.57 + 1.58 void stop_kinect(freenect_context *kin_ctx, freenect_device *kin_dev) 1.59 { 1.60 freenect_set_led(kin_dev, LED_OFF); 1.61 - 1.62 - freenect_stop_depth(kin_dev); 1.63 - freenect_stop_video(kin_dev); 1.64 freenect_close_device(kin_dev); 1.65 freenect_shutdown(kin_ctx); 1.66 }