diff --git a/Include/OniCAPI.h b/Include/OniCAPI.h index aea426d49..8daaadfc5 100644 --- a/Include/OniCAPI.h +++ b/Include/OniCAPI.h @@ -106,6 +106,9 @@ ONI_C_API OniStatus oniStreamStart(OniStreamHandle stream); /** Stop generating data from the stream. */ ONI_C_API void oniStreamStop(OniStreamHandle stream); +/** Send to handler the current frame held by the stream without any side effect or blocking. For use in an onNewFrame() callback and after a successful oniWaitForStreams(). */ +ONI_C_API OniStatus oniStreamPeekFrame(OniStreamHandle stream, OniProcessFrameCallback handler, void* pCookie); + /** Get the next frame from the stream. This function is blocking until there is a new frame from the stream. For timeout, use oniWaitForStreams() first */ ONI_C_API OniStatus oniStreamReadFrame(OniStreamHandle stream, OniFrame** pFrame); diff --git a/Include/OniCTypes.h b/Include/OniCTypes.h index 122469495..b2a9f9d9a 100644 --- a/Include/OniCTypes.h +++ b/Include/OniCTypes.h @@ -113,6 +113,7 @@ typedef struct } OniFrame; typedef void (ONI_CALLBACK_TYPE* OniNewFrameCallback)(OniStreamHandle stream, void* pCookie); +typedef void (ONI_CALLBACK_TYPE* OniProcessFrameCallback)(OniFrame* frame, void* pCookie); typedef void (ONI_CALLBACK_TYPE* OniGeneralCallback)(void* pCookie); typedef void (ONI_CALLBACK_TYPE* OniDeviceInfoCallback)(const OniDeviceInfo* pInfo, void* pCookie); typedef void (ONI_CALLBACK_TYPE* OniDeviceStateCallback)(const OniDeviceInfo* pInfo, OniDeviceState deviceState, void* pCookie); diff --git a/Include/OniVersion.h b/Include/OniVersion.h index 7aa13ed58..c11de5aa7 100644 --- a/Include/OniVersion.h +++ b/Include/OniVersion.h @@ -21,9 +21,9 @@ #include "OniPlatform.h" #define ONI_VERSION_MAJOR 2 -#define ONI_VERSION_MINOR 2 -#define ONI_VERSION_MAINTENANCE 0 -#define ONI_VERSION_BUILD 33 +#define ONI_VERSION_MINOR 3 +#define ONI_VERSION_MAINTENANCE 2 +#define ONI_VERSION_BUILD 0 /** OpenNI version (in brief string format): "Major.Minor.Maintenance (Build)" */ #define ONI_BRIEF_VERSION_STRING \ diff --git a/Include/OpenNI.h b/Include/OpenNI.h index 52324b4eb..9b0e4f561 100644 --- a/Include/OpenNI.h +++ b/Include/OpenNI.h @@ -275,10 +275,10 @@ class VideoMode : private OniVideoMode @param [in] resolutionX Desired new horizontal resolution in pixels. @param [in] resolutionY Desired new vertical resolution in pixels. */ - void setResolution(int resolutionX, int resolutionY) + void setResolution(int _resolutionX, int _resolutionY) { - this->resolutionX = resolutionX; - this->resolutionY = resolutionY; + this->resolutionX = _resolutionX; + this->resolutionY = _resolutionY; } /** @@ -287,7 +287,7 @@ class VideoMode : private OniVideoMode video modes. @param [in] fps Desired new frame rate, measured in frames per second. */ - void setFps(int fps) { this->fps = fps; } + void setFps(int _fps) { this->fps = _fps; } friend class SensorInfo; friend class VideoStream; @@ -596,11 +596,12 @@ class VideoFrameRef /** @internal */ void _setFrame(OniFrame* pFrame) { - setReference(pFrame); if (pFrame != NULL) { oniFrameAddRef(pFrame); } + release(); + m_pFrame = pFrame; } /** @internal */ @@ -611,11 +612,10 @@ class VideoFrameRef private: friend class VideoStream; - inline void setReference(OniFrame* pFrame) + static void ONI_CALLBACK_TYPE setReference(OniFrame* pFrame, void* pCookie) { - // Initial - don't addref. This is the reference from OpenNI - release(); - m_pFrame = pFrame; + VideoFrameRef* pRef = (VideoFrameRef*)pCookie; + pRef->_setFrame(pFrame); } OniFrame* m_pFrame; // const!!? @@ -800,8 +800,26 @@ class VideoStream } /** - Read the next frame from this video stream, delivered as a @ref VideoFrameRef. This is the primary - method for manually obtaining frames of video data. + Get the current frame from this video stream without any side effect or blocking, delivered as a @ref VideoFrameRef. + Call this after using @ref OpenNI::waitForAnyStream() to wait for new frames from several streams. + Alternatively, use @ref VideoStream::Listener to implement an event driven architecture + and call this in the callback method to get the frame from the stream. + + @param [out] pFrame Pointer to a @ref VideoFrameRef object to hold the reference to the new frame. + @returns Status code to indicated success or failure of this function. + */ + Status peekFrame(VideoFrameRef* pFrameRef) + { + if (!isValid()) + { + return STATUS_ERROR; + } + + return (Status)oniStreamPeekFrame(m_stream, VideoFrameRef::setReference, pFrameRef); + } + + /** + Read the next frame from this video stream, delivered as a @ref VideoFrameRef. If no new frame is available, the call will block until one is available. To avoid blocking, use @ref VideoStream::Listener to implement an event driven architecture. Another alternative is to use @ref OpenNI::waitForAnyStream() to wait for new frames from several streams. @@ -809,7 +827,7 @@ class VideoStream @param [out] pFrame Pointer to a @ref VideoFrameRef object to hold the reference to the new frame. @returns Status code to indicated success or failure of this function. */ - Status readFrame(VideoFrameRef* pFrame) + Status readFrame(VideoFrameRef* pFrameRef) { if (!isValid()) { @@ -819,7 +837,7 @@ class VideoStream OniFrame* pOniFrame; Status rc = (Status)oniStreamReadFrame(m_stream, &pOniFrame); - pFrame->setReference(pOniFrame); + VideoFrameRef::setReference(pOniFrame, pFrameRef); return rc; } diff --git a/Packaging/Harvest.py b/Packaging/Harvest.py index 4ce9ed269..e4856594f 100755 --- a/Packaging/Harvest.py +++ b/Packaging/Harvest.py @@ -54,7 +54,7 @@ def copySharedObject(self, sourceDir, name, targetDir): elif self.osName == 'Darwin': shutil.copy(os.path.join(sourceDir, 'lib' + name + '.dylib'), targetDir) else: - raise 'Unsupported platform!' + raise Execption('Unsupported platform!') def copyExecutable(self, sourceDir, name, targetDir): if self.osName == 'Windows': @@ -335,7 +335,7 @@ def run(self): shutil.copy(os.path.join(self.rootDir, 'Packaging', 'Linux', 'primesense-usb.rules'), self.outDir) if len(sys.argv) < 3: - print 'Usage: ' + sys.argv[0] + ' ' + print('Usage: ' + sys.argv[0] + ' ') exit(1) rootDir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) diff --git a/Packaging/Install/Includes/Variables.wxi b/Packaging/Install/Includes/Variables.wxi index 06d017416..b76dcdf07 100644 --- a/Packaging/Install/Includes/Variables.wxi +++ b/Packaging/Install/Includes/Variables.wxi @@ -5,13 +5,13 @@ It's not enough to just include newer files. --> - + - + - +