@@ -222,7 +222,7 @@ static void init_thread(void)
222222pthread_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{
227227freenect_stop_video (kinect -> dev );
228228free_buffer_ring (& kinect -> video );
@@ -234,12 +234,7 @@ static int change_video_format_with_res(sync_kinect_t *kinect, freenect_resoluti
234234return 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{
244239freenect_stop_depth (kinect -> dev );
245240free_buffer_ring (& kinect -> depth );
@@ -251,11 +246,6 @@ static int change_depth_format_with_res(sync_kinect_t *kinect, freenect_resoluti
251246return 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{
261251sync_kinect_t * kinect = (sync_kinect_t * )malloc (sizeof (sync_kinect_t ));
@@ -281,7 +271,7 @@ static sync_kinect_t *alloc_kinect(int index)
281271return 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{
286276pending_runloop_tasks_inc ();
287277pthread_mutex_lock (& runloop_lock );
@@ -315,20 +305,16 @@ static int setup_kinect_with_res(int index, int res, int fmt, int is_depth)
315305if ((buf -> fmt != fmt ) || (buf -> res != res ))
316306{
317307if (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 );
319309else
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}
322312pthread_mutex_unlock (& buf -> lock );
323313pthread_mutex_unlock (& runloop_lock );
324314pending_runloop_tasks_dec ();
325315return 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{
334320pthread_mutex_lock (& buf -> lock );
@@ -361,7 +347,7 @@ static int runloop_enter(int index)
361347return -1 ;
362348}
363349if (!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 ))
365351return -1 ;
366352
367353pending_runloop_tasks_inc ();
@@ -383,7 +369,7 @@ int freenect_sync_get_video_with_res(void **video, uint32_t *timestamp, int inde
383369return -1 ;
384370}
385371if (!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 ))
387373return -1 ;
388374sync_get (video , timestamp , & kinects [index ]-> video );
389375return 0 ;
@@ -403,7 +389,7 @@ int freenect_sync_get_depth_with_res(void **depth, uint32_t *timestamp, int inde
403389}
404390if (!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 ))
407393return -1 ;
408394sync_get (depth , timestamp , & kinects [index ]-> depth );
409395return 0 ;
0 commit comments