diff -Nru libfreenect-0.1.1.3/CMakeLists.txt libfreenect-0.1.2/CMakeLists.txt --- libfreenect-0.1.1.3/CMakeLists.txt 2011-10-16 11:18:14.000000000 +0000 +++ libfreenect-0.1.2/CMakeLists.txt 2012-01-29 14:19:13.000000000 +0000 @@ -41,8 +41,8 @@ PROJECT(libfreenect) set (PROJECT_VER_MAJOR 0) -set (PROJECT_VER_MINOR 0) -set (PROJECT_VER_PATCH 1) +set (PROJECT_VER_MINOR 1) +set (PROJECT_VER_PATCH 2) set (PROJECT_VER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}") set (PROJECT_APIVER diff -Nru libfreenect-0.1.1.3/debian/changelog libfreenect-0.1.2/debian/changelog --- libfreenect-0.1.1.3/debian/changelog 2011-11-08 09:05:51.000000000 +0000 +++ libfreenect-0.1.2/debian/changelog 2012-01-29 15:28:02.000000000 +0000 @@ -1,4 +1,11 @@ -libfreenect (1:0.1.1.3-0ubuntu2~maverick) maverick; urgency=low +libfreenect (1:0.1.2-0ubuntu1~maverick) maverick; urgency=low + + * new upstream release: 0.1.2 as of Jan 18th, 2012 + * add freenect- prefix to demos + + -- Florian Echtler Sun, 29 Jan 2012 15:20:36 +0100 + +libfreenect (1:0.1.1.3-0ubuntu2~oneiric) oneiric; urgency=low * add libfreenect-demos package * bump version to 0.1.1.3 using git unstable snapshot from 2011-11-07 diff -Nru libfreenect-0.1.1.3/debian/rules libfreenect-0.1.2/debian/rules --- libfreenect-0.1.1.3/debian/rules 2011-11-08 09:04:02.000000000 +0000 +++ libfreenect-0.1.2/debian/rules 2012-01-29 15:27:09.000000000 +0000 @@ -3,3 +3,6 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/cmake.mk #Cmake stuff +binary-post-install/libfreenect-demos:: + bash -c 'for file in debian/tmp/usr/bin/* ; do mv $$file $${file/usr\/bin\//usr\/bin\/freenect-} ; done' + bash -c 'for file in debian/libfreenect-demos/usr/bin/* ; do mv $$file $${file/usr\/bin\//usr\/bin\/freenect-} ; done' diff -Nru libfreenect-0.1.1.3/fakenect/CMakeLists.txt libfreenect-0.1.2/fakenect/CMakeLists.txt --- libfreenect-0.1.1.3/fakenect/CMakeLists.txt 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/fakenect/CMakeLists.txt 2012-01-29 14:19:13.000000000 +0000 @@ -15,4 +15,11 @@ add_executable(record record.c) target_link_libraries(record freenect m) install (TARGETS record - DESTINATION bin) \ No newline at end of file + DESTINATION bin) + +CONFIGURE_FILE("fakenect.sh.in" + "fakenect.sh" + IMMEDIATE @ONLY) +install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fakenect.sh + DESTINATION bin + RENAME fakenect) diff -Nru libfreenect-0.1.1.3/fakenect/fakenect.sh.in libfreenect-0.1.2/fakenect/fakenect.sh.in --- libfreenect-0.1.1.3/fakenect/fakenect.sh.in 1970-01-01 00:00:00.000000000 +0000 +++ libfreenect-0.1.2/fakenect/fakenect.sh.in 2012-01-29 14:19:13.000000000 +0000 @@ -0,0 +1,51 @@ +#!/bin/bash + +# This file is part of the OpenKinect Project. http://www.openkinect.org +# +# Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file +# for details. +# +# This code is licensed to you under the terms of the Apache License, version +# 2.0, or, at your option, the terms of the GNU General Public License, +# version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, +# or the following URLs: +# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.gnu.org/licenses/gpl-2.0.txt +# +# If you redistribute this file in source form, modified or unmodified, +# you may: +# 1) Leave this header intact and distribute it under the same terms, +# accompanying it with the APACHE20 and GPL20 files, or +# 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or +# 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file +# In all cases you must keep the copyright notice intact and include a copy +# of the CONTRIB file. +# Binary distributions must follow the binary distribution requirements of +# either License. + +# fakenect wrapper script: +# simplifies calling libfreenect applications under fakenect +# by taking the fakenect database, app to run, and its args +# then filling out the necessary environment variables and calling the app +# usage: fakenect /path/to/fakenect/dump app --arg=value + +# catch bad args +if [ $# -lt 2 ] +then + echo "Usage: $0 " + exit -1 +fi + +# set path to fakenect database +export FAKENECT_PATH=$1 + +# set link path (LD_LIBRARY_PATH for Linux, DYLIB_LIBRARY_PATH for OS X) +if [ `uname` == "Darwin" ]; +then + export DYLD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@PROJECT_LIBRARY_INSTALL_DIR@/fakenect/:${LD_LIBRARY_PATH}" +else + export LD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@PROJECT_LIBRARY_INSTALL_DIR@/fakenect/:${LD_LIBRARY_PATH}" +fi + +# run desired app w/ args, now that environment is configured +"${@:2}" diff -Nru libfreenect-0.1.1.3/include/libfreenect.h libfreenect-0.1.2/include/libfreenect.h --- libfreenect-0.1.1.3/include/libfreenect.h 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/include/libfreenect.h 2012-01-29 14:19:13.000000000 +0000 @@ -35,6 +35,15 @@ #define FREENECT_COUNTS_PER_G 819 /**< Ticks per G for accelerometer as set per http://www.kionix.com/Product%20Sheets/KXSD9%20Product%20Brief.pdf */ +/// Maximum value that a uint16_t pixel will take on in the buffer of any of the FREENECT_DEPTH_MM or FREENECT_DEPTH_REGISTERED frame callbacks +#define FREENECT_DEPTH_MM_MAX_VALUE 10000 +/// Value indicating that this pixel has no data, when using FREENECT_DEPTH_MM or FREENECT_DEPTH_REGISTERED depth modes +#define FREENECT_DEPTH_MM_NO_VALUE 0 +/// Maximum value that a uint16_t pixel will take on in the buffer of any of the FREENECT_DEPTH_11BIT, FREENECT_DEPTH_10BIT, FREENECT_DEPTH_11BIT_PACKED, or FREENECT_DEPTH_10BIT_PACKED frame callbacks +#define FREENECT_DEPTH_RAW_MAX_VALUE 2048 +/// Value indicating that this pixel has no data, when using FREENECT_DEPTH_11BIT, FREENECT_DEPTH_10BIT, FREENECT_DEPTH_11BIT_PACKED, or FREENECT_DEPTH_10BIT_PACKED +#define FREENECT_DEPTH_RAW_NO_VALUE 2047 + /// Flags representing devices to open when freenect_open_device() is called. /// In particular, this allows libfreenect to grab only a subset of the devices /// in the Kinect, so you could (for instance) use libfreenect to handle audio @@ -232,6 +241,18 @@ FREENECTAPI int freenect_process_events(freenect_context *ctx); /** + * Calls the platform specific usb event processor until either an event occurs + * or the timeout parameter time has passed. If a zero timeval is passed, this + * function will handle any already-pending events, then return immediately. + * + * @param ctx Context to process events for + * @param timeout Pointer to a timeval containing the maximum amount of time to block waiting for events, or zero for nonblocking mode + * + * @return 0 on success, other values on error, platform/library dependant + */ +FREENECTAPI int freenect_process_events_timeout(freenect_context *ctx, struct timeval* timeout); + +/** * Return the number of kinect devices currently connected to the * system * @@ -255,12 +276,21 @@ /** * Free the linked list produced by freenect_list_device_attributes(). * - * @param ctx Context from which the list was allocated * @param attribute_list Linked list of attributes to free. */ FREENECTAPI void freenect_free_device_attributes(struct freenect_device_attributes* attribute_list); /** + * Answer which subdevices this library supports. This is most useful for + * wrappers trying to determine whether the underlying library was built with + * audio support or not, so the wrapper can avoid calling functions that do not + * exist. + * + * @return Flags representing the subdevices that the library supports opening (see freenect_device_flags) + */ +FREENECTAPI int freenect_supported_subdevices(void); + +/** * Set which subdevices any subsequent calls to freenect_open_device() * should open. This will not affect devices which have already been * opened. The default behavior, should you choose not to call this @@ -494,7 +524,7 @@ * Get the frame descriptor of the nth supported video mode for the * video camera. * - * @param n Which of the supported modes to return information about + * @param mode_num Which of the supported modes to return information about * * @return A freenect_frame_mode describing the nth video mode */ @@ -546,7 +576,7 @@ * Get the frame descriptor of the nth supported depth mode for the * depth camera. * - * @param n Which of the supported modes to return information about + * @param mode_num Which of the supported modes to return information about * * @return A freenect_frame_mode describing the nth depth mode */ diff -Nru libfreenect-0.1.1.3/platform/windows/libusb10emu/libusb-1.0/libusbemu.cpp libfreenect-0.1.2/platform/windows/libusb10emu/libusb-1.0/libusbemu.cpp --- libfreenect-0.1.1.3/platform/windows/libusb10emu/libusb-1.0/libusbemu.cpp 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/platform/windows/libusb10emu/libusb-1.0/libusbemu.cpp 2012-01-29 14:19:13.000000000 +0000 @@ -624,6 +624,25 @@ return(0); } +int libusb_handle_events_timeout(libusb_context* ctx, struct timeval* timeout) +{ + if (ctx == NULL) + ctx = default_context; + + if (failguard::Abort()) + return(LIBUSB_ERROR_INTERRUPTED); + + RAIIMutex lock (ctx->mutex); + + if (timeout == NULL) + libusbemu_handle_isochronous(ctx, 0); + else + libusbemu_handle_isochronous(ctx, (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000)); + + // 0 on success, or a LIBUSB_ERROR code on failure + return(0); +} + void PreprocessTransferNaive(libusb_transfer* transfer, const int read); void PreprocessTransferFreenect(libusb_transfer* transfer, const int read); static void(*PreprocessTransfer)(libusb_transfer*, const int) (PreprocessTransferFreenect); diff -Nru libfreenect-0.1.1.3/platform/windows/libusb10emu/libusb-1.0/libusb.h libfreenect-0.1.2/platform/windows/libusb10emu/libusb-1.0/libusb.h --- libfreenect-0.1.1.3/platform/windows/libusb10emu/libusb-1.0/libusb.h 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/platform/windows/libusb10emu/libusb-1.0/libusb.h 2012-01-29 14:19:13.000000000 +0000 @@ -39,8 +39,11 @@ #if defined(_MSC_VER) typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; + // We need struct timeval. + #include #else -#include + #include + #include #endif #define LIBUSBEMU 1 @@ -96,6 +99,7 @@ int libusb_cancel_transfer(struct libusb_transfer* transfer); int libusb_handle_events(libusb_context* ctx); // WORK IN PROGRESS... +int libusb_handle_events_timeout(libusb_context* ctx, struct timeval* timeout); // the signature of libusb_device_descriptor is identical to usb_device_descriptor // which means that the below struct could be replaced by a typedef; however, that diff -Nru libfreenect-0.1.1.3/README.asciidoc libfreenect-0.1.2/README.asciidoc --- libfreenect-0.1.1.3/README.asciidoc 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/README.asciidoc 2012-01-29 14:19:13.000000000 +0000 @@ -131,6 +131,7 @@ - python - actionscript - C# +- Java (JNA) === Licensing diff -Nru libfreenect-0.1.1.3/src/CMakeLists.txt libfreenect-0.1.2/src/CMakeLists.txt --- libfreenect-0.1.1.3/src/CMakeLists.txt 2011-10-16 11:18:14.000000000 +0000 +++ libfreenect-0.1.2/src/CMakeLists.txt 2012-01-29 14:19:13.000000000 +0000 @@ -26,7 +26,7 @@ add_custom_target(firmware ALL COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/fwfetcher.py" "../audios.bin" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/fwfetcher.py") - install (FILES "${CMAKE_CURRENT_BINARY_DIR}/../audios.bin" DESTINATION "${CMAKE_INSTALL_PREFIX}/share") + install (FILES "${CMAKE_CURRENT_BINARY_DIR}/../audios.bin" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/libfreenect") ENDIF() ENDIF() diff -Nru libfreenect-0.1.1.3/src/core.c libfreenect-0.1.2/src/core.c --- libfreenect-0.1.1.3/src/core.c 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/src/core.c 2012-01-29 14:19:13.000000000 +0000 @@ -69,7 +69,34 @@ FREENECTAPI int freenect_process_events(freenect_context *ctx) { - return fnusb_process_events(&ctx->usb); + struct timeval timeout; + timeout.tv_sec = 60; + timeout.tv_usec = 0; + return freenect_process_events_timeout(ctx, &timeout); +} + +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) { + 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) { + 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; } FREENECTAPI int freenect_num_devices(freenect_context *ctx) @@ -98,6 +125,14 @@ return; } +FREENECTAPI int freenect_supported_subdevices(void) { +#ifdef BUILD_AUDIO + return FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA | FREENECT_DEVICE_AUDIO; +#else + return FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA; +#endif +} + FREENECTAPI void freenect_select_subdevices(freenect_context *ctx, freenect_device_flags subdevs) { ctx->enabled_subdevices = (freenect_device_flags)(subdevs & (FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA #ifdef BUILD_AUDIO diff -Nru libfreenect-0.1.1.3/src/registration.c libfreenect-0.1.2/src/registration.c --- libfreenect-0.1.1.3/src/registration.c 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/src/registration.c 2012-01-29 14:19:13.000000000 +0000 @@ -41,10 +41,10 @@ #define DEPTH_SENSOR_X_RES 1280 #define DEPTH_MIRROR_X 0 -#define DEPTH_MAX_METRIC_VALUE 10000 -#define DEPTH_MAX_RAW_VALUE 2048 -#define DEPTH_NO_RAW_VALUE 2047 -#define DEPTH_NO_MM_VALUE 0 +#define DEPTH_MAX_METRIC_VALUE FREENECT_DEPTH_MM_MAX_VALUE +#define DEPTH_NO_MM_VALUE FREENECT_DEPTH_MM_NO_VALUE +#define DEPTH_MAX_RAW_VALUE FREENECT_DEPTH_RAW_MAX_VALUE +#define DEPTH_NO_RAW_VALUE FREENECT_DEPTH_RAW_NO_VALUE #define DEPTH_X_OFFSET 1 #define DEPTH_Y_OFFSET 1 diff -Nru libfreenect-0.1.1.3/src/usb_libusb10.c libfreenect-0.1.2/src/usb_libusb10.c --- libfreenect-0.1.1.3/src/usb_libusb10.c 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/src/usb_libusb10.c 2012-01-29 14:19:13.000000000 +0000 @@ -152,6 +152,11 @@ return libusb_handle_events(ctx->ctx); } +int fnusb_process_events_timeout(fnusb_ctx *ctx, struct timeval* timeout) +{ + return libusb_handle_events_timeout(ctx->ctx, timeout); +} + int fnusb_open_subdevices(freenect_device *dev, int index) { freenect_context *ctx = dev->parent; @@ -416,9 +421,9 @@ { int i; fnusb_isoc_stream *strm = (fnusb_isoc_stream*)xfer->user_data; + freenect_context *ctx = strm->parent->parent->parent; if (strm->dead) { - freenect_context *ctx = strm->parent->parent->parent; strm->dead_xfers++; FN_SPEW("EP %02x transfer complete, %d left\n", xfer->endpoint, strm->num_xfers - strm->dead_xfers); return; @@ -432,7 +437,15 @@ strm->cb(strm->parent->parent, buf, xfer->iso_packet_desc[i].actual_length); buf += strm->len; } - libusb_submit_transfer(xfer); + int res; + res = libusb_submit_transfer(xfer); + if (res != 0) { + FN_ERROR("iso_callback(): failed to resubmit transfer after successful completion: %d\n", res); + strm->dead_xfers++; + if (res == LIBUSB_ERROR_NO_DEVICE) { + strm->parent->device_dead = 1; + } + } break; } case LIBUSB_TRANSFER_NO_DEVICE: @@ -440,16 +453,28 @@ // We lost the device we were talking to. This is a large problem, // and one that we should eventually come up with a way to // properly propagate up to the caller. - freenect_context *ctx = strm->parent->parent->parent; - FN_ERROR("USB device disappeared, cancelling stream :(\n"); + if(!strm->parent->device_dead) { + FN_ERROR("USB device disappeared, cancelling stream %02x :(\n", xfer->endpoint); + } strm->dead_xfers++; - fnusb_stop_iso(strm->parent, strm); + strm->parent->device_dead = 1; break; } case LIBUSB_TRANSFER_CANCELLED: { - freenect_context *ctx = strm->parent->parent->parent; - FN_SPEW("EP %02x transfer cancelled\n", xfer->endpoint); + if(strm->dead) { + FN_SPEW("EP %02x transfer cancelled\n", xfer->endpoint); + } else { + // This seems to be a libusb bug on OSX - instead of completing + // the transfer with LIBUSB_TRANSFER_NO_DEVICE, the transfers + // simply come back cancelled by the OS. We can detect this, + // though - the stream should be marked dead if we're + // intentionally cancelling transfers. + if(!strm->parent->device_dead) { + FN_ERROR("Got cancelled transfer, but we didn't request it - device disconnected?\n"); + } + strm->parent->device_dead = 1; + } strm->dead_xfers++; break; } @@ -459,9 +484,16 @@ // on OSX tends to hit random errors a lot. If we don't resubmit // the transfers, eventually all of them die and then we don't get // any more data from the Kinect. - freenect_context *ctx = strm->parent->parent->parent; FN_WARNING("Isochronous transfer error: %d\n", xfer->status); - libusb_submit_transfer(xfer); + int res; + res = libusb_submit_transfer(xfer); + if (res != 0) { + FN_ERROR("Isochronous transfer resubmission failed after unknown error: %d\n", res); + strm->dead_xfers++; + if (res == LIBUSB_ERROR_NO_DEVICE) { + strm->parent->device_dead = 1; + } + } break; } } @@ -510,22 +542,29 @@ freenect_context *ctx = dev->parent->parent; int i; + FN_FLOOD("fnusb_stop_iso() called\n"); + strm->dead = 1; for (i=0; inum_xfers; i++) libusb_cancel_transfer(strm->xfers[i]); + FN_FLOOD("fnusb_stop_iso() cancelled all transfers\n"); while (strm->dead_xfers < strm->num_xfers) { + FN_FLOOD("fnusb_stop_iso() dead = %d\tnum = %d\n", strm->dead_xfers, strm->num_xfers); libusb_handle_events(ctx->usb.ctx); } for (i=0; inum_xfers; i++) libusb_free_transfer(strm->xfers[i]); + FN_FLOOD("fnusb_stop_iso() freed all transfers\n"); free(strm->buffer); free(strm->xfers); + FN_FLOOD("fnusb_stop_iso() freed buffers and stream\n"); memset(strm, 0, sizeof(*strm)); + FN_FLOOD("fnusb_stop_iso() done\n"); return 0; } diff -Nru libfreenect-0.1.1.3/src/usb_libusb10.h libfreenect-0.1.2/src/usb_libusb10.h --- libfreenect-0.1.1.3/src/usb_libusb10.h 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/src/usb_libusb10.h 2012-01-29 14:19:13.000000000 +0000 @@ -69,6 +69,7 @@ typedef struct { freenect_device *parent; //so we can go up from the libusb userdata libusb_device_handle *dev; + int device_dead; // set to 1 when the underlying libusb_device_handle vanishes (ie, Kinect was unplugged) } fnusb_dev; typedef struct { @@ -89,6 +90,7 @@ int fnusb_init(fnusb_ctx *ctx, freenect_usb_context *usb_ctx); int fnusb_shutdown(fnusb_ctx *ctx); int fnusb_process_events(fnusb_ctx *ctx); +int fnusb_process_events_timeout(fnusb_ctx *ctx, struct timeval* timeout); int fnusb_open_subdevices(freenect_device *dev, int index); int fnusb_close_subdevices(freenect_device *dev); diff -Nru libfreenect-0.1.1.3/wrappers/cpp/libfreenect.hpp libfreenect-0.1.2/wrappers/cpp/libfreenect.hpp --- libfreenect-0.1.1.3/wrappers/cpp/libfreenect.hpp 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/cpp/libfreenect.hpp 2012-01-29 14:19:13.000000000 +0000 @@ -61,7 +61,9 @@ class FreenectDevice : Noncopyable { public: - FreenectDevice(freenect_context *_ctx, int _index) { + FreenectDevice(freenect_context *_ctx, int _index) + : m_video_resolution(FREENECT_RESOLUTION_MEDIUM), m_depth_resolution(FREENECT_RESOLUTION_MEDIUM) + { if(freenect_open_device(_ctx, &m_dev, _index) < 0) throw std::runtime_error("Cannot open Kinect"); freenect_set_user(m_dev, this); freenect_set_video_mode(m_dev, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)); @@ -96,32 +98,40 @@ FreenectTiltState getState() const { return FreenectTiltState(freenect_get_tilt_state(m_dev)); } - void setVideoFormat(freenect_video_format requested_format) { - if (requested_format != m_video_format) { + void setVideoFormat(freenect_video_format requested_format, freenect_resolution requested_resolution = FREENECT_RESOLUTION_MEDIUM) { + if (requested_format != m_video_format || requested_resolution != m_video_resolution) { freenect_stop_video(m_dev); - freenect_frame_mode mode = freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, requested_format); + freenect_frame_mode mode = freenect_find_video_mode(requested_resolution, requested_format); if (!mode.is_valid) throw std::runtime_error("Cannot set video format: invalid mode"); if (freenect_set_video_mode(m_dev, mode) < 0) throw std::runtime_error("Cannot set video format"); freenect_start_video(m_dev); m_video_format = requested_format; + m_video_resolution = requested_resolution; } } freenect_video_format getVideoFormat() { return m_video_format; } - void setDepthFormat(freenect_depth_format requested_format) { - if (requested_format != m_depth_format) { + freenect_resolution getVideoResolution() { + return m_video_resolution; + } + void setDepthFormat(freenect_depth_format requested_format, freenect_resolution requested_resolution = FREENECT_RESOLUTION_MEDIUM) { + if (requested_format != m_depth_format || requested_resolution != m_depth_resolution) { freenect_stop_depth(m_dev); - freenect_frame_mode mode = freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, requested_format); + freenect_frame_mode mode = freenect_find_depth_mode(requested_resolution, requested_format); if (!mode.is_valid) throw std::runtime_error("Cannot set depth format: invalid mode"); if (freenect_set_depth_mode(m_dev, mode) < 0) throw std::runtime_error("Cannot set depth format"); freenect_start_depth(m_dev); m_depth_format = requested_format; + m_depth_resolution = requested_resolution; } } freenect_depth_format getDepthFormat() { return m_depth_format; } + freenect_resolution getDepthResolution() { + return m_depth_resolution; + } // Do not call directly even in child virtual void VideoCallback(void *video, uint32_t timestamp) = 0; // Do not call directly even in child @@ -136,7 +146,7 @@ case FREENECT_VIDEO_IR_10BIT_PACKED: case FREENECT_VIDEO_YUV_RGB: case FREENECT_VIDEO_YUV_RAW: - return freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, m_video_format).bytes; + return freenect_find_video_mode(m_video_resolution, m_video_format).bytes; default: return 0; } @@ -148,6 +158,8 @@ freenect_device *m_dev; freenect_video_format m_video_format; freenect_depth_format m_depth_format; + freenect_resolution m_video_resolution; + freenect_resolution m_depth_resolution; static void freenect_depth_callback(freenect_device *dev, void *depth, uint32_t timestamp) { FreenectDevice* device = static_cast(freenect_get_user(dev)); device->DepthCallback(depth, timestamp); diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Context.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Context.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Context.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Context.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,3 +1,27 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; public interface Context { @@ -6,4 +30,4 @@ void setLogLevel(LogLevel level); Device openDevice(int index); void shutdown(); -} \ No newline at end of file +} diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/DepthFormat.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/DepthFormat.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/DepthFormat.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/DepthFormat.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,32 +1,57 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; +import java.util.HashMap; +import java.util.Map; public enum DepthFormat { - D11BIT(0, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_11BIT_SIZE), - D10BIT(1, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_10BIT_SIZE), - D11BIT_PACKED(2, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_11BIT_PACKED_SIZE), - D10BIT_PACKED(3, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_10BIT_PACKED_SIZE); - private int value; - private int frameSize; - private int width; - private int height; + D11BIT(0), + D10BIT(1), + D11BIT_PACKED(2), + D10BIT_PACKED(3), + REGISTERED(4), + MM(5); - private DepthFormat(int value, int width, int height, int frameSize) { + private final int value; + private static final Map MAP = new HashMap(6); + static { + for(DepthFormat v : DepthFormat.values()) { + MAP.put(v.intValue(), v); + } + } + + private DepthFormat(int value) { this.value = value; - this.width = width; - this.height = height; - this.frameSize = frameSize; } + public int intValue() { return value; } - public int getWidth() { - return width; - } - public int getHeight() { - return height; - } - public int getFrameSize() { - return frameSize; + + public static DepthFormat fromInt(int value) { + return MAP.get(value); } } \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/DepthHandler.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/DepthHandler.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/DepthHandler.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/DepthHandler.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,7 +1,31 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; import java.nio.ByteBuffer; public interface DepthHandler { - void onFrameReceived(DepthFormat format, ByteBuffer frame, int timestamp); + void onFrameReceived(FrameMode mode, ByteBuffer frame, int timestamp); } \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/DeviceFlags.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/DeviceFlags.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/DeviceFlags.java 1970-01-01 00:00:00.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/DeviceFlags.java 2012-01-29 14:19:13.000000000 +0000 @@ -0,0 +1,41 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ +package org.openkinect.freenect; + +public enum DeviceFlags { + MOTOR(1), + CAMERA(2), + AUDIO(4); + + private final int value; + + private DeviceFlags(int value) { + this.value = value; + } + + public int intValue() { + return value; + } +} \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Device.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Device.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Device.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Device.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,6 +1,28 @@ -package org.openkinect.freenect; - - +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ + package org.openkinect.freenect; public interface Device { double[] getAccel(); @@ -11,10 +33,14 @@ TiltStatus getTiltStatus(); void setDepthFormat(DepthFormat fmt); void setVideoFormat(VideoFormat fmt); + void setDepthFormat(DepthFormat fmt, Resolution res); + void setVideoFormat(VideoFormat fmt, Resolution res); + FrameMode getDepthMode(); + FrameMode getVideoMode(); int startDepth(DepthHandler handler); int startVideo(VideoHandler handler); int stopDepth(); int stopVideo(); void close(); public abstract int getDeviceIndex(); -} +} \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/FrameMode.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/FrameMode.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/FrameMode.java 1970-01-01 00:00:00.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/FrameMode.java 2012-01-29 14:19:13.000000000 +0000 @@ -0,0 +1,77 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ +package org.openkinect.freenect; + +import com.sun.jna.Structure; + +public class FrameMode extends Structure { + /* All fields are public because Structure requires it. + However, fields should NOT be altered by external code. */ + public int reserved; + public int resolution; + public int format; + public int bytes; + public short width, height; + public byte dataBitsPerPixel, paddingBitsPerPixel; + public byte framerate, valid; + + public FrameMode() { + valid = 0; + } + + public Resolution getResolution() { + return Resolution.fromInt(resolution); + } + + public DepthFormat getDepthFormat() { + return DepthFormat.fromInt(format); + } + + public VideoFormat getVideoFormat() { + return VideoFormat.fromInt(format); + } + + public int getFrameSize() { + return bytes; + } + + public short getWidth() { + return width; + } + + public short getHeight() { + return height; + } + + public int getFrameRate() { + return framerate; + } + + public boolean isValid() { + return (valid != 0); + } + + public static class ByValue extends FrameMode implements Structure.ByValue { } +} \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Freenect.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Freenect.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Freenect.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Freenect.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,339 +1,424 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; +import com.sun.jna.*; +import com.sun.jna.ptr.PointerByReference; + import java.io.IOException; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; -import com.sun.jna.Callback; -import com.sun.jna.Library; -import com.sun.jna.Native; -import com.sun.jna.NativeLibrary; -import com.sun.jna.Pointer; -import com.sun.jna.PointerType; -import com.sun.jna.ptr.PointerByReference; - public class Freenect implements Library { - static { - try { - NativeLibrary.addSearchPath("freenect", "../../build/lib"); - NativeLibrary.addSearchPath("freenect", "/usr/local/lib"); - NativeLibrary instance = NativeLibrary.getInstance("freenect"); - System.err.println("Loaded " + instance.getName() + " from " + instance.getFile().getCanonicalPath()); - Native.register(instance); - } catch (IOException e) { - throw new AssertionError(e); - } - } + static { + try { + NativeLibrary.addSearchPath("freenect", "/usr/local/lib"); + NativeLibrary instance = NativeLibrary.getInstance("freenect"); + System.err.println("Loaded " + instance.getName() + " from " + instance.getFile().getCanonicalPath()); + Native.register(instance); + } catch (IOException e) { + throw new AssertionError(e); + } + } - // constants from libfreenect.h - static final int FREENECT_FRAME_W = 640; - static final int FREENECT_FRAME_H = 480; - static final int FREENECT_FRAME_PIX = (FREENECT_FRAME_H * FREENECT_FRAME_W); - static final int FREENECT_IR_FRAME_W = 640; - static final int FREENECT_IR_FRAME_H = 488; - static final int FREENECT_IR_FRAME_PIX = (FREENECT_IR_FRAME_H * FREENECT_IR_FRAME_W); - static final int FREENECT_VIDEO_RGB_SIZE = (FREENECT_FRAME_PIX * 3); - static final int FREENECT_VIDEO_BAYER_SIZE = (FREENECT_FRAME_PIX); - static final int FREENECT_VIDEO_YUV_SIZE = (FREENECT_FRAME_PIX * 2); - static final int FREENECT_VIDEO_IR_8BIT_SIZE = (FREENECT_IR_FRAME_PIX); - static final int FREENECT_VIDEO_IR_10BIT_SIZE = (FREENECT_IR_FRAME_PIX * 2); - static final int FREENECT_VIDEO_IR_10BIT_PACKED_SIZE = 390400; - static final int FREENECT_DEPTH_11BIT_SIZE = (FREENECT_FRAME_PIX * 2); - static final int FREENECT_DEPTH_10BIT_SIZE = FREENECT_DEPTH_11BIT_SIZE; - static final int FREENECT_DEPTH_11BIT_PACKED_SIZE = 422400; - static final int FREENECT_DEPTH_10BIT_PACKED_SIZE = 384000; - - protected Freenect() {} - - public static Context createContext() { - PointerByReference ctxPtr = new PointerByReference(); - int rval = freenect_init(ctxPtr, Pointer.NULL); - if (rval == 0) { - NativeContext ctx = new NativeContext(ctxPtr.getValue()); - ctx.startEventThread(); - return ctx; - } - throw new IllegalStateException("init() returned " + rval); - } + protected Freenect () { + } - protected static class NativeContext extends PointerType implements Context { - private EventThread eventThread; + public static Context createContext () { + PointerByReference ctxPtr = new PointerByReference(); + int rval = freenect_init(ctxPtr, Pointer.NULL); + if (rval == 0) { + NativeContext ctx = new NativeContext(ctxPtr.getValue()); + ctx.startEventThread(); + return ctx; + } + throw new IllegalStateException("init() returned " + rval); + } - public NativeContext() {} + protected static class NativeContext extends PointerType implements Context { + private EventThread eventThread; - private LogHandler logHandler; - private final NativeLogCallback logCallback = new NativeLogCallback() { - @Override - public void callback(NativeDevice dev, int level, String msg) { - logHandler.onMessage(dev, LogLevel.fromInt(level), msg); - } - }; + public NativeContext () { + } - protected NativeContext(Pointer ptr) { - super(ptr); - } + private LogHandler logHandler; + private final NativeLogCallback logCallback = new NativeLogCallback() { + @Override + public void callback (NativeDevice dev, int level, String msg) { + logHandler.onMessage(dev, LogLevel.fromInt(level), msg); + } + }; - @Override - public void setLogHandler(LogHandler handler) { - this.logHandler = handler; - if (logHandler == null) { - freenect_set_log_callback(this, null); - } else { - freenect_set_log_callback(this, logCallback); - } - } + protected NativeContext (Pointer ptr) { + super(ptr); + } - @Override - public void setLogLevel(LogLevel level) { - freenect_set_log_level(this, level.intValue()); - } + @Override + public void setLogHandler (LogHandler handler) { + this.logHandler = handler; + if (logHandler == null) { + freenect_set_log_callback(this, null); + } else { + freenect_set_log_callback(this, logCallback); + } + } - @Override - public int numDevices() { - return freenect_num_devices(this); - } + @Override + public void setLogLevel (LogLevel level) { + freenect_set_log_level(this, level.intValue()); + } - @Override - public Device openDevice(int index) { - PointerByReference devicePtr = new PointerByReference(); - int rval = freenect_open_device(this, devicePtr, index); - if (rval != 0) { - throw new IllegalStateException("freenect_open_device() returned " + rval); - } - return new NativeDevice(devicePtr.getValue(), index); - } + @Override + public int numDevices () { + return freenect_num_devices(this); + } - protected void processEvents() { - freenect_process_events(this); - } + @Override + public Device openDevice (int index) { + PointerByReference devicePtr = new PointerByReference(); + int rval = freenect_open_device(this, devicePtr, index); + if (rval != 0) { + throw new IllegalStateException("freenect_open_device() returned " + rval); + } + return new NativeDevice(devicePtr.getValue(), index); + } - protected void startEventThread() { - if (eventThread == null || !eventThread.isAlive()) { - eventThread = new EventThread(this); - eventThread.start(); - } - } + protected void processEvents () { + freenect_process_events(this); + } - protected void stopEventThread() { - if (eventThread != null) { - eventThread.kill(); - eventThread = null; - } - } + protected void startEventThread () { + if (eventThread == null || !eventThread.isAlive()) { + eventThread = new EventThread(this); + eventThread.start(); + } + } - @Override - public void shutdown() { - stopEventThread(); - freenect_shutdown(this); - } - } + protected void stopEventThread () { + if (eventThread != null) { + eventThread.kill(); + eventThread = null; + } + } - protected static class NativeDevice extends PointerType implements Device { - private VideoFormat videoFormat; - private ByteBuffer videoBuffer; - private DepthFormat depthFormat; - private ByteBuffer depthBuffer; - private final DoubleBuffer accelX = DoubleBuffer.allocate(1); - private final DoubleBuffer accelY = DoubleBuffer.allocate(1); - private final DoubleBuffer accelZ = DoubleBuffer.allocate(1); - private VideoHandler videoHandler; - private DepthHandler depthHandler; - private int index; - - private TiltState rawTiltState; - private TiltStatus tiltStatus; - private double tiltAngle; - private double[] accel; - - private final NativeVideoCallback videoCallback = new NativeVideoCallback() { - @Override - public void callback(Pointer dev, Pointer depth, int timestamp) { - videoHandler.onFrameReceived(videoFormat, videoBuffer, timestamp); - } - }; - - private final NativeDepthCallback depthCallback = new NativeDepthCallback() { - @Override - public void callback(Pointer dev, Pointer depth, int timestamp) { - depthHandler.onFrameReceived(depthFormat, depthBuffer, timestamp); - } - }; - - public NativeDevice() {} - - protected NativeDevice(Pointer ptr, int index) { - super(ptr); - this.index = index; - this.rawTiltState = freenect_get_tilt_state(this); - this.accel = new double[3]; - refreshTiltState(); - setVideoFormat(VideoFormat.RGB); - setDepthFormat(DepthFormat.D11BIT); - } + @Override + public void shutdown () { + stopEventThread(); + freenect_shutdown(this); + } + } - protected void setDeviceIndex(int index) { - this.index = index; - } + protected static class NativeDevice extends PointerType implements Device { + private FrameMode videoMode; + private ByteBuffer videoBuffer; + private VideoHandler videoHandler; - @Override - public int getDeviceIndex() { - return index; - } + private FrameMode depthMode; + private ByteBuffer depthBuffer; + private DepthHandler depthHandler; - public void close() { - freenect_close_device(this); - } + private final DoubleBuffer accelX = DoubleBuffer.allocate(1); + private final DoubleBuffer accelY = DoubleBuffer.allocate(1); + private final DoubleBuffer accelZ = DoubleBuffer.allocate(1); - @Override - public void setDepthFormat(DepthFormat fmt) { - freenect_set_depth_format(this, fmt.intValue()); - depthBuffer = ByteBuffer.allocateDirect(fmt.getFrameSize()); - freenect_set_depth_buffer(this, depthBuffer); - this.depthFormat = fmt; - } + private int index; - @Override - public void setVideoFormat(VideoFormat fmt) { - freenect_set_video_format(this, fmt.intValue()); - videoBuffer = ByteBuffer.allocateDirect(fmt.getFrameSize()); - freenect_set_video_buffer(this, videoBuffer); - this.videoFormat = fmt; - } + private TiltState rawTiltState; + private TiltStatus tiltStatus; + private double tiltAngle; + private double[] accel; - @Override - public int setLed(LedStatus status) { - return freenect_set_led(this, status.intValue()); - } + private final NativeVideoCallback videoCallback = new NativeVideoCallback() { + @Override + public void callback (Pointer dev, Pointer depth, int timestamp) { + videoHandler.onFrameReceived(videoMode, videoBuffer, timestamp); + } + }; - @Override - public void refreshTiltState() { - freenect_update_tilt_state(this); - this.rawTiltState = freenect_get_tilt_state(this); - this.tiltAngle = freenect_get_tilt_degs(rawTiltState); - this.tiltStatus = TiltStatus.fromInt(freenect_get_tilt_status(rawTiltState)); - freenect_get_mks_accel(rawTiltState, accelX, accelY, accelZ); - this.accel[0] = accelX.get(0); - this.accel[1] = accelY.get(0); - this.accel[2] = accelZ.get(0); - } + private final NativeDepthCallback depthCallback = new NativeDepthCallback() { + @Override + public void callback (Pointer dev, Pointer depth, int timestamp) { + depthHandler.onFrameReceived(depthMode, depthBuffer, timestamp); + } + }; - @Override - public double getTiltAngle() { - return tiltAngle; - } + public NativeDevice () { + } - @Override - public int setTiltAngle(double angle) { - return freenect_set_tilt_degs(this, angle); - } + protected NativeDevice (Pointer ptr, int index) { + super(ptr); + this.index = index; + this.rawTiltState = freenect_get_tilt_state(this); + this.accel = new double[3]; + refreshTiltState(); + setVideoFormat(VideoFormat.RGB); + setDepthFormat(DepthFormat.D10BIT); + } - @Override - public TiltStatus getTiltStatus() { - return tiltStatus; - } + protected void setDeviceIndex (int index) { + this.index = index; + } - @Override - public double[] getAccel() { - return new double[] { accelX.get(0), accelY.get(0), accelZ.get(0) }; - } + @Override + public int getDeviceIndex () { + return index; + } + + public void close () { + freenect_close_device(this); + } + + @Override + public void setDepthFormat (DepthFormat fmt) { + setDepthFormat(fmt, Resolution.MEDIUM); + } + + @Override + public void setVideoFormat (VideoFormat fmt) { + setVideoFormat(fmt, Resolution.MEDIUM); + } @Override - public int startVideo(VideoHandler handler) { - this.videoHandler = handler; - freenect_set_video_callback(this, videoCallback); - return freenect_start_video(this); + public void setDepthFormat (DepthFormat fmt, Resolution res) { + FrameMode.ByValue mode = freenect_find_depth_mode(res.intValue(), fmt.intValue()); + if (mode.isValid()) { + freenect_set_depth_mode(this, mode); + depthBuffer = ByteBuffer.allocateDirect(mode.getFrameSize()); + freenect_set_depth_buffer(this, depthBuffer); + this.depthMode = mode; + } } @Override - public int stopVideo() { - int rval = freenect_stop_video(this); - freenect_set_video_callback(this, null); - this.videoHandler = null; - return rval; + public void setVideoFormat (VideoFormat fmt, Resolution res) { + FrameMode.ByValue mode = freenect_find_video_mode(res.intValue(), fmt.intValue()); + if (mode.isValid()) { + freenect_set_video_mode(this, mode); + videoBuffer = ByteBuffer.allocateDirect(mode.getFrameSize()); + freenect_set_video_buffer(this, videoBuffer); + this.videoMode = mode; + } } @Override - public int startDepth(DepthHandler handler) { - this.depthHandler = handler; - freenect_set_depth_callback(this, depthCallback); - return freenect_start_depth(this); + public FrameMode getDepthMode() { + return depthMode; } @Override - public int stopDepth() { - int rval = freenect_stop_depth(this); - freenect_set_depth_callback(this, null); - this.depthHandler = null; - return rval; + public FrameMode getVideoMode() { + return videoMode; } - } - private static class EventThread extends Thread { - private final NativeContext ctx; - private volatile boolean alive = true; - - public EventThread(NativeContext ctx) { - this.ctx = ctx; - setDaemon(true); - setName("FreenectEventThread"); - } + @Override + public int setLed (LedStatus status) { + return freenect_set_led(this, status.intValue()); + } - public void kill() { - this.alive = false; - } + @Override + public void refreshTiltState () { + freenect_update_tilt_state(this); + this.rawTiltState = freenect_get_tilt_state(this); + this.tiltAngle = freenect_get_tilt_degs(rawTiltState); + this.tiltStatus = TiltStatus.fromInt(freenect_get_tilt_status(rawTiltState)); + freenect_get_mks_accel(rawTiltState, accelX, accelY, accelZ); + this.accel[0] = accelX.get(0); + this.accel[1] = accelY.get(0); + this.accel[2] = accelZ.get(0); + } - @Override - public void run() { - while (alive) { - freenect_process_events(ctx); - } - } - }; + @Override + public double getTiltAngle () { + return tiltAngle; + } + + @Override + public int setTiltAngle (double angle) { + return freenect_set_tilt_degs(this, angle); + } + + @Override + public TiltStatus getTiltStatus () { + return tiltStatus; + } + + @Override + public double[] getAccel () { + return new double[]{accelX.get(0), accelY.get(0), accelZ.get(0)}; + } + + @Override + public int startVideo (VideoHandler handler) { + this.videoHandler = handler; + freenect_set_video_callback(this, videoCallback); + return freenect_start_video(this); + } + + @Override + public int stopVideo () { + int rval = freenect_stop_video(this); + freenect_set_video_callback(this, null); + this.videoHandler = null; + return rval; + } + + @Override + public int startDepth (DepthHandler handler) { + this.depthHandler = handler; + freenect_set_depth_callback(this, depthCallback); + return freenect_start_depth(this); + } + + @Override + public int stopDepth () { + int rval = freenect_stop_depth(this); + freenect_set_depth_callback(this, null); + this.depthHandler = null; + return rval; + } + } + + private static class EventThread extends Thread { + private final NativeContext ctx; + private volatile boolean alive = true; + + public EventThread (NativeContext ctx) { + this.ctx = ctx; + setDaemon(true); + setName("FreenectEventThread"); + } + + public void kill () { + this.alive = false; + } + + @Override + public void run () { + while (alive) { + freenect_process_events(ctx); + } + } + } + + ; + + protected static class TiltState extends PointerType { + public TiltState () { + } + } + + // function prototypes from libfreenect.h + // These must match the names used in the library! + + public interface NativeLogCallback extends Callback { + void callback (NativeDevice dev, int logLevel, String msg); + } + + private interface NativeDepthCallback extends Callback { + void callback (Pointer dev, Pointer depth, int timestamp); + } + + ; + + private interface NativeVideoCallback extends Callback { + void callback (Pointer dev, Pointer frame, int timestamp); + } + + ; + + private static native int freenect_init (PointerByReference ctx, Pointer usb_ctx); + + private static native int freenect_shutdown (NativeContext ctx); + + private static native void freenect_set_log_level (NativeContext ctx, int level); + + private static native void freenect_set_log_callback (NativeContext ctx, NativeLogCallback cb); + + private static native int freenect_process_events (NativeContext ctx); + + private static native int freenect_num_devices (NativeContext ctx); + + private static native int freenect_open_device (NativeContext ctx, PointerByReference dev, int index); + + private static native int freenect_close_device (NativeDevice dev); + + private static native void freenect_set_user (NativeDevice dev, Pointer user); + + private static native Pointer freenect_get_user (NativeDevice dev); + + private static native void freenect_set_depth_callback (NativeDevice dev, NativeDepthCallback cb); + + private static native void freenect_set_video_callback (NativeDevice dev, NativeVideoCallback cb); + + private static native int freenect_set_depth_buffer (NativeDevice dev, ByteBuffer buf); + + private static native int freenect_set_video_buffer (NativeDevice dev, ByteBuffer buf); + + private static native int freenect_start_depth (NativeDevice dev); + + private static native int freenect_start_video (NativeDevice dev); + + private static native int freenect_stop_depth (NativeDevice dev); + + private static native int freenect_stop_video (NativeDevice dev); + + private static native int freenect_update_tilt_state (NativeDevice dev); + + private static native TiltState freenect_get_tilt_state (NativeDevice dev); + + private static native byte freenect_get_tilt_status (TiltState tiltState); + + private static native double freenect_get_tilt_degs (TiltState tiltState); + + private static native int freenect_set_tilt_degs (NativeDevice dev, double angle); + + private static native int freenect_set_led (NativeDevice dev, int option); + + private static native void freenect_get_mks_accel (TiltState tiltState, DoubleBuffer x, DoubleBuffer y, + DoubleBuffer z); + + private static native int freenect_select_subdevices (NativeContext ctx, int flag); + + private static native int freenect_get_video_mode_count (); + + private static native FrameMode.ByValue freenect_get_video_mode (int mode_num); + + private static native FrameMode.ByValue freenect_get_current_video_mode (NativeDevice dev); + + private static native FrameMode.ByValue freenect_find_video_mode (int res, int fmt); + + private static native int freenect_set_video_mode (NativeDevice dev, FrameMode.ByValue mode); + + private static native int freenect_get_depth_mode_count (); + + private static native FrameMode.ByValue freenect_get_depth_mode (int mode_num); + + private static native FrameMode.ByValue freenect_get_current_depth_mode (NativeDevice dev); + + private static native FrameMode.ByValue freenect_find_depth_mode (int res, int fmt); + + private static native int freenect_set_depth_mode (NativeDevice dev, FrameMode.ByValue mode); - protected static class TiltState extends PointerType { - public TiltState() {} - } - - // function prototypes from libfreenect.h - // These must match the names used in the library! - - public interface NativeLogCallback extends Callback { - void callback(NativeDevice dev, int logLevel, String msg); - } - - private interface NativeDepthCallback extends Callback { - void callback(Pointer dev, Pointer depth, int timestamp); - }; - - private interface NativeVideoCallback extends Callback { - void callback(Pointer dev, Pointer frame, int timestamp); - }; - - private static native int freenect_init(PointerByReference ctx, Pointer usb_ctx); - private static native int freenect_shutdown(NativeContext ctx); - private static native void freenect_set_log_level(NativeContext ctx, int level); - private static native void freenect_set_log_callback(NativeContext ctx, NativeLogCallback cb); - private static native int freenect_process_events(NativeContext ctx); - private static native int freenect_num_devices(NativeContext ctx); - private static native int freenect_open_device(NativeContext ctx, PointerByReference dev, int index); - private static native int freenect_close_device(NativeDevice dev); - private static native void freenect_set_user(NativeDevice dev, Pointer user); - private static native Pointer freenect_get_user(NativeDevice dev); - private static native void freenect_set_depth_callback(NativeDevice dev, NativeDepthCallback cb); - private static native void freenect_set_video_callback(NativeDevice dev, NativeVideoCallback cb); - private static native int freenect_set_depth_format(NativeDevice dev, int i); - private static native int freenect_set_video_format(NativeDevice dev, int i); - private static native int freenect_set_depth_buffer(NativeDevice dev, ByteBuffer buf); - private static native int freenect_set_video_buffer(NativeDevice dev, ByteBuffer buf); - private static native int freenect_start_depth(NativeDevice dev); - private static native int freenect_start_video(NativeDevice dev); - private static native int freenect_stop_depth(NativeDevice dev); - private static native int freenect_stop_video(NativeDevice dev); - private static native int freenect_update_tilt_state(NativeDevice dev); - private static native TiltState freenect_get_tilt_state(NativeDevice dev); - private static native byte freenect_get_tilt_status(TiltState tiltState); - private static native double freenect_get_tilt_degs(TiltState tiltState); - private static native int freenect_set_tilt_degs(NativeDevice dev, double angle); - private static native int freenect_set_led(NativeDevice dev, int option); - private static native void freenect_get_mks_accel(TiltState tiltState, DoubleBuffer x, DoubleBuffer y, DoubleBuffer z); -} +} \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/LedStatus.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/LedStatus.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/LedStatus.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/LedStatus.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,5 +1,32 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; +import java.util.HashMap; +import java.util.Map; + public enum LedStatus { OFF(0), GREEN(1), @@ -8,7 +35,14 @@ BLINK_YELLOW(4), BLINK_GREEN(5), BLINK_RED_YELLOW(6); + private final int value; + private static final Map MAP = new HashMap(7); + static { + for(LedStatus v : LedStatus.values()) { + MAP.put(v.intValue(), v); + } + } private LedStatus(int value) { this.value = value; @@ -17,4 +51,8 @@ public int intValue() { return value; } + + public static LedStatus fromInt(int value) { + return MAP.get(value); + } } \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/LogHandler.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/LogHandler.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/LogHandler.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/LogHandler.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,3 +1,27 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; public interface LogHandler { diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/LogLevel.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/LogLevel.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/LogLevel.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/LogLevel.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,3 +1,27 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; import java.util.HashMap; @@ -13,15 +37,14 @@ SPEW(6), FLOOD(7); + private final int value; private static final Map MAP = new HashMap(8); static { - for (LogLevel value : values()) { - MAP.put(value.intValue(), value); + for(LogLevel v : LogLevel.values()) { + MAP.put(v.intValue(), v); } } - private final int value; - private LogLevel(int value) { this.value = value; } @@ -31,6 +54,6 @@ } public static LogLevel fromInt(int value) { - return MAP.get(value); + return MAP.get(value); } -} +} \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Resolution.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Resolution.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/Resolution.java 1970-01-01 00:00:00.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/Resolution.java 2012-01-29 14:19:13.000000000 +0000 @@ -0,0 +1,54 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ +package org.openkinect.freenect; + +import java.util.HashMap; +import java.util.Map; + +public enum Resolution { + LOW(0), + MEDIUM(1), + HIGH(2); + + private final int value; + private static final Map MAP = new HashMap(3); + static { + for(Resolution v : Resolution.values()) { + MAP.put(v.intValue(), v); + } + } + + private Resolution(int value) { + this.value = value; + } + + public int intValue() { + return value; + } + + public static Resolution fromInt(int value) { + return MAP.get(value); + } +} \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/TiltStatus.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/TiltStatus.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/TiltStatus.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/TiltStatus.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,3 +1,27 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; import java.util.HashMap; @@ -7,13 +31,13 @@ STOPPED(0), LIMIT(1), MOVING(4); - private final int value; - static final Map MAP = new HashMap(3); + private final int value; + private static final Map MAP = new HashMap(3); static { - for (TiltStatus ts : TiltStatus.values()) { - MAP.put(ts.intValue(), ts); - } + for(TiltStatus v : TiltStatus.values()) { + MAP.put(v.intValue(), v); + } } private TiltStatus(int value) { @@ -27,4 +51,4 @@ public static TiltStatus fromInt(int value) { return MAP.get(value); } -} +} \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/util/Jdk14LogHandler.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/util/Jdk14LogHandler.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/util/Jdk14LogHandler.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/util/Jdk14LogHandler.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,13 +1,37 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect.util; -import java.util.EnumMap; -import java.util.logging.Level; -import java.util.logging.Logger; - import org.openkinect.freenect.Device; import org.openkinect.freenect.LogHandler; import org.openkinect.freenect.LogLevel; +import java.util.EnumMap; +import java.util.logging.Level; +import java.util.logging.Logger; + public class Jdk14LogHandler implements LogHandler { private final Logger logger = Logger.getLogger("freenect"); diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/VideoFormat.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/VideoFormat.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/VideoFormat.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/VideoFormat.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,40 +1,58 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; +import java.util.HashMap; +import java.util.Map; public enum VideoFormat { - RGB(0, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_VIDEO_RGB_SIZE), - BAYER(1, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_VIDEO_BAYER_SIZE), - IR_8BIT(2, Freenect.FREENECT_IR_FRAME_W, Freenect.FREENECT_IR_FRAME_H, Freenect.FREENECT_VIDEO_IR_8BIT_SIZE), - IR_10BIT(3, Freenect.FREENECT_IR_FRAME_W, Freenect.FREENECT_IR_FRAME_H, Freenect.FREENECT_VIDEO_IR_10BIT_SIZE), - IR_10BIT_PACKED(4, Freenect.FREENECT_IR_FRAME_W, Freenect.FREENECT_IR_FRAME_H, Freenect.FREENECT_VIDEO_IR_10BIT_PACKED_SIZE), - YUV_RGB(5, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_VIDEO_RGB_SIZE), - YUV_RAW(6, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_VIDEO_YUV_SIZE); - + RGB(0), + BAYER(1), + IR_8BIT(2), + IR_10BIT(3), + IR_10BIT_PACKED(4), + YUV_RGB(5), + YUV_RAW(6); + private final int value; - private final int frameSize; - private final int width; - private final int height; + private static final Map MAP = new HashMap(7); + static { + for(VideoFormat v : VideoFormat.values()) { + MAP.put(v.intValue(), v); + } + } - private VideoFormat(int value, int width, int height, int frameSize) { + private VideoFormat(int value) { this.value = value; - this.width = width; - this.height = height; - this.frameSize = frameSize; } - + public int intValue() { return value; } - - public int getFrameSize() { - return frameSize; - } - - public int getWidth() { - return width; - } - - public int getHeight() { - return height; + + public static VideoFormat fromInt(int value) { + return MAP.get(value); } } \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/VideoHandler.java libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/VideoHandler.java --- libfreenect-0.1.1.3/wrappers/java/src/main/java/org/openkinect/freenect/VideoHandler.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/main/java/org/openkinect/freenect/VideoHandler.java 2012-01-29 14:19:13.000000000 +0000 @@ -1,7 +1,31 @@ +/** + * This file is part of the OpenKinect Project. http://www.openkinect.org + * + * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file + * for details. + * + * This code is licensed to you under the terms of the Apache License, version + * 2.0, or, at your option, the terms of the GNU General Public License, + * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, + * or the following URLs: + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/gpl-2.0.txt + * + * If you redistribute this file in source form, modified or unmodified, + * you may: + * 1) Leave this header intact and distribute it under the same terms, + * accompanying it with the APACHE20 and GPL20 files, or + * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or + * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file + * In all cases you must keep the copyright notice intact and include a copy + * of the CONTRIB file. + * Binary distributions must follow the binary distribution requirements of + * either License. + */ package org.openkinect.freenect; import java.nio.ByteBuffer; public interface VideoHandler { - void onFrameReceived(VideoFormat format, ByteBuffer frame, int timestamp); + void onFrameReceived(FrameMode mode, ByteBuffer frame, int timestamp); } \ No newline at end of file diff -Nru libfreenect-0.1.1.3/wrappers/java/src/test/java/org/openkinect/freenect/FreenectTest.java libfreenect-0.1.2/wrappers/java/src/test/java/org/openkinect/freenect/FreenectTest.java --- libfreenect-0.1.1.3/wrappers/java/src/test/java/org/openkinect/freenect/FreenectTest.java 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/java/src/test/java/org/openkinect/freenect/FreenectTest.java 2012-01-29 14:19:13.000000000 +0000 @@ -97,7 +97,7 @@ }); dev.startVideo(new VideoHandler() { @Override - public void onFrameReceived(VideoFormat format, ByteBuffer frame, int timestamp) { + public void onFrameReceived(FrameMode mode, ByteBuffer frame, int timestamp) { } }); Thread.sleep(500); @@ -117,13 +117,13 @@ int frameCount = 0; @Override - public void onFrameReceived(DepthFormat format, ByteBuffer frame, int timestamp) { + public void onFrameReceived(FrameMode mode, ByteBuffer frame, int timestamp) { frameCount++; if (frameCount == 30) { synchronized (lock) { lock.notify(); System.out.format("Got %d depth frames in %4.2fs%n", frameCount, - (((double) System.nanoTime() - start) / 1000000)); + (((double) System.nanoTime() - start) / 1000000000)); } } } @@ -143,13 +143,13 @@ int frameCount = 0; @Override - public void onFrameReceived(VideoFormat format, ByteBuffer frame, int timestamp) { + public void onFrameReceived(FrameMode mode, ByteBuffer frame, int timestamp) { frameCount++; if (frameCount == 30) { synchronized (lock) { lock.notify(); System.out.format("Got %d video frames in %4.2fs%n", frameCount, - (((double) System.nanoTime() - start) / 1000000)); + (((double) System.nanoTime() - start) / 1000000000)); } } } diff -Nru libfreenect-0.1.1.3/wrappers/opencv/CMakeLists.txt libfreenect-0.1.2/wrappers/opencv/CMakeLists.txt --- libfreenect-0.1.1.3/wrappers/opencv/CMakeLists.txt 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/opencv/CMakeLists.txt 2012-01-29 14:19:13.000000000 +0000 @@ -1,6 +1,7 @@ ###################################################################################### # OpenCV Interface ###################################################################################### +find_package(OpenCV REQUIRED) add_library (freenect_cv SHARED libfreenect_cv.c) set_target_properties (freenect_cv PROPERTIES VERSION ${PROJECT_VER} @@ -8,7 +9,7 @@ include_directories (../c_sync) -target_link_libraries (freenect_cv freenect_sync cv) +target_link_libraries (freenect_cv freenect_sync ${OpenCV_LIBS}) install (TARGETS freenect_cv DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}") @@ -16,6 +17,6 @@ DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR}) add_executable(cvdemo cvdemo.c) -target_link_libraries(cvdemo freenect freenect_sync freenect_cv cv cxcore highgui) +target_link_libraries(cvdemo freenect freenect_sync freenect_cv ${OpenCV_LIBS}) install (TARGETS cvdemo DESTINATION bin) diff -Nru libfreenect-0.1.1.3/wrappers/python/CMakeLists.txt libfreenect-0.1.2/wrappers/python/CMakeLists.txt --- libfreenect-0.1.1.3/wrappers/python/CMakeLists.txt 2011-07-28 16:18:54.000000000 +0000 +++ libfreenect-0.1.2/wrappers/python/CMakeLists.txt 2012-01-29 14:19:13.000000000 +0000 @@ -12,6 +12,11 @@ ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}')" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE) +# Figure out numpy include path +execute_process(COMMAND + ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()" + OUTPUT_VARIABLE NUMPY_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + # How to Cython the .pyx file add_custom_command(OUTPUT freenect.c COMMAND ${CYTHON_EXECUTABLE} -o freenect.c "${CMAKE_CURRENT_SOURCE_DIR}/freenect.pyx") @@ -24,7 +29,7 @@ OUTPUT_NAME "freenect" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(cython_freenect freenect_sync) -include_directories(${PYTHON_INCLUDE_PATH} ../c_sync/) +include_directories(${PYTHON_INCLUDE_PATH} ../c_sync/ ${NUMPY_INCLUDE_PATH}) # Install the extension install(TARGETS cython_freenect diff -Nru libfreenect-0.1.1.3/wrappers/python/freenect.c libfreenect-0.1.2/wrappers/python/freenect.c --- libfreenect-0.1.1.3/wrappers/python/freenect.c 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/wrappers/python/freenect.c 2012-01-29 14:19:13.000000000 +0000 @@ -1,4 +1,4 @@ -/* Generated by Cython 0.14.1 on Sun Oct 16 14:55:33 2011 */ +/* Generated by Cython 0.14.1 on Thu Nov 10 13:32:00 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -400,7 +400,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "freenect.pyx":168 +/* "freenect.pyx":165 * * * cdef class CtxPtr: # <<<<<<<<<<<<<< @@ -413,7 +413,7 @@ freenect_context *_ptr; }; -/* "freenect.pyx":179 +/* "freenect.pyx":176 * return "" * * cdef class StatePtr: # <<<<<<<<<<<<<< @@ -426,7 +426,7 @@ freenect_raw_tilt_state *_ptr; }; -/* "freenect.pyx":173 +/* "freenect.pyx":170 * return "" * * cdef class DevPtr: # <<<<<<<<<<<<<< @@ -765,6 +765,7 @@ static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__cb[] = "cb"; static char __pyx_k__np[] = "np"; static char __pyx_k__buf[] = "buf"; static char __pyx_k__ctx[] = "ctx"; @@ -839,6 +840,7 @@ static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k___depth_cb_np[] = "_depth_cb_np"; static char __pyx_k___video_cb_np[] = "_video_cb_np"; +static char __pyx_k__base_runloop[] = "base_runloop"; static char __pyx_k__close_device[] = "close_device"; static char __pyx_k__DEVICE_CAMERA[] = "DEVICE_CAMERA"; static char __pyx_k__VIDEO_IR_8BIT[] = "VIDEO_IR_8BIT"; @@ -867,6 +869,8 @@ static char __pyx_k__update_tilt_state[] = "update_tilt_state"; static char __pyx_k__DEPTH_10BIT_PACKED[] = "DEPTH_10BIT_PACKED"; static char __pyx_k__DEPTH_11BIT_PACKED[] = "DEPTH_11BIT_PACKED"; +static char __pyx_k__set_depth_callback[] = "set_depth_callback"; +static char __pyx_k__set_video_callback[] = "set_video_callback"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_s_10; static PyObject *__pyx_kp_u_12; @@ -924,9 +928,11 @@ static PyObject *__pyx_n_s__accelerometer_z; static PyObject *__pyx_n_s__angle; static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__base_runloop; static PyObject *__pyx_n_s__body; static PyObject *__pyx_n_s__buf; static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__cb; static PyObject *__pyx_n_s__close_device; static PyObject *__pyx_n_s__ctx; static PyObject *__pyx_n_s__depth; @@ -959,9 +965,11 @@ static PyObject *__pyx_n_s__res; static PyObject *__pyx_n_s__resize; static PyObject *__pyx_n_s__runloop; +static PyObject *__pyx_n_s__set_depth_callback; static PyObject *__pyx_n_s__set_depth_mode; static PyObject *__pyx_n_s__set_led; static PyObject *__pyx_n_s__set_tilt_degs; +static PyObject *__pyx_n_s__set_video_callback; static PyObject *__pyx_n_s__set_video_mode; static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__shutdown; @@ -1001,7 +1009,7 @@ static PyObject *__pyx_k_tuple_21; static PyObject *__pyx_k_tuple_23; -/* "freenect.pyx":170 +/* "freenect.pyx":167 * cdef class CtxPtr: * cdef freenect_context* _ptr * def __repr__(self): # <<<<<<<<<<<<<< @@ -1014,7 +1022,7 @@ PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("__repr__"); - /* "freenect.pyx":171 + /* "freenect.pyx":168 * cdef freenect_context* _ptr * def __repr__(self): * return "" # <<<<<<<<<<<<<< @@ -1033,7 +1041,7 @@ return __pyx_r; } -/* "freenect.pyx":176 +/* "freenect.pyx":173 * cdef freenect_device* _ptr * cdef CtxPtr ctx * def __repr__(self): # <<<<<<<<<<<<<< @@ -1046,7 +1054,7 @@ PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("__repr__"); - /* "freenect.pyx":177 + /* "freenect.pyx":174 * cdef CtxPtr ctx * def __repr__(self): * return "" # <<<<<<<<<<<<<< @@ -1065,7 +1073,7 @@ return __pyx_r; } -/* "freenect.pyx":181 +/* "freenect.pyx":178 * cdef class StatePtr: * cdef freenect_raw_tilt_state* _ptr * def __repr__(self): # <<<<<<<<<<<<<< @@ -1078,7 +1086,7 @@ PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("__repr__"); - /* "freenect.pyx":182 + /* "freenect.pyx":179 * cdef freenect_raw_tilt_state* _ptr * def __repr__(self): * return "" # <<<<<<<<<<<<<< @@ -1097,7 +1105,7 @@ return __pyx_r; } -/* "freenect.pyx":184 +/* "freenect.pyx":181 * return "" * * def _get_accelx(self): # <<<<<<<<<<<<<< @@ -1112,7 +1120,7 @@ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("_get_accelx"); - /* "freenect.pyx":185 + /* "freenect.pyx":182 * * def _get_accelx(self): * return int(self._ptr.accelerometer_x) # <<<<<<<<<<<<<< @@ -1120,14 +1128,14 @@ * def _get_accely(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1147,7 +1155,7 @@ return __pyx_r; } -/* "freenect.pyx":187 +/* "freenect.pyx":184 * return int(self._ptr.accelerometer_x) * * def _get_accely(self): # <<<<<<<<<<<<<< @@ -1162,7 +1170,7 @@ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("_get_accely"); - /* "freenect.pyx":188 + /* "freenect.pyx":185 * * def _get_accely(self): * return int(self._ptr.accelerometer_y) # <<<<<<<<<<<<<< @@ -1170,14 +1178,14 @@ * def _get_accelz(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1197,7 +1205,7 @@ return __pyx_r; } -/* "freenect.pyx":190 +/* "freenect.pyx":187 * return int(self._ptr.accelerometer_y) * * def _get_accelz(self): # <<<<<<<<<<<<<< @@ -1212,7 +1220,7 @@ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("_get_accelz"); - /* "freenect.pyx":191 + /* "freenect.pyx":188 * * def _get_accelz(self): * return int(self._ptr.accelerometer_z) # <<<<<<<<<<<<<< @@ -1220,14 +1228,14 @@ * def _get_tilt_angle(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1247,7 +1255,7 @@ return __pyx_r; } -/* "freenect.pyx":193 +/* "freenect.pyx":190 * return int(self._ptr.accelerometer_z) * * def _get_tilt_angle(self): # <<<<<<<<<<<<<< @@ -1262,7 +1270,7 @@ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("_get_tilt_angle"); - /* "freenect.pyx":194 + /* "freenect.pyx":191 * * def _get_tilt_angle(self): * return int(self._ptr.tilt_angle) # <<<<<<<<<<<<<< @@ -1270,14 +1278,14 @@ * def _get_tilt_status(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int8_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int8_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1297,7 +1305,7 @@ return __pyx_r; } -/* "freenect.pyx":196 +/* "freenect.pyx":193 * return int(self._ptr.tilt_angle) * * def _get_tilt_status(self): # <<<<<<<<<<<<<< @@ -1312,7 +1320,7 @@ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("_get_tilt_status"); - /* "freenect.pyx":197 + /* "freenect.pyx":194 * * def _get_tilt_status(self): * return int(self._ptr.tilt_status) # <<<<<<<<<<<<<< @@ -1320,14 +1328,14 @@ * accelerometer_x = property(_get_accelx) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1347,7 +1355,7 @@ return __pyx_r; } -/* "freenect.pyx":205 +/* "freenect.pyx":202 * tilt_status = property(_get_tilt_status) * * def set_depth_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< @@ -1385,39 +1393,39 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_depth_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_depth_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_res = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_res = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect.set_depth_mode"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":206 + /* "freenect.pyx":203 * * def set_depth_mode(DevPtr dev, int res, int mode): * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) # <<<<<<<<<<<<<< @@ -1425,7 +1433,7 @@ * def set_video_mode(DevPtr dev, int res, int mode): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_set_depth_mode(__pyx_v_dev->_ptr, freenect_find_depth_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_set_depth_mode(__pyx_v_dev->_ptr, freenect_find_depth_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1443,7 +1451,7 @@ return __pyx_r; } -/* "freenect.pyx":208 +/* "freenect.pyx":205 * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) * * def set_video_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< @@ -1481,39 +1489,39 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_video_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_video_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_res = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_res = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect.set_video_mode"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":209 + /* "freenect.pyx":206 * * def set_video_mode(DevPtr dev, int res, int mode): * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) # <<<<<<<<<<<<<< @@ -1521,7 +1529,7 @@ * def start_depth(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_set_video_mode(__pyx_v_dev->_ptr, freenect_find_video_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_set_video_mode(__pyx_v_dev->_ptr, freenect_find_video_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1539,7 +1547,7 @@ return __pyx_r; } -/* "freenect.pyx":211 +/* "freenect.pyx":208 * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) * * def start_depth(DevPtr dev): # <<<<<<<<<<<<<< @@ -1554,9 +1562,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("start_depth"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":212 + /* "freenect.pyx":209 * * def start_depth(DevPtr dev): * return freenect_start_depth(dev._ptr) # <<<<<<<<<<<<<< @@ -1564,7 +1572,7 @@ * def start_video(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_start_depth(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_start_depth(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1582,7 +1590,7 @@ return __pyx_r; } -/* "freenect.pyx":214 +/* "freenect.pyx":211 * return freenect_start_depth(dev._ptr) * * def start_video(DevPtr dev): # <<<<<<<<<<<<<< @@ -1597,9 +1605,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("start_video"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":215 + /* "freenect.pyx":212 * * def start_video(DevPtr dev): * return freenect_start_video(dev._ptr) # <<<<<<<<<<<<<< @@ -1607,7 +1615,7 @@ * def stop_depth(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_start_video(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_start_video(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1625,7 +1633,7 @@ return __pyx_r; } -/* "freenect.pyx":217 +/* "freenect.pyx":214 * return freenect_start_video(dev._ptr) * * def stop_depth(DevPtr dev): # <<<<<<<<<<<<<< @@ -1640,9 +1648,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("stop_depth"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":218 + /* "freenect.pyx":215 * * def stop_depth(DevPtr dev): * return freenect_stop_depth(dev._ptr) # <<<<<<<<<<<<<< @@ -1650,7 +1658,7 @@ * def stop_video(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_stop_depth(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_stop_depth(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1668,7 +1676,7 @@ return __pyx_r; } -/* "freenect.pyx":220 +/* "freenect.pyx":217 * return freenect_stop_depth(dev._ptr) * * def stop_video(DevPtr dev): # <<<<<<<<<<<<<< @@ -1683,9 +1691,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("stop_video"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":221 + /* "freenect.pyx":218 * * def stop_video(DevPtr dev): * return freenect_stop_video(dev._ptr) # <<<<<<<<<<<<<< @@ -1693,7 +1701,7 @@ * def shutdown(CtxPtr ctx): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_stop_video(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_stop_video(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1711,7 +1719,7 @@ return __pyx_r; } -/* "freenect.pyx":223 +/* "freenect.pyx":220 * return freenect_stop_video(dev._ptr) * * def shutdown(CtxPtr ctx): # <<<<<<<<<<<<<< @@ -1726,9 +1734,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("shutdown"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":224 + /* "freenect.pyx":221 * * def shutdown(CtxPtr ctx): * return freenect_shutdown(ctx._ptr) # <<<<<<<<<<<<<< @@ -1736,7 +1744,7 @@ * def process_events(CtxPtr ctx): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_shutdown(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_shutdown(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1754,7 +1762,7 @@ return __pyx_r; } -/* "freenect.pyx":226 +/* "freenect.pyx":223 * return freenect_shutdown(ctx._ptr) * * def process_events(CtxPtr ctx): # <<<<<<<<<<<<<< @@ -1769,9 +1777,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("process_events"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":227 + /* "freenect.pyx":224 * * def process_events(CtxPtr ctx): * return freenect_process_events(ctx._ptr) # <<<<<<<<<<<<<< @@ -1779,7 +1787,7 @@ * def num_devices(CtxPtr ctx): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_process_events(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_process_events(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1797,7 +1805,7 @@ return __pyx_r; } -/* "freenect.pyx":229 +/* "freenect.pyx":226 * return freenect_process_events(ctx._ptr) * * def num_devices(CtxPtr ctx): # <<<<<<<<<<<<<< @@ -1812,9 +1820,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("num_devices"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":230 + /* "freenect.pyx":227 * * def num_devices(CtxPtr ctx): * return freenect_num_devices(ctx._ptr) # <<<<<<<<<<<<<< @@ -1822,7 +1830,7 @@ * def close_device(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_num_devices(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_num_devices(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1840,7 +1848,7 @@ return __pyx_r; } -/* "freenect.pyx":232 +/* "freenect.pyx":229 * return freenect_num_devices(ctx._ptr) * * def close_device(DevPtr dev): # <<<<<<<<<<<<<< @@ -1855,9 +1863,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("close_device"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":233 + /* "freenect.pyx":230 * * def close_device(DevPtr dev): * return freenect_close_device(dev._ptr) # <<<<<<<<<<<<<< @@ -1865,7 +1873,7 @@ * def set_tilt_degs(DevPtr dev, float angle): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_close_device(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_close_device(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1883,7 +1891,7 @@ return __pyx_r; } -/* "freenect.pyx":235 +/* "freenect.pyx":232 * return freenect_close_device(dev._ptr) * * def set_tilt_degs(DevPtr dev, float angle): # <<<<<<<<<<<<<< @@ -1918,31 +1926,31 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__angle); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_tilt_degs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_tilt_degs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_angle = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_angle = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_angle = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_angle = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect.set_tilt_degs"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":236 + /* "freenect.pyx":233 * * def set_tilt_degs(DevPtr dev, float angle): * freenect_set_tilt_degs(dev._ptr, angle) # <<<<<<<<<<<<<< @@ -1962,7 +1970,7 @@ return __pyx_r; } -/* "freenect.pyx":238 +/* "freenect.pyx":235 * freenect_set_tilt_degs(dev._ptr, angle) * * def set_led(DevPtr dev, freenect_led_options option): # <<<<<<<<<<<<<< @@ -1998,31 +2006,31 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__option); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_led") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_led") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_option = PyInt_AsLong(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_option = PyInt_AsLong(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_option = PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_option = PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect.set_led"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":239 + /* "freenect.pyx":236 * * def set_led(DevPtr dev, freenect_led_options option): * return freenect_set_led(dev._ptr, option) # <<<<<<<<<<<<<< @@ -2030,7 +2038,7 @@ * def update_tilt_state(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_set_led(__pyx_v_dev->_ptr, __pyx_v_option)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_set_led(__pyx_v_dev->_ptr, __pyx_v_option)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2048,7 +2056,7 @@ return __pyx_r; } -/* "freenect.pyx":241 +/* "freenect.pyx":238 * return freenect_set_led(dev._ptr, option) * * def update_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< @@ -2063,9 +2071,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("update_tilt_state"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":242 + /* "freenect.pyx":239 * * def update_tilt_state(DevPtr dev): * return freenect_update_tilt_state(dev._ptr) # <<<<<<<<<<<<<< @@ -2073,7 +2081,7 @@ * def get_tilt_state(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_update_tilt_state(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_update_tilt_state(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2091,7 +2099,7 @@ return __pyx_r; } -/* "freenect.pyx":244 +/* "freenect.pyx":241 * return freenect_update_tilt_state(dev._ptr) * * def get_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< @@ -2109,9 +2117,9 @@ __Pyx_RefNannySetupContext("get_tilt_state"); __pyx_self = __pyx_self; __pyx_v_state_out = ((struct __pyx_obj_8freenect_StatePtr *)Py_None); __Pyx_INCREF(Py_None); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":245 + /* "freenect.pyx":242 * * def get_tilt_state(DevPtr dev): * cdef freenect_raw_tilt_state* state = freenect_get_tilt_state(dev._ptr) # <<<<<<<<<<<<<< @@ -2120,20 +2128,20 @@ */ __pyx_v_state = freenect_get_tilt_state(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr); - /* "freenect.pyx":247 + /* "freenect.pyx":244 * cdef freenect_raw_tilt_state* state = freenect_get_tilt_state(dev._ptr) * cdef StatePtr state_out * state_out = StatePtr() # <<<<<<<<<<<<<< * state_out._ptr = state * return state_out */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_StatePtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_StatePtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_state_out)); __pyx_v_state_out = ((struct __pyx_obj_8freenect_StatePtr *)__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":248 + /* "freenect.pyx":245 * cdef StatePtr state_out * state_out = StatePtr() * state_out._ptr = state # <<<<<<<<<<<<<< @@ -2142,7 +2150,7 @@ */ __pyx_v_state_out->_ptr = __pyx_v_state; - /* "freenect.pyx":249 + /* "freenect.pyx":246 * state_out = StatePtr() * state_out._ptr = state * return state_out # <<<<<<<<<<<<<< @@ -2167,7 +2175,7 @@ return __pyx_r; } -/* "freenect.pyx":251 +/* "freenect.pyx":248 * return state_out * * def get_mks_accel(StatePtr state): # <<<<<<<<<<<<<< @@ -2188,9 +2196,9 @@ PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("get_mks_accel"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":253 + /* "freenect.pyx":250 * def get_mks_accel(StatePtr state): * cdef double x, y, z * freenect_get_mks_accel(state._ptr, &x, &y, &z) # <<<<<<<<<<<<<< @@ -2199,7 +2207,7 @@ */ freenect_get_mks_accel(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_state)->_ptr, (&__pyx_v_x), (&__pyx_v_y), (&__pyx_v_z)); - /* "freenect.pyx":254 + /* "freenect.pyx":251 * cdef double x, y, z * freenect_get_mks_accel(state._ptr, &x, &y, &z) * return x, y, z # <<<<<<<<<<<<<< @@ -2207,13 +2215,13 @@ * def get_accel(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -2243,7 +2251,7 @@ return __pyx_r; } -/* "freenect.pyx":256 +/* "freenect.pyx":253 * return x, y, z * * def get_accel(DevPtr dev): # <<<<<<<<<<<<<< @@ -2262,29 +2270,29 @@ PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("get_accel"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":265 + /* "freenect.pyx":262 * (x, y, z) accelerometer values * """ * update_tilt_state(dev) # <<<<<<<<<<<<<< * return get_mks_accel(get_tilt_state(dev)) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__update_tilt_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__update_tilt_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_dev); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dev); __Pyx_GIVEREF(__pyx_v_dev); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":266 + /* "freenect.pyx":263 * """ * update_tilt_state(dev) * return get_mks_accel(get_tilt_state(dev)) # <<<<<<<<<<<<<< @@ -2292,25 +2300,25 @@ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_mks_accel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_mks_accel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_tilt_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_tilt_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_dev); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dev); __Pyx_GIVEREF(__pyx_v_dev); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -2333,7 +2341,7 @@ return __pyx_r; } -/* "freenect.pyx":269 +/* "freenect.pyx":266 * * * def get_tilt_degs(StatePtr state): # <<<<<<<<<<<<<< @@ -2348,9 +2356,9 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_tilt_degs"); __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":270 + /* "freenect.pyx":267 * * def get_tilt_degs(StatePtr state): * return freenect_get_tilt_degs(state._ptr) # <<<<<<<<<<<<<< @@ -2358,7 +2366,7 @@ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(freenect_get_tilt_degs(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_state)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(freenect_get_tilt_degs(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_state)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2376,7 +2384,7 @@ return __pyx_r; } -/* "freenect.pyx":273 +/* "freenect.pyx":270 * * * def error_open_device(): # <<<<<<<<<<<<<< @@ -2391,14 +2399,14 @@ __Pyx_RefNannySetupContext("error_open_device"); __pyx_self = __pyx_self; - /* "freenect.pyx":274 + /* "freenect.pyx":271 * * def error_open_device(): * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") # <<<<<<<<<<<<<< * * cpdef init(): */ - if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -2411,7 +2419,7 @@ return __pyx_r; } -/* "freenect.pyx":276 +/* "freenect.pyx":273 * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") * * cpdef init(): # <<<<<<<<<<<<<< @@ -2429,7 +2437,7 @@ __Pyx_RefNannySetupContext("init"); __pyx_v_ctx_out = ((struct __pyx_obj_8freenect_CtxPtr *)Py_None); __Pyx_INCREF(Py_None); - /* "freenect.pyx":278 + /* "freenect.pyx":275 * cpdef init(): * cdef freenect_context* ctx * if freenect_init(&ctx, NULL) < 0: # <<<<<<<<<<<<<< @@ -2439,7 +2447,7 @@ __pyx_t_1 = (freenect_init((&__pyx_v_ctx), NULL) < 0); if (__pyx_t_1) { - /* "freenect.pyx":279 + /* "freenect.pyx":276 * cdef freenect_context* ctx * if freenect_init(&ctx, NULL) < 0: * return # <<<<<<<<<<<<<< @@ -2453,7 +2461,7 @@ } __pyx_L3:; - /* "freenect.pyx":284 + /* "freenect.pyx":281 * # Also, we don't support audio in the python wrapper yet, so no sense claiming * # the device. * freenect_select_subdevices(ctx, FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA) # <<<<<<<<<<<<<< @@ -2462,20 +2470,20 @@ */ freenect_select_subdevices(__pyx_v_ctx, (FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA)); - /* "freenect.pyx":286 + /* "freenect.pyx":283 * freenect_select_subdevices(ctx, FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA) * cdef CtxPtr ctx_out * ctx_out = CtxPtr() # <<<<<<<<<<<<<< * ctx_out._ptr = ctx * return ctx_out */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_CtxPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_CtxPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_v_ctx_out)); __pyx_v_ctx_out = ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":287 + /* "freenect.pyx":284 * cdef CtxPtr ctx_out * ctx_out = CtxPtr() * ctx_out._ptr = ctx # <<<<<<<<<<<<<< @@ -2484,7 +2492,7 @@ */ __pyx_v_ctx_out->_ptr = __pyx_v_ctx; - /* "freenect.pyx":288 + /* "freenect.pyx":285 * ctx_out = CtxPtr() * ctx_out._ptr = ctx * return ctx_out # <<<<<<<<<<<<<< @@ -2509,7 +2517,7 @@ return __pyx_r; } -/* "freenect.pyx":276 +/* "freenect.pyx":273 * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") * * cpdef init(): # <<<<<<<<<<<<<< @@ -2524,7 +2532,7 @@ __Pyx_RefNannySetupContext("init"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2542,7 +2550,7 @@ return __pyx_r; } -/* "freenect.pyx":290 +/* "freenect.pyx":287 * return ctx_out * * cpdef open_device(CtxPtr ctx, int index): # <<<<<<<<<<<<<< @@ -2560,7 +2568,7 @@ __Pyx_RefNannySetupContext("open_device"); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); - /* "freenect.pyx":292 + /* "freenect.pyx":289 * cpdef open_device(CtxPtr ctx, int index): * cdef freenect_device* dev * if freenect_open_device(ctx._ptr, &dev, index) < 0: # <<<<<<<<<<<<<< @@ -2570,7 +2578,7 @@ __pyx_t_1 = (freenect_open_device(__pyx_v_ctx->_ptr, (&__pyx_v_dev), __pyx_v_index) < 0); if (__pyx_t_1) { - /* "freenect.pyx":293 + /* "freenect.pyx":290 * cdef freenect_device* dev * if freenect_open_device(ctx._ptr, &dev, index) < 0: * return # <<<<<<<<<<<<<< @@ -2584,20 +2592,20 @@ } __pyx_L3:; - /* "freenect.pyx":295 + /* "freenect.pyx":292 * return * cdef DevPtr dev_out * dev_out = DevPtr() # <<<<<<<<<<<<<< * dev_out._ptr = dev * dev_out.ctx = ctx */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_v_dev_out)); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":296 + /* "freenect.pyx":293 * cdef DevPtr dev_out * dev_out = DevPtr() * dev_out._ptr = dev # <<<<<<<<<<<<<< @@ -2606,7 +2614,7 @@ */ __pyx_v_dev_out->_ptr = __pyx_v_dev; - /* "freenect.pyx":297 + /* "freenect.pyx":294 * dev_out = DevPtr() * dev_out._ptr = dev * dev_out.ctx = ctx # <<<<<<<<<<<<<< @@ -2619,7 +2627,7 @@ __Pyx_DECREF(((PyObject *)__pyx_v_dev_out->ctx)); __pyx_v_dev_out->ctx = __pyx_v_ctx; - /* "freenect.pyx":298 + /* "freenect.pyx":295 * dev_out._ptr = dev * dev_out.ctx = ctx * return dev_out # <<<<<<<<<<<<<< @@ -2644,7 +2652,7 @@ return __pyx_r; } -/* "freenect.pyx":290 +/* "freenect.pyx":287 * return ctx_out * * cpdef open_device(CtxPtr ctx, int index): # <<<<<<<<<<<<<< @@ -2679,31 +2687,31 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "open_device") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "open_device") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)values[0]); - __pyx_v_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_index = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_index = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect.open_device"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_8freenect_open_device(__pyx_v_ctx, __pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_8freenect_open_device(__pyx_v_ctx, __pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2721,7 +2729,7 @@ return __pyx_r; } -/* "freenect.pyx":302 +/* "freenect.pyx":299 * _depth_cb, _video_cb = None, None * * cdef void depth_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: # <<<<<<<<<<<<<< @@ -2744,7 +2752,7 @@ __Pyx_RefNannySetupContext("depth_cb"); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); - /* "freenect.pyx":303 + /* "freenect.pyx":300 * * cdef void depth_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: * nbytes = 614400 # 480 * 640 * 2 # <<<<<<<<<<<<<< @@ -2753,75 +2761,75 @@ */ __pyx_v_nbytes = 614400; - /* "freenect.pyx":305 + /* "freenect.pyx":302 * nbytes = 614400 # 480 * 640 * 2 * cdef DevPtr dev_out * dev_out = DevPtr() # <<<<<<<<<<<<<< * dev_out._ptr = dev * if _depth_cb: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_dev_out)); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":306 + /* "freenect.pyx":303 * cdef DevPtr dev_out * dev_out = DevPtr() * dev_out._ptr = dev # <<<<<<<<<<<<<< * if _depth_cb: - * _depth_cb(*_depth_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) + * _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) */ __pyx_v_dev_out->_ptr = __pyx_v_dev; - /* "freenect.pyx":307 + /* "freenect.pyx":304 * dev_out = DevPtr() * dev_out._ptr = dev * if _depth_cb: # <<<<<<<<<<<<<< - * _depth_cb(*_depth_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) + * _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "freenect.pyx":308 + /* "freenect.pyx":305 * dev_out._ptr = dev * if _depth_cb: - * _depth_cb(*_depth_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) # <<<<<<<<<<<<<< + * _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) # <<<<<<<<<<<<<< * * cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyString_FromStringAndSize(((char *)__pyx_v_data), __pyx_v_nbytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyBytes_FromStringAndSize(((char *)__pyx_v_data) + 0, __pyx_v_nbytes - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(((PyObject *)__pyx_v_dev_out)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_dev_out)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dev_out)); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -2846,8 +2854,8 @@ #endif } -/* "freenect.pyx":310 - * _depth_cb(*_depth_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) +/* "freenect.pyx":307 + * _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) * * cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: # <<<<<<<<<<<<<< * nbytes = 921600 # 480 * 640 * 3 @@ -2869,7 +2877,7 @@ __Pyx_RefNannySetupContext("video_cb"); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); - /* "freenect.pyx":311 + /* "freenect.pyx":308 * * cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: * nbytes = 921600 # 480 * 640 * 3 # <<<<<<<<<<<<<< @@ -2878,75 +2886,75 @@ */ __pyx_v_nbytes = 921600; - /* "freenect.pyx":313 + /* "freenect.pyx":310 * nbytes = 921600 # 480 * 640 * 3 * cdef DevPtr dev_out * dev_out = DevPtr() # <<<<<<<<<<<<<< * dev_out._ptr = dev * if _video_cb: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_dev_out)); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":314 + /* "freenect.pyx":311 * cdef DevPtr dev_out * dev_out = DevPtr() * dev_out._ptr = dev # <<<<<<<<<<<<<< * if _video_cb: - * _video_cb(*_video_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) + * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) */ __pyx_v_dev_out->_ptr = __pyx_v_dev; - /* "freenect.pyx":315 + /* "freenect.pyx":312 * dev_out = DevPtr() * dev_out._ptr = dev * if _video_cb: # <<<<<<<<<<<<<< - * _video_cb(*_video_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) + * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "freenect.pyx":316 + /* "freenect.pyx":313 * dev_out._ptr = dev * if _video_cb: - * _video_cb(*_video_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) # <<<<<<<<<<<<<< - * + * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) # <<<<<<<<<<<<<< * + * def set_depth_callback(DevPtr dev, cb): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyString_FromStringAndSize(((char *)__pyx_v_data), __pyx_v_nbytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyBytes_FromStringAndSize(((char *)__pyx_v_data) + 0, __pyx_v_nbytes - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(((PyObject *)__pyx_v_dev_out)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_dev_out)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dev_out)); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -2971,45 +2979,28 @@ #endif } -/* "freenect.pyx":323 - * - * - * def runloop(depth=None, video=None, body=None, dev=None): # <<<<<<<<<<<<<< - * """Sets up the kinect and maintains a runloop +/* "freenect.pyx":315 + * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) * + * def set_depth_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _depth_cb + * if cb is not None: */ -static PyObject *__pyx_pf_8freenect_20runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_20runloop[] = "Sets up the kinect and maintains a runloop\n\n This is where most of the action happens. You can get the dev pointer from the callback\n and let this function do all of the setup for you. You may want to use threads to perform\n computation externally as the callbacks should really just be used for copying data.\n\n Args:\n depth: A function that takes (dev, depth, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for depth.\n video: A function that takes (dev, video, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for video.\n body: A function that takes (dev, ctx) and is called in the body of process_events\n dev: Optional freenect device context. If supplied, this function will use it instead\n of creating and destroying its own..\n "; -static PyMethodDef __pyx_mdef_8freenect_20runloop = {__Pyx_NAMESTR("runloop"), (PyCFunction)__pyx_pf_8freenect_20runloop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_20runloop)}; -static PyObject *__pyx_pf_8freenect_20runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_depth = 0; - PyObject *__pyx_v_video = 0; - PyObject *__pyx_v_body = 0; - PyObject *__pyx_v_dev = 0; - struct __pyx_obj_8freenect_DevPtr *__pyx_v_mdev; - struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx; - freenect_device *__pyx_v_devp; - freenect_context *__pyx_v_ctxp; +static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_20set_depth_callback = {__Pyx_NAMESTR("set_depth_callback"), (PyCFunction)__pyx_pf_8freenect_20set_depth_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; + PyObject *__pyx_v_cb = 0; PyObject *__pyx_r = NULL; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__depth,&__pyx_n_s__video,&__pyx_n_s__body,&__pyx_n_s__dev,0}; - __Pyx_RefNannySetupContext("runloop"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__cb,0}; + __Pyx_RefNannySetupContext("set_depth_callback"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)Py_None); + PyObject* values[2] = {0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; @@ -3017,103 +3008,364 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__depth); - if (value) { values[0] = value; kw_args--; } - } + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__video); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__body); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (value) { values[3] = value; kw_args--; } + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cb); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_depth_callback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "runloop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_depth_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - __pyx_v_depth = values[0]; - __pyx_v_video = values[1]; - __pyx_v_body = values[2]; - __pyx_v_dev = values[3]; + __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); + __pyx_v_cb = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_depth = ((PyObject *)Py_None); - __pyx_v_video = ((PyObject *)Py_None); - __pyx_v_body = ((PyObject *)Py_None); - __pyx_v_dev = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: __pyx_v_dev = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: __pyx_v_body = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: __pyx_v_video = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_depth = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } + __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_cb = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("runloop", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_depth_callback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.runloop"); + __Pyx_AddTraceback("freenect.set_depth_callback"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_mdev = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)Py_None); __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":340 - * """ - * global _depth_cb, _video_cb - * if depth: # <<<<<<<<<<<<<< - * _depth_cb = depth - * if video: + /* "freenect.pyx":317 + * def set_depth_callback(DevPtr dev, cb): + * global _depth_cb + * if cb is not None: # <<<<<<<<<<<<<< + * _depth_cb = cb + * freenect_set_depth_callback(dev._ptr, depth_cb) */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_depth); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__pyx_v_cb != Py_None); if (__pyx_t_1) { - /* "freenect.pyx":341 - * global _depth_cb, _video_cb - * if depth: - * _depth_cb = depth # <<<<<<<<<<<<<< - * if video: - * _video_cb = video + /* "freenect.pyx":318 + * global _depth_cb + * if cb is not None: + * _depth_cb = cb # <<<<<<<<<<<<<< + * freenect_set_depth_callback(dev._ptr, depth_cb) + * else: + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":319 + * if cb is not None: + * _depth_cb = cb + * freenect_set_depth_callback(dev._ptr, depth_cb) # <<<<<<<<<<<<<< + * else: + * _depth_cb = None */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_v_depth) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + freenect_set_depth_callback(__pyx_v_dev->_ptr, __pyx_f_8freenect_depth_cb); goto __pyx_L6; } - __pyx_L6:; + /*else*/ { - /* "freenect.pyx":342 - * if depth: - * _depth_cb = depth - * if video: # <<<<<<<<<<<<<< - * _video_cb = video - * cdef DevPtr mdev + /* "freenect.pyx":321 + * freenect_set_depth_callback(dev._ptr, depth_cb) + * else: + * _depth_cb = None # <<<<<<<<<<<<<< + * freenect_set_depth_callback(dev._ptr, NULL) + * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_video); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_1) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":343 - * _depth_cb = depth - * if video: + /* "freenect.pyx":322 + * else: + * _depth_cb = None + * freenect_set_depth_callback(dev._ptr, NULL) # <<<<<<<<<<<<<< + * + * def set_video_callback(DevPtr dev, cb): + */ + freenect_set_depth_callback(__pyx_v_dev->_ptr, NULL); + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("freenect.set_depth_callback"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":324 + * freenect_set_depth_callback(dev._ptr, NULL) + * + * def set_video_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _video_cb + * if cb is not None: + */ + +static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_21set_video_callback = {__Pyx_NAMESTR("set_video_callback"), (PyCFunction)__pyx_pf_8freenect_21set_video_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; + PyObject *__pyx_v_cb = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__cb,0}; + __Pyx_RefNannySetupContext("set_video_callback"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cb); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_video_callback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_video_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); + __pyx_v_cb = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_cb = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_video_callback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("freenect.set_video_callback"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":326 + * def set_video_callback(DevPtr dev, cb): + * global _video_cb + * if cb is not None: # <<<<<<<<<<<<<< + * _video_cb = cb + * freenect_set_video_callback(dev._ptr, video_cb) + */ + __pyx_t_1 = (__pyx_v_cb != Py_None); + if (__pyx_t_1) { + + /* "freenect.pyx":327 + * global _video_cb + * if cb is not None: + * _video_cb = cb # <<<<<<<<<<<<<< + * freenect_set_video_callback(dev._ptr, video_cb) + * else: + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":328 + * if cb is not None: + * _video_cb = cb + * freenect_set_video_callback(dev._ptr, video_cb) # <<<<<<<<<<<<<< + * else: + * _video_cb = None + */ + freenect_set_video_callback(__pyx_v_dev->_ptr, __pyx_f_8freenect_video_cb); + goto __pyx_L6; + } + /*else*/ { + + /* "freenect.pyx":330 + * freenect_set_video_callback(dev._ptr, video_cb) + * else: + * _video_cb = None # <<<<<<<<<<<<<< + * freenect_set_video_callback(dev._ptr, NULL) + * + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":331 + * else: + * _video_cb = None + * freenect_set_video_callback(dev._ptr, NULL) # <<<<<<<<<<<<<< + * + * + */ + freenect_set_video_callback(__pyx_v_dev->_ptr, NULL); + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("freenect.set_video_callback"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":338 + * + * + * def runloop(depth=None, video=None, body=None, dev=None): # <<<<<<<<<<<<<< + * """Sets up the kinect and maintains a runloop + * + */ + +static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_22runloop[] = "Sets up the kinect and maintains a runloop\n\n This is where most of the action happens. You can get the dev pointer from the callback\n and let this function do all of the setup for you. You may want to use threads to perform\n computation externally as the callbacks should really just be used for copying data.\n\n Args:\n depth: A function that takes (dev, depth, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for depth.\n video: A function that takes (dev, video, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for video.\n body: A function that takes (dev, ctx) and is called in the body of process_events\n dev: Optional freenect device context. If supplied, this function will use it instead\n of creating and destroying its own..\n "; +static PyMethodDef __pyx_mdef_8freenect_22runloop = {__Pyx_NAMESTR("runloop"), (PyCFunction)__pyx_pf_8freenect_22runloop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_22runloop)}; +static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_depth = 0; + PyObject *__pyx_v_video = 0; + PyObject *__pyx_v_body = 0; + PyObject *__pyx_v_dev = 0; + struct __pyx_obj_8freenect_DevPtr *__pyx_v_mdev; + struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx; + freenect_device *__pyx_v_devp; + freenect_context *__pyx_v_ctxp; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__depth,&__pyx_n_s__video,&__pyx_n_s__body,&__pyx_n_s__dev,0}; + __Pyx_RefNannySetupContext("runloop"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__depth); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__video); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__body); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "runloop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_depth = values[0]; + __pyx_v_video = values[1]; + __pyx_v_body = values[2]; + __pyx_v_dev = values[3]; + } else { + __pyx_v_depth = ((PyObject *)Py_None); + __pyx_v_video = ((PyObject *)Py_None); + __pyx_v_body = ((PyObject *)Py_None); + __pyx_v_dev = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_dev = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_body = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_video = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_depth = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("runloop", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("freenect.runloop"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_mdev = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)Py_None); __Pyx_INCREF(Py_None); + + /* "freenect.pyx":355 + * """ + * global _depth_cb, _video_cb + * if depth: # <<<<<<<<<<<<<< + * _depth_cb = depth + * if video: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_depth); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "freenect.pyx":356 + * global _depth_cb, _video_cb + * if depth: + * _depth_cb = depth # <<<<<<<<<<<<<< + * if video: + * _video_cb = video + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_v_depth) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "freenect.pyx":357 + * if depth: + * _depth_cb = depth + * if video: # <<<<<<<<<<<<<< + * _video_cb = video + * cdef DevPtr mdev + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_video); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "freenect.pyx":358 + * _depth_cb = depth + * if video: * _video_cb = video # <<<<<<<<<<<<<< * cdef DevPtr mdev * cdef CtxPtr ctx */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_v_video) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_v_video) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "freenect.pyx":348 + /* "freenect.pyx":363 * cdef freenect_device* devp * cdef freenect_context* ctxp * if dev is None: # <<<<<<<<<<<<<< @@ -3123,46 +3375,46 @@ __pyx_t_1 = (__pyx_v_dev == Py_None); if (__pyx_t_1) { - /* "freenect.pyx":349 + /* "freenect.pyx":364 * cdef freenect_context* ctxp * if dev is None: * ctx = init() # <<<<<<<<<<<<<< * if not ctx: * error_open_device() */ - __pyx_t_2 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8freenect_CtxPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8freenect_CtxPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_ctx)); __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":350 + /* "freenect.pyx":365 * if dev is None: * ctx = init() * if not ctx: # <<<<<<<<<<<<<< * error_open_device() * return */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ctx)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ctx)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = (!__pyx_t_1); if (__pyx_t_3) { - /* "freenect.pyx":351 + /* "freenect.pyx":366 * ctx = init() * if not ctx: * error_open_device() # <<<<<<<<<<<<<< * return * mdev = open_device(ctx, 0) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "freenect.pyx":352 + /* "freenect.pyx":367 * if not ctx: * error_open_device() * return # <<<<<<<<<<<<<< @@ -3176,46 +3428,46 @@ } __pyx_L9:; - /* "freenect.pyx":353 + /* "freenect.pyx":368 * error_open_device() * return * mdev = open_device(ctx, 0) # <<<<<<<<<<<<<< * if not mdev: * error_open_device() */ - __pyx_t_4 = __pyx_f_8freenect_open_device(__pyx_v_ctx, 0, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_f_8freenect_open_device(__pyx_v_ctx, 0, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_mdev)); __pyx_v_mdev = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_4); __pyx_t_4 = 0; - /* "freenect.pyx":354 + /* "freenect.pyx":369 * return * mdev = open_device(ctx, 0) * if not mdev: # <<<<<<<<<<<<<< * error_open_device() * return */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_mdev)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_mdev)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (!__pyx_t_3); if (__pyx_t_1) { - /* "freenect.pyx":355 + /* "freenect.pyx":370 * mdev = open_device(ctx, 0) * if not mdev: * error_open_device() # <<<<<<<<<<<<<< * return * else: */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":356 + /* "freenect.pyx":371 * if not mdev: * error_open_device() * return # <<<<<<<<<<<<<< @@ -3232,21 +3484,21 @@ } /*else*/ { - /* "freenect.pyx":358 + /* "freenect.pyx":373 * return * else: * mdev = dev # <<<<<<<<<<<<<< * devp = mdev._ptr * ctxp = mdev.ctx._ptr */ - if (!(likely(((__pyx_v_dev) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dev, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_dev) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dev, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_dev); __Pyx_DECREF(((PyObject *)__pyx_v_mdev)); __pyx_v_mdev = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev); } __pyx_L8:; - /* "freenect.pyx":359 + /* "freenect.pyx":374 * else: * mdev = dev * devp = mdev._ptr # <<<<<<<<<<<<<< @@ -3255,7 +3507,7 @@ */ __pyx_v_devp = __pyx_v_mdev->_ptr; - /* "freenect.pyx":360 + /* "freenect.pyx":375 * mdev = dev * devp = mdev._ptr * ctxp = mdev.ctx._ptr # <<<<<<<<<<<<<< @@ -3264,7 +3516,7 @@ */ __pyx_v_ctxp = __pyx_v_mdev->ctx->_ptr; - /* "freenect.pyx":361 + /* "freenect.pyx":376 * devp = mdev._ptr * ctxp = mdev.ctx._ptr * if depth is not None: # <<<<<<<<<<<<<< @@ -3274,7 +3526,7 @@ __pyx_t_1 = (__pyx_v_depth != Py_None); if (__pyx_t_1) { - /* "freenect.pyx":362 + /* "freenect.pyx":377 * ctxp = mdev.ctx._ptr * if depth is not None: * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) # <<<<<<<<<<<<<< @@ -3283,7 +3535,7 @@ */ freenect_set_depth_mode(__pyx_v_devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)); - /* "freenect.pyx":363 + /* "freenect.pyx":378 * if depth is not None: * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) * freenect_start_depth(devp) # <<<<<<<<<<<<<< @@ -3292,7 +3544,7 @@ */ freenect_start_depth(__pyx_v_devp); - /* "freenect.pyx":364 + /* "freenect.pyx":379 * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) * freenect_start_depth(devp) * freenect_set_depth_callback(devp, depth_cb) # <<<<<<<<<<<<<< @@ -3304,7 +3556,7 @@ } __pyx_L11:; - /* "freenect.pyx":365 + /* "freenect.pyx":380 * freenect_start_depth(devp) * freenect_set_depth_callback(devp, depth_cb) * if video is not None: # <<<<<<<<<<<<<< @@ -3314,7 +3566,7 @@ __pyx_t_1 = (__pyx_v_video != Py_None); if (__pyx_t_1) { - /* "freenect.pyx":366 + /* "freenect.pyx":381 * freenect_set_depth_callback(devp, depth_cb) * if video is not None: * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) # <<<<<<<<<<<<<< @@ -3323,7 +3575,7 @@ */ freenect_set_video_mode(__pyx_v_devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)); - /* "freenect.pyx":367 + /* "freenect.pyx":382 * if video is not None: * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) * freenect_start_video(devp) # <<<<<<<<<<<<<< @@ -3332,7 +3584,7 @@ */ freenect_start_video(__pyx_v_devp); - /* "freenect.pyx":368 + /* "freenect.pyx":383 * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) * freenect_start_video(devp) * freenect_set_video_callback(devp, video_cb) # <<<<<<<<<<<<<< @@ -3344,9 +3596,303 @@ } __pyx_L12:; - /* "freenect.pyx":369 - * freenect_start_video(devp) - * freenect_set_video_callback(devp, video_cb) + /* "freenect.pyx":384 + * freenect_start_video(devp) + * freenect_set_video_callback(devp, video_cb) + * try: # <<<<<<<<<<<<<< + * while True: + * with nogil: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "freenect.pyx":385 + * freenect_set_video_callback(devp, video_cb) + * try: + * while True: # <<<<<<<<<<<<<< + * with nogil: + * if freenect_process_events(ctxp) < 0: + */ + while (1) { + if (!1) break; + + /* "freenect.pyx":386 + * try: + * while True: + * with nogil: # <<<<<<<<<<<<<< + * if freenect_process_events(ctxp) < 0: + * break + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + #endif + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "freenect.pyx":387 + * while True: + * with nogil: + * if freenect_process_events(ctxp) < 0: # <<<<<<<<<<<<<< + * break + * if body: + */ + __pyx_t_1 = (freenect_process_events(__pyx_v_ctxp) < 0); + if (__pyx_t_1) { + + /* "freenect.pyx":388 + * with nogil: + * if freenect_process_events(ctxp) < 0: + * break # <<<<<<<<<<<<<< + * if body: + * body(mdev, mdev.ctx) + */ + goto __pyx_L24; + goto __pyx_L28; + } + __pyx_L28:; + } + + /* "freenect.pyx":386 + * try: + * while True: + * with nogil: # <<<<<<<<<<<<<< + * if freenect_process_events(ctxp) < 0: + * break + */ + /*finally:*/ { + int __pyx_why; + __pyx_why = 0; goto __pyx_L27; + __pyx_L24: __pyx_why = 2; goto __pyx_L27; + __pyx_L27:; + Py_BLOCK_THREADS + switch (__pyx_why) { + case 2: goto __pyx_L22_break; + } + } + } + + /* "freenect.pyx":389 + * if freenect_process_events(ctxp) < 0: + * break + * if body: # <<<<<<<<<<<<<< + * body(mdev, mdev.ctx) + * except Kill: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + if (__pyx_t_1) { + + /* "freenect.pyx":390 + * break + * if body: + * body(mdev, mdev.ctx) # <<<<<<<<<<<<<< + * except Kill: + * pass + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_mdev)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mdev)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_mdev)); + __Pyx_INCREF(((PyObject *)__pyx_v_mdev->ctx)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_mdev->ctx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_mdev->ctx)); + __pyx_t_4 = PyObject_Call(__pyx_v_body, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L29; + } + __pyx_L29:; + } + __pyx_L22_break:; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L20_try_end; + __pyx_L13_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "freenect.pyx":391 + * if body: + * body(mdev, mdev.ctx) + * except Kill: # <<<<<<<<<<<<<< + * pass + * freenect_stop_depth(devp) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Kill); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyErr_ExceptionMatches(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + PyErr_Restore(0,0,0); + goto __pyx_L14_exception_handled; + } + __pyx_L15_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L14_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L20_try_end:; + } + + /* "freenect.pyx":393 + * except Kill: + * pass + * freenect_stop_depth(devp) # <<<<<<<<<<<<<< + * freenect_stop_video(devp) + * if dev is None: + */ + freenect_stop_depth(__pyx_v_devp); + + /* "freenect.pyx":394 + * pass + * freenect_stop_depth(devp) + * freenect_stop_video(devp) # <<<<<<<<<<<<<< + * if dev is None: + * freenect_close_device(devp) + */ + freenect_stop_video(__pyx_v_devp); + + /* "freenect.pyx":395 + * freenect_stop_depth(devp) + * freenect_stop_video(devp) + * if dev is None: # <<<<<<<<<<<<<< + * freenect_close_device(devp) + * freenect_shutdown(ctxp) + */ + __pyx_t_1 = (__pyx_v_dev == Py_None); + if (__pyx_t_1) { + + /* "freenect.pyx":396 + * freenect_stop_video(devp) + * if dev is None: + * freenect_close_device(devp) # <<<<<<<<<<<<<< + * freenect_shutdown(ctxp) + * + */ + freenect_close_device(__pyx_v_devp); + + /* "freenect.pyx":397 + * if dev is None: + * freenect_close_device(devp) + * freenect_shutdown(ctxp) # <<<<<<<<<<<<<< + * + * def base_runloop(CtxPtr ctx, body=None): + */ + freenect_shutdown(__pyx_v_ctxp); + goto __pyx_L30; + } + __pyx_L30:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("freenect.runloop"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_mdev); + __Pyx_DECREF((PyObject *)__pyx_v_ctx); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":399 + * freenect_shutdown(ctxp) + * + * def base_runloop(CtxPtr ctx, body=None): # <<<<<<<<<<<<<< + * """Starts a runloop + * + */ + +static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_23base_runloop[] = "Starts a runloop\n\n This function can be used instead of runloop() to allow the Python code to\n perform all setup steps independently. This simply calls process_events in\n a loop, optionally calling a body function in between. Raise the Kill\n exception to break out of the runloop.\n\n Args:\n ctx: Freenect library context\n body: A function that takes (ctx) and is called in the body of process_events\n "; +static PyMethodDef __pyx_mdef_8freenect_23base_runloop = {__Pyx_NAMESTR("base_runloop"), (PyCFunction)__pyx_pf_8freenect_23base_runloop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_23base_runloop)}; +static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx = 0; + PyObject *__pyx_v_body = 0; + freenect_context *__pyx_v_ctxp; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx,&__pyx_n_s__body,0}; + __Pyx_RefNannySetupContext("base_runloop"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__body); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "base_runloop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)values[0]); + __pyx_v_body = values[1]; + } else { + __pyx_v_body = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_body = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("base_runloop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("freenect.base_runloop"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":412 + * """ + * cdef freenect_context* ctxp + * ctxp = ctx._ptr # <<<<<<<<<<<<<< + * try: + * while True: + */ + __pyx_v_ctxp = __pyx_v_ctx->_ptr; + + /* "freenect.pyx":413 + * cdef freenect_context* ctxp + * ctxp = ctx._ptr * try: # <<<<<<<<<<<<<< * while True: * with nogil: @@ -3359,8 +3905,8 @@ __Pyx_XGOTREF(__pyx_save_exc_tb); /*try:*/ { - /* "freenect.pyx":370 - * freenect_set_video_callback(devp, video_cb) + /* "freenect.pyx":414 + * ctxp = ctx._ptr * try: * while True: # <<<<<<<<<<<<<< * with nogil: @@ -3369,7 +3915,7 @@ while (1) { if (!1) break; - /* "freenect.pyx":371 + /* "freenect.pyx":415 * try: * while True: * with nogil: # <<<<<<<<<<<<<< @@ -3383,7 +3929,7 @@ Py_UNBLOCK_THREADS /*try:*/ { - /* "freenect.pyx":372 + /* "freenect.pyx":416 * while True: * with nogil: * if freenect_process_events(ctxp) < 0: # <<<<<<<<<<<<<< @@ -3393,20 +3939,20 @@ __pyx_t_1 = (freenect_process_events(__pyx_v_ctxp) < 0); if (__pyx_t_1) { - /* "freenect.pyx":373 + /* "freenect.pyx":417 * with nogil: * if freenect_process_events(ctxp) < 0: * break # <<<<<<<<<<<<<< * if body: - * body(mdev, mdev.ctx) + * body(ctx) */ - goto __pyx_L24; - goto __pyx_L28; + goto __pyx_L17; + goto __pyx_L21; } - __pyx_L28:; + __pyx_L21:; } - /* "freenect.pyx":371 + /* "freenect.pyx":415 * try: * while True: * with nogil: # <<<<<<<<<<<<<< @@ -3415,164 +3961,110 @@ */ /*finally:*/ { int __pyx_why; - __pyx_why = 0; goto __pyx_L27; - __pyx_L24: __pyx_why = 2; goto __pyx_L27; - __pyx_L27:; + __pyx_why = 0; goto __pyx_L20; + __pyx_L17: __pyx_why = 2; goto __pyx_L20; + __pyx_L20:; Py_BLOCK_THREADS switch (__pyx_why) { - case 2: goto __pyx_L22_break; + case 2: goto __pyx_L15_break; } } } - /* "freenect.pyx":374 + /* "freenect.pyx":418 * if freenect_process_events(ctxp) < 0: * break * if body: # <<<<<<<<<<<<<< - * body(mdev, mdev.ctx) + * body(ctx) * except Kill: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L6_error;} if (__pyx_t_1) { - /* "freenect.pyx":375 + /* "freenect.pyx":419 * break * if body: - * body(mdev, mdev.ctx) # <<<<<<<<<<<<<< + * body(ctx) # <<<<<<<<<<<<<< * except Kill: * pass */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_mdev)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mdev)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mdev)); - __Pyx_INCREF(((PyObject *)__pyx_v_mdev->ctx)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_mdev->ctx)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mdev->ctx)); - __pyx_t_4 = PyObject_Call(__pyx_v_body, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L13_error;} - __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_ctx)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ctx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ctx)); + __pyx_t_3 = PyObject_Call(__pyx_v_body, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L29; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22; } - __pyx_L29:; + __pyx_L22:; } - __pyx_L22_break:; + __pyx_L15_break:; } __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L20_try_end; - __pyx_L13_error:; + goto __pyx_L13_try_end; + __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":376 + /* "freenect.pyx":420 * if body: - * body(mdev, mdev.ctx) + * body(ctx) * except Kill: # <<<<<<<<<<<<<< * pass - * freenect_stop_depth(devp) + * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Kill); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyErr_ExceptionMatches(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__Kill); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { PyErr_Restore(0,0,0); - goto __pyx_L14_exception_handled; + goto __pyx_L7_exception_handled; } - __pyx_L15_except_error:; + __pyx_L8_except_error:; __Pyx_XGIVEREF(__pyx_save_exc_type); __Pyx_XGIVEREF(__pyx_save_exc_value); __Pyx_XGIVEREF(__pyx_save_exc_tb); __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); goto __pyx_L1_error; - __pyx_L14_exception_handled:; + __pyx_L7_exception_handled:; __Pyx_XGIVEREF(__pyx_save_exc_type); __Pyx_XGIVEREF(__pyx_save_exc_value); __Pyx_XGIVEREF(__pyx_save_exc_tb); __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L20_try_end:; - } - - /* "freenect.pyx":378 - * except Kill: - * pass - * freenect_stop_depth(devp) # <<<<<<<<<<<<<< - * freenect_stop_video(devp) - * if dev is None: - */ - freenect_stop_depth(__pyx_v_devp); - - /* "freenect.pyx":379 - * pass - * freenect_stop_depth(devp) - * freenect_stop_video(devp) # <<<<<<<<<<<<<< - * if dev is None: - * freenect_close_device(devp) - */ - freenect_stop_video(__pyx_v_devp); - - /* "freenect.pyx":380 - * freenect_stop_depth(devp) - * freenect_stop_video(devp) - * if dev is None: # <<<<<<<<<<<<<< - * freenect_close_device(devp) - * freenect_shutdown(ctxp) - */ - __pyx_t_1 = (__pyx_v_dev == Py_None); - if (__pyx_t_1) { - - /* "freenect.pyx":381 - * freenect_stop_video(devp) - * if dev is None: - * freenect_close_device(devp) # <<<<<<<<<<<<<< - * freenect_shutdown(ctxp) - * - */ - freenect_close_device(__pyx_v_devp); - - /* "freenect.pyx":382 - * if dev is None: - * freenect_close_device(devp) - * freenect_shutdown(ctxp) # <<<<<<<<<<<<<< - * - * def _depth_cb_np(dev, string, timestamp): - */ - freenect_shutdown(__pyx_v_ctxp); - goto __pyx_L30; + __pyx_L13_try_end:; } - __pyx_L30:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("freenect.runloop"); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("freenect.base_runloop"); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_mdev); - __Pyx_DECREF((PyObject *)__pyx_v_ctx); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":384 - * freenect_shutdown(ctxp) +/* "freenect.pyx":423 + * pass * * def _depth_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< * """Converts the raw depth data into a numpy array for your function * */ -static PyObject *__pyx_pf_8freenect_21_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_21_depth_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the depth data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; -static PyMethodDef __pyx_mdef_8freenect_21_depth_cb_np = {__Pyx_NAMESTR("_depth_cb_np"), (PyCFunction)__pyx_pf_8freenect_21_depth_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_21_depth_cb_np)}; -static PyObject *__pyx_pf_8freenect_21_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_8freenect_24_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_24_depth_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the depth data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; +static PyMethodDef __pyx_mdef_8freenect_24_depth_cb_np = {__Pyx_NAMESTR("_depth_cb_np"), (PyCFunction)__pyx_pf_8freenect_24_depth_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_24_depth_cb_np)}; +static PyObject *__pyx_pf_8freenect_24_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_dev = 0; PyObject *__pyx_v_string = 0; PyObject *__pyx_v_timestamp = 0; @@ -3605,17 +4097,17 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timestamp); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_depth_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_depth_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_dev = values[0]; __pyx_v_string = values[1]; @@ -3629,7 +4121,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect._depth_cb_np"); __Pyx_RefNannyFinishContext(); @@ -3637,33 +4129,33 @@ __pyx_L4_argument_unpacking_done:; __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "freenect.pyx":395 + /* "freenect.pyx":434 * (dev, data, timestamp) where data is a 2D numpy array * """ * data = np.fromstring(string, dtype=np.uint16) # <<<<<<<<<<<<<< * data.resize((480, 640)) * return dev, data, timestamp */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_string); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_string); __Pyx_GIVEREF(__pyx_v_string); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -3672,21 +4164,21 @@ __pyx_v_data = __pyx_t_5; __pyx_t_5 = 0; - /* "freenect.pyx":396 + /* "freenect.pyx":435 * """ * data = np.fromstring(string, dtype=np.uint16) * data.resize((480, 640)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":397 + /* "freenect.pyx":436 * data = np.fromstring(string, dtype=np.uint16) * data.resize((480, 640)) * return dev, data, timestamp # <<<<<<<<<<<<<< @@ -3694,7 +4186,7 @@ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_dev); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dev); @@ -3726,7 +4218,7 @@ return __pyx_r; } -/* "freenect.pyx":400 +/* "freenect.pyx":439 * * * def _video_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< @@ -3734,10 +4226,10 @@ * */ -static PyObject *__pyx_pf_8freenect_22_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_22_video_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the video data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; -static PyMethodDef __pyx_mdef_8freenect_22_video_cb_np = {__Pyx_NAMESTR("_video_cb_np"), (PyCFunction)__pyx_pf_8freenect_22_video_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_22_video_cb_np)}; -static PyObject *__pyx_pf_8freenect_22_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_8freenect_25_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_25_video_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the video data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; +static PyMethodDef __pyx_mdef_8freenect_25_video_cb_np = {__Pyx_NAMESTR("_video_cb_np"), (PyCFunction)__pyx_pf_8freenect_25_video_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_25_video_cb_np)}; +static PyObject *__pyx_pf_8freenect_25_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_dev = 0; PyObject *__pyx_v_string = 0; PyObject *__pyx_v_timestamp = 0; @@ -3770,17 +4262,17 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timestamp); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_video_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_video_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_dev = values[0]; __pyx_v_string = values[1]; @@ -3794,7 +4286,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect._video_cb_np"); __Pyx_RefNannyFinishContext(); @@ -3802,33 +4294,33 @@ __pyx_L4_argument_unpacking_done:; __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "freenect.pyx":411 + /* "freenect.pyx":450 * (dev, data, timestamp) where data is a 2D numpy array * """ * data = np.fromstring(string, dtype=np.uint8) # <<<<<<<<<<<<<< * data.resize((480, 640, 3)) * return dev, data, timestamp */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_string); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_string); __Pyx_GIVEREF(__pyx_v_string); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -3837,21 +4329,21 @@ __pyx_v_data = __pyx_t_5; __pyx_t_5 = 0; - /* "freenect.pyx":412 + /* "freenect.pyx":451 * """ * data = np.fromstring(string, dtype=np.uint8) * data.resize((480, 640, 3)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":413 + /* "freenect.pyx":452 * data = np.fromstring(string, dtype=np.uint8) * data.resize((480, 640, 3)) * return dev, data, timestamp # <<<<<<<<<<<<<< @@ -3859,7 +4351,7 @@ * import_array() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_dev); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dev); @@ -3891,7 +4383,7 @@ return __pyx_r; } -/* "freenect.pyx":417 +/* "freenect.pyx":456 * import_array() * * def sync_get_depth(index=0, format=DEPTH_11BIT): # <<<<<<<<<<<<<< @@ -3899,16 +4391,18 @@ * */ -static PyObject *__pyx_pf_8freenect_23sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_23sync_get_depth[] = "Get the next available depth frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: DEPTH_11BIT)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(640,480) dtype:np.uint16\n timestamp: int representing the time\n "; -static PyMethodDef __pyx_mdef_8freenect_23sync_get_depth = {__Pyx_NAMESTR("sync_get_depth"), (PyCFunction)__pyx_pf_8freenect_23sync_get_depth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_23sync_get_depth)}; -static PyObject *__pyx_pf_8freenect_23sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_8freenect_26sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_26sync_get_depth[] = "Get the next available depth frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: DEPTH_11BIT)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(640,480) dtype:np.uint16\n timestamp: int representing the time\n "; +static PyMethodDef __pyx_mdef_8freenect_26sync_get_depth = {__Pyx_NAMESTR("sync_get_depth"), (PyCFunction)__pyx_pf_8freenect_26sync_get_depth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_26sync_get_depth)}; +static PyObject *__pyx_pf_8freenect_26sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_index = 0; PyObject *__pyx_v_format = 0; void *__pyx_v_data; - unsigned int __pyx_v_timestamp; + uint32_t __pyx_v_timestamp; npy_intp __pyx_v_dims[2]; int __pyx_v_out; + int __pyx_v__index; + freenect_depth_format __pyx_v__format; PyObject *__pyx_r = NULL; int __pyx_t_1; freenect_depth_format __pyx_t_2; @@ -3945,7 +4439,7 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sync_get_depth") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sync_get_depth") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_index = values[0]; __pyx_v_format = values[1]; @@ -3961,18 +4455,38 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sync_get_depth", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sync_get_depth", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect.sync_get_depth"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - /* "freenect.pyx":433 + /* "freenect.pyx":472 * cdef npc.npy_intp dims[2] * cdef int out + * cdef int _index = index # <<<<<<<<<<<<<< + * cdef freenect_depth_format _format = format + * with nogil: + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__index = __pyx_t_1; + + /* "freenect.pyx":473 + * cdef int out + * cdef int _index = index + * cdef freenect_depth_format _format = format # <<<<<<<<<<<<<< + * with nogil: + * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) + */ + __pyx_t_2 = ((freenect_depth_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__format = __pyx_t_2; + + /* "freenect.pyx":474 + * cdef int _index = index + * cdef freenect_depth_format _format = format * with nogil: # <<<<<<<<<<<<<< - * out = freenect_sync_get_depth(&data, ×tamp, index, format) + * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) * if out: */ { @@ -3982,61 +4496,52 @@ Py_UNBLOCK_THREADS /*try:*/ { - /* "freenect.pyx":434 - * cdef int out + /* "freenect.pyx":475 + * cdef freenect_depth_format _format = format * with nogil: - * out = freenect_sync_get_depth(&data, ×tamp, index, format) # <<<<<<<<<<<<<< + * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) # <<<<<<<<<<<<<< * if out: * error_open_device() */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L7;} - __pyx_t_2 = ((freenect_depth_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L7;} - __pyx_v_out = freenect_sync_get_depth((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_t_1, __pyx_t_2); + __pyx_v_out = freenect_sync_get_depth((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_v__index, __pyx_v__format); } - /* "freenect.pyx":433 - * cdef npc.npy_intp dims[2] - * cdef int out + /* "freenect.pyx":474 + * cdef int _index = index + * cdef freenect_depth_format _format = format * with nogil: # <<<<<<<<<<<<<< - * out = freenect_sync_get_depth(&data, ×tamp, index, format) + * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) * if out: */ /*finally:*/ { - int __pyx_why; - __pyx_why = 0; goto __pyx_L8; - __pyx_L7: __pyx_why = 4; goto __pyx_L8; - __pyx_L8:; Py_BLOCK_THREADS - switch (__pyx_why) { - case 4: goto __pyx_L1_error; - } } } - /* "freenect.pyx":435 + /* "freenect.pyx":476 * with nogil: - * out = freenect_sync_get_depth(&data, ×tamp, index, format) + * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) * if out: # <<<<<<<<<<<<<< * error_open_device() * return */ if (__pyx_v_out) { - /* "freenect.pyx":436 - * out = freenect_sync_get_depth(&data, ×tamp, index, format) + /* "freenect.pyx":477 + * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) * if out: * error_open_device() # <<<<<<<<<<<<<< * return * if format == DEPTH_11BIT: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "freenect.pyx":437 + /* "freenect.pyx":478 * if out: * error_open_device() * return # <<<<<<<<<<<<<< @@ -4046,27 +4551,27 @@ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L10; + goto __pyx_L9; } - __pyx_L10:; + __pyx_L9:; - /* "freenect.pyx":438 + /* "freenect.pyx":479 * error_open_device() * return * if format == DEPTH_11BIT: # <<<<<<<<<<<<<< * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT16, data), timestamp */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { - /* "freenect.pyx":439 + /* "freenect.pyx":480 * return * if format == DEPTH_11BIT: * dims[0], dims[1] = 480, 640 # <<<<<<<<<<<<<< @@ -4078,7 +4583,7 @@ (__pyx_v_dims[0]) = __pyx_t_6; (__pyx_v_dims[1]) = __pyx_t_7; - /* "freenect.pyx":440 + /* "freenect.pyx":481 * if format == DEPTH_11BIT: * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT16, data), timestamp # <<<<<<<<<<<<<< @@ -4086,11 +4591,11 @@ * raise TypeError('Conversion not implemented for type [%d]' % (format)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT16, __pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT16, __pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_timestamp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -4101,32 +4606,32 @@ __pyx_r = ((PyObject *)__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L0; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "freenect.pyx":442 + /* "freenect.pyx":483 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT16, data), timestamp * else: * raise TypeError('Conversion not implemented for type [%d]' % (format)) # <<<<<<<<<<<<<< * * */ - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L10:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -4142,7 +4647,7 @@ return __pyx_r; } -/* "freenect.pyx":445 +/* "freenect.pyx":486 * * * def sync_get_video(index=0, format=VIDEO_RGB): # <<<<<<<<<<<<<< @@ -4150,16 +4655,18 @@ * */ -static PyObject *__pyx_pf_8freenect_24sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_24sync_get_video[] = "Get the next available rgb frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: VIDEO_RGB)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(480, 640, 3) dtype:np.uint8\n timestamp: int representing the time\n "; -static PyMethodDef __pyx_mdef_8freenect_24sync_get_video = {__Pyx_NAMESTR("sync_get_video"), (PyCFunction)__pyx_pf_8freenect_24sync_get_video, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_24sync_get_video)}; -static PyObject *__pyx_pf_8freenect_24sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_27sync_get_video[] = "Get the next available rgb frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: VIDEO_RGB)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(480, 640, 3) dtype:np.uint8\n timestamp: int representing the time\n "; +static PyMethodDef __pyx_mdef_8freenect_27sync_get_video = {__Pyx_NAMESTR("sync_get_video"), (PyCFunction)__pyx_pf_8freenect_27sync_get_video, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_27sync_get_video)}; +static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_index = 0; PyObject *__pyx_v_format = 0; void *__pyx_v_data; - unsigned int __pyx_v_timestamp; + uint32_t __pyx_v_timestamp; npy_intp __pyx_v_dims[3]; int __pyx_v_out; + int __pyx_v__index; + freenect_video_format __pyx_v__format; PyObject *__pyx_r = NULL; int __pyx_t_1; freenect_video_format __pyx_t_2; @@ -4197,7 +4704,7 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sync_get_video") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sync_get_video") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_index = values[0]; __pyx_v_format = values[1]; @@ -4213,18 +4720,38 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sync_get_video", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sync_get_video", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("freenect.sync_get_video"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - /* "freenect.pyx":461 + /* "freenect.pyx":502 * cdef npc.npy_intp dims[3] * cdef int out + * cdef int _index = index # <<<<<<<<<<<<<< + * cdef freenect_video_format _format = format + * with nogil: + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__index = __pyx_t_1; + + /* "freenect.pyx":503 + * cdef int out + * cdef int _index = index + * cdef freenect_video_format _format = format # <<<<<<<<<<<<<< + * with nogil: + * out = freenect_sync_get_video(&data, ×tamp, _index, _format) + */ + __pyx_t_2 = ((freenect_video_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__format = __pyx_t_2; + + /* "freenect.pyx":504 + * cdef int _index = index + * cdef freenect_video_format _format = format * with nogil: # <<<<<<<<<<<<<< - * out = freenect_sync_get_video(&data, ×tamp, index, format) + * out = freenect_sync_get_video(&data, ×tamp, _index, _format) * if out: */ { @@ -4234,61 +4761,52 @@ Py_UNBLOCK_THREADS /*try:*/ { - /* "freenect.pyx":462 - * cdef int out + /* "freenect.pyx":505 + * cdef freenect_video_format _format = format * with nogil: - * out = freenect_sync_get_video(&data, ×tamp, index, format) # <<<<<<<<<<<<<< + * out = freenect_sync_get_video(&data, ×tamp, _index, _format) # <<<<<<<<<<<<<< * if out: * error_open_device() */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L7;} - __pyx_t_2 = ((freenect_video_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L7;} - __pyx_v_out = freenect_sync_get_video((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_t_1, __pyx_t_2); + __pyx_v_out = freenect_sync_get_video((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_v__index, __pyx_v__format); } - /* "freenect.pyx":461 - * cdef npc.npy_intp dims[3] - * cdef int out + /* "freenect.pyx":504 + * cdef int _index = index + * cdef freenect_video_format _format = format * with nogil: # <<<<<<<<<<<<<< - * out = freenect_sync_get_video(&data, ×tamp, index, format) + * out = freenect_sync_get_video(&data, ×tamp, _index, _format) * if out: */ /*finally:*/ { - int __pyx_why; - __pyx_why = 0; goto __pyx_L8; - __pyx_L7: __pyx_why = 4; goto __pyx_L8; - __pyx_L8:; Py_BLOCK_THREADS - switch (__pyx_why) { - case 4: goto __pyx_L1_error; - } } } - /* "freenect.pyx":463 + /* "freenect.pyx":506 * with nogil: - * out = freenect_sync_get_video(&data, ×tamp, index, format) + * out = freenect_sync_get_video(&data, ×tamp, _index, _format) * if out: # <<<<<<<<<<<<<< * error_open_device() * return */ if (__pyx_v_out) { - /* "freenect.pyx":464 - * out = freenect_sync_get_video(&data, ×tamp, index, format) + /* "freenect.pyx":507 + * out = freenect_sync_get_video(&data, ×tamp, _index, _format) * if out: * error_open_device() # <<<<<<<<<<<<<< * return * if format == VIDEO_RGB: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "freenect.pyx":465 + /* "freenect.pyx":508 * if out: * error_open_device() * return # <<<<<<<<<<<<<< @@ -4298,27 +4816,27 @@ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L10; + goto __pyx_L9; } - __pyx_L10:; + __pyx_L9:; - /* "freenect.pyx":466 + /* "freenect.pyx":509 * error_open_device() * return * if format == VIDEO_RGB: # <<<<<<<<<<<<<< * dims[0], dims[1], dims[2] = 480, 640, 3 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { - /* "freenect.pyx":467 + /* "freenect.pyx":510 * return * if format == VIDEO_RGB: * dims[0], dims[1], dims[2] = 480, 640, 3 # <<<<<<<<<<<<<< @@ -4332,7 +4850,7 @@ (__pyx_v_dims[1]) = __pyx_t_7; (__pyx_v_dims[2]) = __pyx_t_8; - /* "freenect.pyx":468 + /* "freenect.pyx":511 * if format == VIDEO_RGB: * dims[0], dims[1], dims[2] = 480, 640, 3 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp # <<<<<<<<<<<<<< @@ -4340,11 +4858,11 @@ * dims[0], dims[1] = 480, 640 */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyArray_SimpleNewFromData(3, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyArray_SimpleNewFromData(3, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_timestamp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -4355,26 +4873,26 @@ __pyx_r = ((PyObject *)__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; - goto __pyx_L11; + goto __pyx_L10; } - /* "freenect.pyx":469 + /* "freenect.pyx":512 * dims[0], dims[1], dims[2] = 480, 640, 3 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp * elif format == VIDEO_IR_8BIT: # <<<<<<<<<<<<<< * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT8, data), timestamp */ - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_IR_8BIT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_IR_8BIT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_format, __pyx_t_9, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_format, __pyx_t_9, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "freenect.pyx":470 + /* "freenect.pyx":513 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp * elif format == VIDEO_IR_8BIT: * dims[0], dims[1] = 480, 640 # <<<<<<<<<<<<<< @@ -4386,7 +4904,7 @@ (__pyx_v_dims[0]) = __pyx_t_8; (__pyx_v_dims[1]) = __pyx_t_7; - /* "freenect.pyx":471 + /* "freenect.pyx":514 * elif format == VIDEO_IR_8BIT: * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT8, data), timestamp # <<<<<<<<<<<<<< @@ -4394,11 +4912,11 @@ * raise TypeError('Conversion not implemented for type [%d]' % (format)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyLong_FromUnsignedLong(__pyx_v_timestamp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -4409,32 +4927,32 @@ __pyx_r = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "freenect.pyx":473 + /* "freenect.pyx":516 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT8, data), timestamp * else: * raise TypeError('Conversion not implemented for type [%d]' % (format)) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L10:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -4450,7 +4968,7 @@ return __pyx_r; } -/* "freenect.pyx":476 +/* "freenect.pyx":519 * * * def sync_stop(): # <<<<<<<<<<<<<< @@ -4458,15 +4976,15 @@ * """ */ -static PyObject *__pyx_pf_8freenect_25sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8freenect_25sync_stop[] = "Terminate the synchronous runloop if running, else this is a NOP\n "; -static PyMethodDef __pyx_mdef_8freenect_25sync_stop = {__Pyx_NAMESTR("sync_stop"), (PyCFunction)__pyx_pf_8freenect_25sync_stop, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8freenect_25sync_stop)}; -static PyObject *__pyx_pf_8freenect_25sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_28sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_8freenect_28sync_stop[] = "Terminate the synchronous runloop if running, else this is a NOP\n "; +static PyMethodDef __pyx_mdef_8freenect_28sync_stop = {__Pyx_NAMESTR("sync_stop"), (PyCFunction)__pyx_pf_8freenect_28sync_stop, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8freenect_28sync_stop)}; +static PyObject *__pyx_pf_8freenect_28sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("sync_stop"); __pyx_self = __pyx_self; - /* "freenect.pyx":479 + /* "freenect.pyx":522 * """Terminate the synchronous runloop if running, else this is a NOP * """ * freenect_sync_stop() # <<<<<<<<<<<<<< @@ -6974,9 +7492,11 @@ {&__pyx_n_s__accelerometer_z, __pyx_k__accelerometer_z, sizeof(__pyx_k__accelerometer_z), 0, 0, 1, 1}, {&__pyx_n_s__angle, __pyx_k__angle, sizeof(__pyx_k__angle), 0, 0, 1, 1}, {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__base_runloop, __pyx_k__base_runloop, sizeof(__pyx_k__base_runloop), 0, 0, 1, 1}, {&__pyx_n_s__body, __pyx_k__body, sizeof(__pyx_k__body), 0, 0, 1, 1}, {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__cb, __pyx_k__cb, sizeof(__pyx_k__cb), 0, 0, 1, 1}, {&__pyx_n_s__close_device, __pyx_k__close_device, sizeof(__pyx_k__close_device), 0, 0, 1, 1}, {&__pyx_n_s__ctx, __pyx_k__ctx, sizeof(__pyx_k__ctx), 0, 0, 1, 1}, {&__pyx_n_s__depth, __pyx_k__depth, sizeof(__pyx_k__depth), 0, 0, 1, 1}, @@ -7009,9 +7529,11 @@ {&__pyx_n_s__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1}, {&__pyx_n_s__resize, __pyx_k__resize, sizeof(__pyx_k__resize), 0, 0, 1, 1}, {&__pyx_n_s__runloop, __pyx_k__runloop, sizeof(__pyx_k__runloop), 0, 0, 1, 1}, + {&__pyx_n_s__set_depth_callback, __pyx_k__set_depth_callback, sizeof(__pyx_k__set_depth_callback), 0, 0, 1, 1}, {&__pyx_n_s__set_depth_mode, __pyx_k__set_depth_mode, sizeof(__pyx_k__set_depth_mode), 0, 0, 1, 1}, {&__pyx_n_s__set_led, __pyx_k__set_led, sizeof(__pyx_k__set_led), 0, 0, 1, 1}, {&__pyx_n_s__set_tilt_degs, __pyx_k__set_tilt_degs, sizeof(__pyx_k__set_tilt_degs), 0, 0, 1, 1}, + {&__pyx_n_s__set_video_callback, __pyx_k__set_video_callback, sizeof(__pyx_k__set_video_callback), 0, 0, 1, 1}, {&__pyx_n_s__set_video_mode, __pyx_k__set_video_mode, sizeof(__pyx_k__set_video_mode), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__shutdown, __pyx_k__shutdown, sizeof(__pyx_k__shutdown), 0, 0, 1, 1}, @@ -7036,9 +7558,9 @@ {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_property = __Pyx_GetName(__pyx_b, __pyx_n_s__property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_property = __Pyx_GetName(__pyx_b, __pyx_n_s__property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7050,14 +7572,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); - /* "freenect.pyx":396 + /* "freenect.pyx":435 * """ * data = np.fromstring(string, dtype=np.uint16) * data.resize((480, 640)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_k_tuple_5 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); __Pyx_INCREF(__pyx_int_480); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_int_480); @@ -7066,21 +7588,21 @@ PyTuple_SET_ITEM(__pyx_k_tuple_5, 1, __pyx_int_640); __Pyx_GIVEREF(__pyx_int_640); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_k_tuple_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "freenect.pyx":412 + /* "freenect.pyx":451 * """ * data = np.fromstring(string, dtype=np.uint8) * data.resize((480, 640, 3)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_k_tuple_7 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_7 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); __Pyx_INCREF(__pyx_int_480); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, __pyx_int_480); @@ -7092,7 +7614,7 @@ PyTuple_SET_ITEM(__pyx_k_tuple_7, 2, __pyx_int_3); __Pyx_GIVEREF(__pyx_int_3); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_k_tuple_7)); @@ -7260,14 +7782,14 @@ /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "CtxPtr", (PyObject *)&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "CtxPtr", (PyObject *)&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8freenect_CtxPtr = &__pyx_type_8freenect_CtxPtr; - if (PyType_Ready(&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "DevPtr", (PyObject *)&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "DevPtr", (PyObject *)&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8freenect_DevPtr = &__pyx_type_8freenect_DevPtr; - if (PyType_Ready(&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "StatePtr", (PyObject *)&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "StatePtr", (PyObject *)&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8freenect_StatePtr = &__pyx_type_8freenect_StatePtr; /*--- Type import code ---*/ __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7290,604 +7812,604 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":143 + /* "freenect.pyx":140 * * * VIDEO_RGB = FREENECT_VIDEO_RGB # <<<<<<<<<<<<<< * VIDEO_BAYER = FREENECT_VIDEO_BAYER * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":144 + /* "freenect.pyx":141 * * VIDEO_RGB = FREENECT_VIDEO_RGB * VIDEO_BAYER = FREENECT_VIDEO_BAYER # <<<<<<<<<<<<<< * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_BAYER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_BAYER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_BAYER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_BAYER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":145 + /* "freenect.pyx":142 * VIDEO_RGB = FREENECT_VIDEO_RGB * VIDEO_BAYER = FREENECT_VIDEO_BAYER * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT # <<<<<<<<<<<<<< * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_8BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_8BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_IR_8BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_IR_8BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":146 + /* "freenect.pyx":143 * VIDEO_BAYER = FREENECT_VIDEO_BAYER * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT # <<<<<<<<<<<<<< * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_IR_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_IR_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":147 + /* "freenect.pyx":144 * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED # <<<<<<<<<<<<<< * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_24, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_24, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":148 + /* "freenect.pyx":145 * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB # <<<<<<<<<<<<<< * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW * DEPTH_11BIT = FREENECT_DEPTH_11BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_YUV_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_YUV_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":149 + /* "freenect.pyx":146 * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW # <<<<<<<<<<<<<< * DEPTH_11BIT = FREENECT_DEPTH_11BIT * DEPTH_10BIT = FREENECT_DEPTH_10BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RAW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RAW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_YUV_RAW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_YUV_RAW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":150 + /* "freenect.pyx":147 * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW * DEPTH_11BIT = FREENECT_DEPTH_11BIT # <<<<<<<<<<<<<< * DEPTH_10BIT = FREENECT_DEPTH_10BIT * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_11BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_11BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":151 + /* "freenect.pyx":148 * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW * DEPTH_11BIT = FREENECT_DEPTH_11BIT * DEPTH_10BIT = FREENECT_DEPTH_10BIT # <<<<<<<<<<<<<< * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":152 + /* "freenect.pyx":149 * DEPTH_11BIT = FREENECT_DEPTH_11BIT * DEPTH_10BIT = FREENECT_DEPTH_10BIT * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED # <<<<<<<<<<<<<< * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED * LED_OFF = FREENECT_LED_OFF */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_11BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_11BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":153 + /* "freenect.pyx":150 * DEPTH_10BIT = FREENECT_DEPTH_10BIT * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED # <<<<<<<<<<<<<< * LED_OFF = FREENECT_LED_OFF * LED_GREEN = FREENECT_LED_GREEN */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_10BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_10BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":154 + /* "freenect.pyx":151 * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED * LED_OFF = FREENECT_LED_OFF # <<<<<<<<<<<<<< * LED_GREEN = FREENECT_LED_GREEN * LED_RED = FREENECT_LED_RED */ - __pyx_t_1 = PyInt_FromLong(LED_OFF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_OFF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_OFF, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_OFF, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":155 + /* "freenect.pyx":152 * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED * LED_OFF = FREENECT_LED_OFF * LED_GREEN = FREENECT_LED_GREEN # <<<<<<<<<<<<<< * LED_RED = FREENECT_LED_RED * LED_YELLOW = FREENECT_LED_YELLOW */ - __pyx_t_1 = PyInt_FromLong(LED_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":156 + /* "freenect.pyx":153 * LED_OFF = FREENECT_LED_OFF * LED_GREEN = FREENECT_LED_GREEN * LED_RED = FREENECT_LED_RED # <<<<<<<<<<<<<< * LED_YELLOW = FREENECT_LED_YELLOW * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN */ - __pyx_t_1 = PyInt_FromLong(LED_RED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_RED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_RED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_RED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":157 + /* "freenect.pyx":154 * LED_GREEN = FREENECT_LED_GREEN * LED_RED = FREENECT_LED_RED * LED_YELLOW = FREENECT_LED_YELLOW # <<<<<<<<<<<<<< * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW */ - __pyx_t_1 = PyInt_FromLong(LED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_YELLOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_YELLOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":158 + /* "freenect.pyx":155 * LED_RED = FREENECT_LED_RED * LED_YELLOW = FREENECT_LED_YELLOW * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN # <<<<<<<<<<<<<< * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW */ - __pyx_t_1 = PyInt_FromLong(LED_BLINK_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_BLINK_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_BLINK_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_BLINK_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":159 + /* "freenect.pyx":156 * LED_YELLOW = FREENECT_LED_YELLOW * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW # <<<<<<<<<<<<<< * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM */ - __pyx_t_1 = PyInt_FromLong(LED_BLINK_RED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_BLINK_RED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_25, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_25, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":160 + /* "freenect.pyx":157 * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW # <<<<<<<<<<<<<< * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH */ - __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_LOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_LOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_LOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_LOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":161 + /* "freenect.pyx":158 * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM # <<<<<<<<<<<<<< * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR */ - __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_MEDIUM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_MEDIUM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_MEDIUM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_MEDIUM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":162 + /* "freenect.pyx":159 * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH # <<<<<<<<<<<<<< * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA */ - __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_HIGH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_HIGH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_HIGH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_HIGH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":163 + /* "freenect.pyx":160 * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR # <<<<<<<<<<<<<< * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA * DEVICE_AUDIO = FREENECT_DEVICE_AUDIO */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_MOTOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_MOTOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_MOTOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_MOTOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":164 + /* "freenect.pyx":161 * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA # <<<<<<<<<<<<<< * DEVICE_AUDIO = FREENECT_DEVICE_AUDIO * */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_CAMERA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_CAMERA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_CAMERA, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_CAMERA, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":165 + /* "freenect.pyx":162 * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA * DEVICE_AUDIO = FREENECT_DEVICE_AUDIO # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_AUDIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_AUDIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_AUDIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_AUDIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":199 + /* "freenect.pyx":196 * return int(self._ptr.tilt_status) * * accelerometer_x = property(_get_accelx) # <<<<<<<<<<<<<< * accelerometer_y = property(_get_accely) * accelerometer_z = property(_get_accelz) */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_x, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_x, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":200 + /* "freenect.pyx":197 * * accelerometer_x = property(_get_accelx) * accelerometer_y = property(_get_accely) # <<<<<<<<<<<<<< * accelerometer_z = property(_get_accelz) * tilt_angle = property(_get_tilt_angle) */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accely); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accely); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_y, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_y, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":201 + /* "freenect.pyx":198 * accelerometer_x = property(_get_accelx) * accelerometer_y = property(_get_accely) * accelerometer_z = property(_get_accelz) # <<<<<<<<<<<<<< * tilt_angle = property(_get_tilt_angle) * tilt_status = property(_get_tilt_status) */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_z, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_z, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":202 + /* "freenect.pyx":199 * accelerometer_y = property(_get_accely) * accelerometer_z = property(_get_accelz) * tilt_angle = property(_get_tilt_angle) # <<<<<<<<<<<<<< * tilt_status = property(_get_tilt_status) * */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_angle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_angle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":203 + /* "freenect.pyx":200 * accelerometer_z = property(_get_accelz) * tilt_angle = property(_get_tilt_angle) * tilt_status = property(_get_tilt_status) # <<<<<<<<<<<<<< * * def set_depth_mode(DevPtr dev, int res, int mode): */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_status, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_status, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":205 + /* "freenect.pyx":202 * tilt_status = property(_get_tilt_status) * * def set_depth_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_set_depth_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_set_depth_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_depth_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_depth_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":208 + /* "freenect.pyx":205 * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) * * def set_video_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_1set_video_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_1set_video_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_video_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_video_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":211 + /* "freenect.pyx":208 * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) * * def start_depth(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_start_depth(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_2start_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_2start_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__start_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__start_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":214 + /* "freenect.pyx":211 * return freenect_start_depth(dev._ptr) * * def start_video(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_start_video(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_3start_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_3start_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__start_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__start_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":217 + /* "freenect.pyx":214 * return freenect_start_video(dev._ptr) * * def stop_depth(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_stop_depth(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_4stop_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_4stop_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stop_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stop_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":220 + /* "freenect.pyx":217 * return freenect_stop_depth(dev._ptr) * * def stop_video(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_stop_video(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_5stop_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_5stop_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stop_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stop_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":223 + /* "freenect.pyx":220 * return freenect_stop_video(dev._ptr) * * def shutdown(CtxPtr ctx): # <<<<<<<<<<<<<< * return freenect_shutdown(ctx._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_6shutdown, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_6shutdown, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":226 + /* "freenect.pyx":223 * return freenect_shutdown(ctx._ptr) * * def process_events(CtxPtr ctx): # <<<<<<<<<<<<<< * return freenect_process_events(ctx._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_7process_events, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_7process_events, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__process_events, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__process_events, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":229 + /* "freenect.pyx":226 * return freenect_process_events(ctx._ptr) * * def num_devices(CtxPtr ctx): # <<<<<<<<<<<<<< * return freenect_num_devices(ctx._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_8num_devices, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_8num_devices, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__num_devices, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__num_devices, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":232 + /* "freenect.pyx":229 * return freenect_num_devices(ctx._ptr) * * def close_device(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_close_device(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_9close_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_9close_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__close_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__close_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":235 + /* "freenect.pyx":232 * return freenect_close_device(dev._ptr) * * def set_tilt_degs(DevPtr dev, float angle): # <<<<<<<<<<<<<< * freenect_set_tilt_degs(dev._ptr, angle) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_10set_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_10set_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":238 + /* "freenect.pyx":235 * freenect_set_tilt_degs(dev._ptr, angle) * * def set_led(DevPtr dev, freenect_led_options option): # <<<<<<<<<<<<<< * return freenect_set_led(dev._ptr, option) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_11set_led, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_11set_led, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_led, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_led, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":241 + /* "freenect.pyx":238 * return freenect_set_led(dev._ptr, option) * * def update_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_update_tilt_state(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_12update_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_12update_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__update_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__update_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":244 + /* "freenect.pyx":241 * return freenect_update_tilt_state(dev._ptr) * * def get_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< * cdef freenect_raw_tilt_state* state = freenect_get_tilt_state(dev._ptr) * cdef StatePtr state_out */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_13get_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_13get_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":251 + /* "freenect.pyx":248 * return state_out * * def get_mks_accel(StatePtr state): # <<<<<<<<<<<<<< * cdef double x, y, z * freenect_get_mks_accel(state._ptr, &x, &y, &z) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_14get_mks_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_14get_mks_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_mks_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_mks_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":256 + /* "freenect.pyx":253 * return x, y, z * * def get_accel(DevPtr dev): # <<<<<<<<<<<<<< * """MKS Accelerometer helper * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_15get_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_15get_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":269 + /* "freenect.pyx":266 * * * def get_tilt_degs(StatePtr state): # <<<<<<<<<<<<<< * return freenect_get_tilt_degs(state._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_16get_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_16get_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":273 + /* "freenect.pyx":270 * * * def error_open_device(): # <<<<<<<<<<<<<< * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_17error_open_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_17error_open_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__error_open_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__error_open_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":300 + /* "freenect.pyx":297 * return dev_out * * _depth_cb, _video_cb = None, None # <<<<<<<<<<<<<< @@ -7898,70 +8420,106 @@ __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = Py_None; __Pyx_INCREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "freenect.pyx":315 + * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) + * + * def set_depth_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _depth_cb + * if cb is not None: + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_20set_depth_callback, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_depth_callback, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "freenect.pyx":324 + * freenect_set_depth_callback(dev._ptr, NULL) + * + * def set_video_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _video_cb + * if cb is not None: + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_21set_video_callback, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_video_callback, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":319 + /* "freenect.pyx":334 * * * class Kill(Exception): # <<<<<<<<<<<<<< * """This kills the runloop, raise from the body only""" * */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); - if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_26)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__Kill, __pyx_n_s__freenect); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_26)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__Kill, __pyx_n_s__freenect); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Kill, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Kill, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "freenect.pyx":323 + /* "freenect.pyx":338 * * * def runloop(depth=None, video=None, body=None, dev=None): # <<<<<<<<<<<<<< * """Sets up the kinect and maintains a runloop * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_20runloop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_22runloop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__runloop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__runloop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":384 + /* "freenect.pyx":399 * freenect_shutdown(ctxp) * + * def base_runloop(CtxPtr ctx, body=None): # <<<<<<<<<<<<<< + * """Starts a runloop + * + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_23base_runloop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__base_runloop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "freenect.pyx":423 + * pass + * * def _depth_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< * """Converts the raw depth data into a numpy array for your function * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_21_depth_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_24_depth_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":400 + /* "freenect.pyx":439 * * * def _video_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< * """Converts the raw depth data into a numpy array for your function * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_22_video_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_25_video_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":415 + /* "freenect.pyx":454 * return dev, data, timestamp * * import_array() # <<<<<<<<<<<<<< @@ -7970,50 +8528,50 @@ */ import_array(); - /* "freenect.pyx":417 + /* "freenect.pyx":456 * import_array() * * def sync_get_depth(index=0, format=DEPTH_11BIT): # <<<<<<<<<<<<<< * """Get the next available depth frame from the kinect, as a numpy array. * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_9 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_23sync_get_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_26sync_get_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_get_depth, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_get_depth, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":445 + /* "freenect.pyx":486 * * * def sync_get_video(index=0, format=VIDEO_RGB): # <<<<<<<<<<<<<< * """Get the next available rgb frame from the kinect, as a numpy array. * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_11 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_24sync_get_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_27sync_get_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_get_video, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_get_video, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":476 + /* "freenect.pyx":519 * * * def sync_stop(): # <<<<<<<<<<<<<< * """Terminate the synchronous runloop if running, else this is a NOP * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_25sync_stop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_28sync_stop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_stop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_stop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "freenect.pyx":1 diff -Nru libfreenect-0.1.1.3/wrappers/python/freenect.pyx libfreenect-0.1.2/wrappers/python/freenect.pyx --- libfreenect-0.1.1.3/wrappers/python/freenect.pyx 2011-11-07 11:47:23.000000000 +0000 +++ libfreenect-0.1.2/wrappers/python/freenect.pyx 2012-01-29 14:19:13.000000000 +0000 @@ -34,9 +34,6 @@ cdef extern from "stdlib.h": void free(void *ptr) -cdef extern from "Python.h": - object PyString_FromStringAndSize(char *s, Py_ssize_t len) - cdef extern from "libfreenect.h": ctypedef enum freenect_video_format: FREENECT_VIDEO_RGB @@ -281,7 +278,7 @@ # to both but haven't wrapped the python API for selecting subdevices yet. # Also, we don't support audio in the python wrapper yet, so no sense claiming # the device. - freenect_select_subdevices(ctx, FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA) + freenect_select_subdevices(ctx, int(FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA)) cdef CtxPtr ctx_out ctx_out = CtxPtr() ctx_out._ptr = ctx @@ -305,7 +302,7 @@ dev_out = DevPtr() dev_out._ptr = dev if _depth_cb: - _depth_cb(*_depth_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) + _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: nbytes = 921600 # 480 * 640 * 3 @@ -313,7 +310,25 @@ dev_out = DevPtr() dev_out._ptr = dev if _video_cb: - _video_cb(*_video_cb_np(dev_out, PyString_FromStringAndSize(data, nbytes), timestamp)) + _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) + +def set_depth_callback(DevPtr dev, cb): + global _depth_cb + if cb is not None: + _depth_cb = cb + freenect_set_depth_callback(dev._ptr, depth_cb) + else: + _depth_cb = None + freenect_set_depth_callback(dev._ptr, NULL) + +def set_video_callback(DevPtr dev, cb): + global _video_cb + if cb is not None: + _video_cb = cb + freenect_set_video_callback(dev._ptr, video_cb) + else: + _video_cb = None + freenect_set_video_callback(dev._ptr, NULL) class Kill(Exception): @@ -381,6 +396,30 @@ freenect_close_device(devp) freenect_shutdown(ctxp) +def base_runloop(CtxPtr ctx, body=None): + """Starts a runloop + + This function can be used instead of runloop() to allow the Python code to + perform all setup steps independently. This simply calls process_events in + a loop, optionally calling a body function in between. Raise the Kill + exception to break out of the runloop. + + Args: + ctx: Freenect library context + body: A function that takes (ctx) and is called in the body of process_events + """ + cdef freenect_context* ctxp + ctxp = ctx._ptr + try: + while True: + with nogil: + if freenect_process_events(ctxp) < 0: + break + if body: + body(ctx) + except Kill: + pass + def _depth_cb_np(dev, string, timestamp): """Converts the raw depth data into a numpy array for your function @@ -427,11 +466,13 @@ timestamp: int representing the time """ cdef void* data - cdef unsigned int timestamp + cdef uint32_t timestamp cdef npc.npy_intp dims[2] cdef int out + cdef int _index = index + cdef freenect_depth_format _format = format with nogil: - out = freenect_sync_get_depth(&data, ×tamp, index, format) + out = freenect_sync_get_depth(&data, ×tamp, _index, _format) if out: error_open_device() return @@ -455,11 +496,13 @@ timestamp: int representing the time """ cdef void* data - cdef unsigned int timestamp + cdef uint32_t timestamp cdef npc.npy_intp dims[3] cdef int out + cdef int _index = index + cdef freenect_video_format _format = format with nogil: - out = freenect_sync_get_video(&data, ×tamp, index, format) + out = freenect_sync_get_video(&data, ×tamp, _index, _format) if out: error_open_device() return