@@ -222,7 +222,7 @@ static void init_thread(void)
222222 pthread_create (& thread , NULL , init , NULL );
223223}
224224
225- static int change_video_format_with_res (sync_kinect_t * kinect , freenect_resolution res , freenect_video_format fmt )
225+ static int change_video_format (sync_kinect_t * kinect , freenect_resolution res , freenect_video_format fmt )
226226{
227227 freenect_stop_video (kinect -> dev );
228228 free_buffer_ring (& kinect -> video );
@@ -234,12 +234,7 @@ static int change_video_format_with_res(sync_kinect_t *kinect, freenect_resoluti
234234 return 0 ;
235235}
236236
237- static int change_video_format (sync_kinect_t * kinect , freenect_resolution res , freenect_video_format fmt )
238- {
239- return change_video_format_with_res (kinect , FREENECT_RESOLUTION_MEDIUM , fmt );
240- }
241-
242- static int change_depth_format_with_res (sync_kinect_t * kinect , freenect_resolution res , freenect_depth_format fmt )
237+ static int change_depth_format (sync_kinect_t * kinect , freenect_resolution res , freenect_depth_format fmt )
243238{
244239 freenect_stop_depth (kinect -> dev );
245240 free_buffer_ring (& kinect -> depth );
@@ -251,11 +246,6 @@ static int change_depth_format_with_res(sync_kinect_t *kinect, freenect_resoluti
251246 return 0 ;
252247}
253248
254- static int change_depth_format (sync_kinect_t * kinect , freenect_resolution res , freenect_depth_format fmt )
255- {
256- return change_depth_format_with_res (kinect , FREENECT_RESOLUTION_MEDIUM , fmt );
257- }
258-
259249static sync_kinect_t * alloc_kinect (int index )
260250{
261251 sync_kinect_t * kinect = (sync_kinect_t * )malloc (sizeof (sync_kinect_t ));
@@ -281,7 +271,7 @@ static sync_kinect_t *alloc_kinect(int index)
281271 return kinect ;
282272}
283273
284- static int setup_kinect_with_res (int index , int res , int fmt , int is_depth )
274+ static int setup_kinect (int index , int res , int fmt , int is_depth )
285275{
286276 pending_runloop_tasks_inc ();
287277 pthread_mutex_lock (& runloop_lock );
@@ -315,20 +305,16 @@ static int setup_kinect_with_res(int index, int res, int fmt, int is_depth)
315305 if ((buf -> fmt != fmt ) || (buf -> res != res ))
316306 {
317307 if (is_depth )
318- change_depth_format_with_res (kinects [index ], (freenect_resolution )res , (freenect_depth_format )fmt );
308+ change_depth_format (kinects [index ], (freenect_resolution )res , (freenect_depth_format )fmt );
319309 else
320- change_video_format_with_res (kinects [index ], (freenect_resolution )res , (freenect_video_format )fmt );
310+ change_video_format (kinects [index ], (freenect_resolution )res , (freenect_video_format )fmt );
321311 }
322312 pthread_mutex_unlock (& buf -> lock );
323313 pthread_mutex_unlock (& runloop_lock );
324314 pending_runloop_tasks_dec ();
325315 return 0 ;
326316}
327317
328- static int setup_kinect (int index , int fmt , int is_depth ) {
329- return setup_kinect_with_res (index , FREENECT_RESOLUTION_MEDIUM , fmt , is_depth );
330- }
331-
332318static int sync_get (void * * data , uint32_t * timestamp , buffer_ring_t * buf )
333319{
334320 pthread_mutex_lock (& buf -> lock );
@@ -361,7 +347,7 @@ static int runloop_enter(int index)
361347 return -1 ;
362348 }
363349 if (!thread_running || !kinects [index ])
364- if (setup_kinect_with_res (index , FREENECT_RESOLUTION_MEDIUM , FREENECT_DEPTH_11BIT , 1 ))
350+ if (setup_kinect (index , FREENECT_RESOLUTION_MEDIUM , FREENECT_DEPTH_11BIT , 1 ))
365351 return -1 ;
366352
367353 pending_runloop_tasks_inc ();
@@ -383,7 +369,7 @@ int freenect_sync_get_video_with_res(void **video, uint32_t *timestamp, int inde
383369 return -1 ;
384370 }
385371 if (!thread_running || !kinects [index ] || kinects [index ]-> video .fmt != fmt || kinects [index ]-> video .res != res )
386- if (setup_kinect_with_res (index , res , fmt , 0 ))
372+ if (setup_kinect (index , res , fmt , 0 ))
387373 return -1 ;
388374 sync_get (video , timestamp , & kinects [index ]-> video );
389375 return 0 ;
@@ -403,7 +389,7 @@ int freenect_sync_get_depth_with_res(void **depth, uint32_t *timestamp, int inde
403389 }
404390 if (!thread_running || !kinects [index ] || kinects [index ]-> depth .fmt != fmt
405391 || kinects [index ]-> depth .res != res )
406- if (setup_kinect_with_res (index , res , fmt , 1 ))
392+ if (setup_kinect (index , res , fmt , 1 ))
407393 return -1 ;
408394 sync_get (depth , timestamp , & kinects [index ]-> depth );
409395 return 0 ;
0 commit comments