示例#1
0
文件: core.c 项目: anaxdem/RKApp
FREENECTAPI int freenect_process_events_timeout(freenect_context *ctx, struct timeval *timeout)
{

    int res = fnusb_process_events_timeout(&ctx->usb, timeout);
    // Iterate over the devices in ctx.  If any of them are flagged as
    freenect_device* dev = ctx->first;
    while(dev) {
        if (dev->usb_cam.device_dead) {
            __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,"USB camera marked dead, stopping streams" );
            FN_ERROR("USB camera marked dead, stopping streams\n");
            res = -1;
            freenect_stop_video(dev);
            freenect_stop_depth(dev);
        }
#ifdef BUILD_AUDIO
        if (dev->usb_audio.device_dead) {
            __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,"USB audio marked dead, stopping streams" );
            FN_ERROR("USB audio marked dead, stopping streams\n");
            res = -1; // Or something else to tell the user that the device just vanished.
            freenect_stop_audio(dev);
        }
#endif
        dev = dev->next;
    }

    return res;
}
示例#2
0
void* freenect_threadfunc(void* arg) {
	while(!die && freenect_process_events(f_ctx) >= 0) {
		// If we did anything else in the freenect thread, it might go here.
	}
	freenect_stop_audio(f_dev);
	freenect_close_device(f_dev);
	freenect_shutdown(f_ctx);
	return NULL;
}