diff options
Diffstat (limited to 'thread_kinect.c')
-rw-r--r-- | thread_kinect.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/thread_kinect.c b/thread_kinect.c index fdd7f25..bd70679 100644 --- a/thread_kinect.c +++ b/thread_kinect.c @@ -13,22 +13,21 @@ FILE *accel_stream = NULL; static void dump_ffmpeg_24(FILE *stream, uint32_t timestamp UNUSED, void *data, - int data_size) + size_t data_size) { fwrite(data, data_size, 1, stream); } static -void dump_ffmpeg_pad16(FILE *stream, uint32_t timestamp UNUSED, void *data, - int data_size) +void dump_ffmpeg_pad16(FILE *stream, uint32_t timestamp UNUSED, void *data_anon, + size_t data_size) { - unsigned int z = 0; - uint16_t* data_ptr = (uint16_t*)data; - uint16_t* end = data_ptr + data_size; - while (data_ptr < end) { - z = *data_ptr; + uint16_t* data = data_anon; + uint16_t* end = (void*)&((char*)data_anon)[data_size]; + while (data < end) { + uint32_t z = *data; fwrite(((char*)(&z)), 3, 1, stream); - data_ptr += 2; + data = &data[1]; } } @@ -37,12 +36,13 @@ void handle_accel(freenect_device *dev UNUSED, freenect_raw_tilt_state* data) { double x, y, z; freenect_get_mks_accel(data, &x, &y, &z); - fprintf(accel_stream, "x=%f\ty=%f\tz=%f\n", x, y, z); + //fprintf(accel_stream, "x=%f\ty=%f\tz=%f\n", x, y, z); } static void handle_depth(freenect_device *dev UNUSED, void *depth, uint32_t timestamp) { + printf("handle depth\n"); dump_ffmpeg_pad16(depth_stream, timestamp, depth, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT).bytes); @@ -51,6 +51,7 @@ void handle_depth(freenect_device *dev UNUSED, void *depth, uint32_t timestamp) static void handle_video(freenect_device *dev, void *rgb, uint32_t timestamp) { + printf("handle depth\n"); dump_ffmpeg_24(video_stream, timestamp, rgb, freenect_get_current_video_mode(dev).bytes); } |