Go to the documentation of this file.
108 operator const char*()
const {
return NULL; }
164 void _setData(
const T* data,
int count,
bool isOwner =
false)
176 memcpy((
void*)
m_data, data, count*
sizeof(T));
181 Array(
const Array<T>&);
480 inline const void*
getData()
const
673 class NewFrameListener
699 stream._setHandle(streamHandle);
700 pListener->onNewFrame(stream);
701 stream._setHandle(NULL);
719 return pThis->allocateFrameBuffer(size);
725 pThis->freeFrameBuffer(data);
888 pListener->m_callbackHandle = NULL;
903 if (pAllocator == NULL)
1043 bool getCropping(
int* pOriginX,
int* pOriginY,
int* pWidth,
int* pHeight)
const
1046 bool enabled =
false;
1054 *pWidth = cropping.
width;
1055 *pHeight = cropping.
height;
1077 cropping.
width = width;
1078 cropping.
height = height;
1124 float horizontal = 0;
1167 int size =
sizeof(T);
1217 return invoke(commandId, &value,
sizeof(T));
1235 void filterSpeckles(
void* buf,
int newVal,
int maxSpeckleSize,
int maxDiff){
1348 inline void close();
1486 int size =
sizeof(value);
1600 return setProperty(propertyId, &value,
sizeof(T));
1615 int size =
sizeof(T);
1655 return invoke(propertyId, &value,
sizeof(T));
1791 return repeat ==
TRUE;
1822 Status seek(
const VideoStream& stream,
int frameIndex)
1829 seek.frameIndex = frameIndex;
1830 seek.stream = stream._getHandle();
1844 int numOfFrames = -1;
1860 if (!device->isValid() || !device->isFile())
1878 if (pDevice != NULL)
1887 class CameraSettings
2191 int m_deviceInfoCount;
2207 static const int ONI_MAX_STREAMS = 50;
2210 if (streamCount > ONI_MAX_STREAMS)
2212 printf(
"Too many streams for wait: %d > %d\n", streamCount, ONI_MAX_STREAMS);
2216 *pReadyStreamIndex = -1;
2217 for (
int i = 0; i < streamCount; ++i)
2219 if (pStreams[i] != NULL)
2221 streams[i] = pStreams[i]->_getHandle();
2242 if (pListener->m_deviceConnectedCallbacksHandle != NULL)
2257 if (pListener->m_deviceDisconnectedCallbacksHandle != NULL)
2272 if (pListener->m_deviceStateChangedCallbacksHandle != NULL)
2288 pListener->m_deviceConnectedCallbacksHandle = NULL;
2300 pListener->m_deviceDisconnectedCallbacksHandle = NULL;
2312 pListener->m_deviceStateChangedCallbacksHandle = NULL;
2381 #if ONI_PLATFORM == ONI_PLATFORM_ANDROID_ARM
2391 static Status setLogAndroidOutput(
bool bAndroidOutput)
2393 return (
Status)oniSetLogAndroidOutput(bAndroidOutput);
2438 class CoordinateConverter
2453 float depthX, depthY, depthZ;
2455 *pDepthX = (int)depthX;
2456 *pDepthY = (int)depthY;
2608 if (!
isValid() || !stream.isValid())
2614 stream._getHandle(),
2615 allowLossyCompression);
int getCropOriginX() const
Status seek(const VideoStream &stream, int frameIndex)
SensorInfo m_aSensorInfo[ONI_MAX_SENSORS]
virtual ~NewFrameListener()
@ STREAM_PROPERTY_AUTO_EXPOSURE
DeviceConnectedListener()
ONI_C_API OniStatus oniCoordinateConverterDepthToColor(OniStreamHandle depthStream, OniStreamHandle colorStream, int depthX, int depthY, OniDepthPixel depthZ, int *pColorX, int *pColorY)
ONI_C_API OniStatus oniDeviceInvoke(OniDeviceHandle device, int commandId, void *data, int dataSize)
static Status addDeviceStateChangedListener(DeviceStateChangedListener *pListener)
int getFrameIndex() const
bool isPropertySupported(int propertyId) const
ONI_C_API OniStatus oniStreamInvoke(OniStreamHandle stream, int commandId, void *data, int dataSize)
int getMaxPixelValue() const
const char * getName() const
static Status initialize()
@ STREAM_PROPERTY_VIDEO_MODE
void _setFrame(OniFrame *pFrame)
struct OniCallbackHandleImpl * OniCallbackHandle
@ DEVICE_PROPERTY_PLAYBACK_SPEED
DeviceDisconnectedListener()
@ STREAM_PROPERTY_MIN_VALUE
ONI_C_API OniStatus oniStreamReadFrame(OniStreamHandle stream, OniFrame **pFrame)
const DeviceInfo & getDeviceInfo() const
Status setExposure(int exposure)
ONI_C_API OniStatus oniStreamRegisterNewFrameCallback(OniStreamHandle stream, OniNewFrameCallback handler, void *pCookie, OniCallbackHandle *pHandle)
virtual void onDeviceStateChanged(const DeviceInfo *, DeviceState)=0
ONI_C_API OniStatus oniStreamStart(OniStreamHandle stream)
ONI_C_API void oniDeviceDisableDepthColorSync(OniDeviceHandle device)
Status setFrameBuffersAllocator(FrameAllocator *pAllocator)
ONI_C_API void oniFrameRelease(OniFrame *pFrame)
OniCallbackHandle m_deviceStateChangedCallbacksHandle
ONI_C_API OniStatus oniDeviceClose(OniDeviceHandle device)
Status open(const char *uri)
@ DEVICE_PROPERTY_PLAYBACK_REPEAT_ENABLED
Status setAutoWhiteBalanceEnabled(bool enabled)
ONI_C_API OniStatus oniCoordinateConverterWorldToDepth(OniStreamHandle depthStream, float worldX, float worldY, float worldZ, float *pDepthX, float *pDepthY, float *pDepthZ)
ONI_C_API OniStatus oniDeviceGetInfo(OniDeviceHandle device, OniDeviceInfo *pInfo)
static void removeDeviceStateChangedListener(DeviceStateChangedListener *pListener)
const char * getVendor() const
@ PARAMS_REGISTRATION_OFF
ONI_C_API OniStatus oniCoordinateConverterD2C(OniStreamHandle depthStream, int colorX, int colorY, OniDepthPixel depthZ, int *pDepthX, int *pDepthY)
OniCallbackHandle m_deviceDisconnectedCallbacksHandle
const ONI_C_API OniSensorInfo * oniDeviceGetSensorInfo(OniDeviceHandle device, OniSensorType sensorType)
int getMinPixelValue() const
VideoMode & operator=(const VideoMode &other)
ONI_C_API OniBool oniDeviceIsCommandSupported(OniDeviceHandle device, int commandId)
static Status setLogFileOutput(bool bFileOutput)
const T & operator[](int index) const
SensorType getSensorType() const
Status setImageRegistrationMode(ImageRegistrationMode mode)
virtual void onDeviceDisconnected(const DeviceInfo *)=0
Status getProperty(int propertyId, T *value) const
ONI_C_API OniStatus oniDeviceOpen(const char *uri, OniDeviceHandle *pDevice)
void _setHandle(OniStreamHandle stream)
ONI_C_API void oniShutdown()
@ DEVICE_PROPERTY_IMAGE_REGISTRATION
bool getCroppingEnabled() const
ONI_C_API OniStatus oniDeviceOpenEx(const char *uri, const char *mode, OniDeviceHandle *pDevice)
ONI_C_API OniStatus oniDeviceEnableDepthColorSync(OniDeviceHandle device)
ONI_C_API OniStatus oniSetLogConsoleOutput(OniBool bConsoleOutput)
Status _openEx(const char *uri, const char *mode)
Status setRepeatEnabled(bool repeat)
ONI_C_API OniStatus oniDeviceCreateStream(OniDeviceHandle device, OniSensorType sensorType, OniStreamHandle *pStream)
OniPixelFormat pixelFormat
OniDeviceCallbacks m_deviceStateChangedCallbacks
ONI_C_API OniStatus oniDeviceGetProperty(OniDeviceHandle device, int propertyId, void *data, int *pDataSize)
OniDeviceCallbacks m_deviceConnectedCallbacks
int getNumberOfFrames(const VideoStream &stream) const
virtual void * allocateFrameBuffer(int size)=0
bool getDepthColorSyncEnabled()
@ STREAM_PROPERTY_MAX_VALUE
OniCallbackHandle m_callbackHandle
Status _setHandle(OniDeviceHandle deviceHandle)
friend class VideoFrameRef
ONI_C_API OniBool oniDeviceGetDepthColorSyncEnabled(OniDeviceHandle device)
float getVerticalFieldOfView() const
CameraSettings * getCameraSettings()
Recorder & operator=(const Recorder &)
Status setDepthColorSyncEnabled(bool isEnabled)
OniStreamHandle _getHandle() const
void setSoftwareRegistrator(ParamsRegistrationMode mode)
static Status getLogFileName(char *strFileName, int nBufferSize)
VideoStream & operator=(const VideoStream &other)
bool hasSensor(SensorType sensorType)
Status addNewFrameListener(NewFrameListener *pListener)
static Status setLogConsoleOutput(bool bConsoleOutput)
@ STREAM_PROPERTY_MIRRORING
const ONI_C_API char * oniGetExtendedError()
ONI_C_API OniStatus oniRecorderAttachStream(OniRecorderHandle recorder, OniStreamHandle stream, OniBool allowLossyCompression)
PlaybackControl * getPlaybackControl()
void removeNewFrameListener(NewFrameListener *pListener)
ONI_C_API void oniUnregisterDeviceCallbacks(OniCallbackHandle handle)
static Status convertDepthToWorld(const VideoStream &depthStream, int depthX, int depthY, DepthPixel depthZ, float *pWorldX, float *pWorldY, float *pWorldZ)
ONI_C_API OniStatus oniGetLogFileName(char *strFileName, int nBufferSize)
const VideoMode & getVideoMode() const
ONI_C_API OniStatus oniStreamSetProperty(OniStreamHandle stream, int propertyId, const void *data, int dataSize)
VideoMode getVideoMode() const
void _setInternal(const OniSensorInfo *pInfo)
const char * getUri() const
void _setData(const T *data, int count, bool isOwner=false)
static Status convertDepthToColor(const VideoStream &depthStream, const VideoStream &colorStream, int depthX, int depthY, DepthPixel depthZ, int *pColorX, int *pColorY)
bool isCommandSupported(int commandId) const
OniDeviceHandle _getHandle() const
static void ONI_CALLBACK_TYPE freeFrameBufferCallback(void *data, void *pCookie)
Status getProperty(int propertyId, void *data, int *dataSize) const
static void ONI_CALLBACK_TYPE deviceConnectedCallback(const OniDeviceInfo *pInfo, void *pCookie)
PlaybackControl * m_pPlaybackControl
void filterSpeckles(void *buf, int newVal, int maxSpeckleSize, int maxDiff)
OniDeviceInfoCallback deviceDisconnected
const SensorInfo & getSensorInfo() const
ONI_C_API OniStatus oniCoordinateConverterDepthToWorld(OniStreamHandle depthStream, float depthX, float depthY, float depthZ, float *pWorldX, float *pWorldY, float *pWorldZ)
ONI_C_API OniBool oniDeviceIsPropertySupported(OniDeviceHandle device, int propertyId)
ONI_C_API OniStatus oniCreateRecorder(const char *fileName, OniRecorderHandle *pRecorder)
Status setAutoExposureEnabled(bool enabled)
Array< VideoMode > m_videoModes
ONI_C_API OniStatus oniRegisterDeviceCallbacks(OniDeviceCallbacks *pCallbacks, void *pCookie, OniCallbackHandle *pHandle)
bool isImageRegistrationModeSupported(ImageRegistrationMode mode) const
@ STREAM_PROPERTY_EXPOSURE
Status readFrame(VideoFrameRef *pFrame)
ONI_C_API void oniStreamDestroy(OniStreamHandle stream)
OniDeviceStateCallback deviceStateChanged
ONI_C_API OniStatus oniCoordinateConverterC2D(OniStreamHandle depthStream, int colorX, int colorY, OniDepthPixel depthZ, int *pDepthX, int *pDepthY)
virtual ~DeviceConnectedListener()
ParamsRegistrationMode getSoftwareRegistratorMode()
VideoFrameRef & operator=(const VideoFrameRef &other)
void setReference(OniFrame *pFrame)
Device & operator=(const Device &)
static Status setLogOutputFolder(const char *strLogOutputFolder)
ONI_C_API OniBool oniStreamIsPropertySupported(OniStreamHandle stream, int propertyId)
void setPixelFormat(PixelFormat format)
ONI_C_API OniStatus oniReleaseDeviceList(OniDeviceInfo *pDevices)
const Array< VideoMode > & getSupportedVideoModes() const
int getStrideInBytes() const
Status invoke(int commandId, void *data, int dataSize)
ONI_C_API OniVersion oniGetVersion()
const ONI_C_API OniSensorInfo * oniStreamGetSensorInfo(OniStreamHandle stream)
uint64_t getTimestamp() const
Status invoke(int commandId, void *data, int dataSize)
static Status addDeviceConnectedListener(DeviceConnectedListener *pListener)
static Version getVersion()
OniCallbackHandle m_deviceConnectedCallbacksHandle
Array< T > & operator=(const Array< T > &)
bool getMirroringEnabled() const
ONI_C_API void oniStreamUnregisterNewFrameCallback(OniStreamHandle stream, OniCallbackHandle handle)
ONI_C_API OniStatus oniDeviceSetProperty(OniDeviceHandle device, int propertyId, const void *data, int dataSize)
float getHorizontalFieldOfView() const
@ STREAM_PROPERTY_CROPPING
int getResolutionX() const
PlaybackControl(Device *pDevice)
Status create(const Device &device, SensorType sensorType)
static const int TIMEOUT_FOREVER
@ STREAM_PROPERTY_HORIZONTAL_FOV
ONI_C_API void oniRecorderStop(OniRecorderHandle recorder)
SensorType getSensorType() const
ONI_C_API void oniFrameAddRef(OniFrame *pFrame)
static Status setLogMinSeverity(int nMinSeverity)
const OniSensorInfo * m_pInfo
virtual ~DeviceDisconnectedListener()
CameraSettings * m_pCameraSettings
PixelFormat getPixelFormat() const
virtual void onNewFrame(VideoStream &)=0
OniRecorderHandle m_recorder
@ STREAM_PROPERTY_AUTO_WHITE_BALANCE
static void ONI_CALLBACK_TYPE deviceStateChangedCallback(const OniDeviceInfo *pInfo, OniDeviceState state, void *pCookie)
virtual void onDeviceConnected(const DeviceInfo *)=0
Status setVideoMode(const VideoMode &videoMode)
Status getProperty(int propertyId, void *data, int *dataSize) const
DeviceStateChangedListener()
const SensorInfo * getSensorInfo(SensorType sensorType)
ONI_C_API void oniStreamfilter(OniStreamHandle stream, void *buf, int newVal, int maxSpeckleSize, int maxDiff)
Status attach(VideoStream &stream, bool allowLossyCompression=false)
uint16_t getUsbProductId() const
Status setCropping(int originX, int originY, int width, int height)
const void * getData() const
Status setProperty(int propertyId, const void *data, int dataSize)
virtual void freeFrameBuffer(void *data)=0
static Status addDeviceDisconnectedListener(DeviceDisconnectedListener *pListener)
static const char * getExtendedError()
ONI_C_API OniBool oniStreamIsCommandSupported(OniStreamHandle stream, int commandId)
uint16_t getUsbVendorId() const
static void removeDeviceDisconnectedListener(DeviceDisconnectedListener *pListener)
static Status convertC2DCoordinateByIntrinsic(const VideoStream &depthStream, int colorX, int colorY, DepthPixel depthZ, int *pDepthX, int *pDepthY)
struct _OniDevice * OniDeviceHandle
ONI_C_API OniBool oniDeviceIsImageRegistrationModeSupported(OniDeviceHandle device, OniImageRegistrationMode mode)
static void *ONI_CALLBACK_TYPE allocateFrameBufferCallback(int size, void *pCookie)
static const _NullString ANY_DEVICE
static Status convertD2CCoordinateByIntrinsic(const VideoStream &depthStream, int depthX, int depthY, DepthPixel depthZ, int *pColorX, int *pColorY)
ONI_C_API OniStatus oniWaitForAnyStream(OniStreamHandle *pStreams, int numStreams, int *pStreamIndex, int timeout)
static Status convertWorldToDepth(const VideoStream &depthStream, float worldX, float worldY, float worldZ, int *pDepthX, int *pDepthY, DepthPixel *pDepthZ)
ONI_C_API OniStatus oniInitialize(int apiVersion)
bool isCroppingSupported() const
OniRecorderHandle getHandle() const
uint16_t Grayscale16Pixel
struct _OniRecorder * OniRecorderHandle
static void ONI_CALLBACK_TYPE deviceDisconnectedCallback(const OniDeviceInfo *pInfo, void *pCookie)
bool getRepeatEnabled() const
OniDeviceCallbacks m_deviceDisconnectedCallbacks
static Status waitForAnyStream(VideoStream **pStreams, int streamCount, int *pReadyStreamIndex, int timeout=TIMEOUT_FOREVER)
@ STREAM_PROPERTY_VERTICAL_FOV
bool getCropping(int *pOriginX, int *pOriginY, int *pWidth, int *pHeight) const
ONI_C_API OniStatus oniRecorderStart(OniRecorderHandle recorder)
int getResolutionY() const
SensorInfo & operator=(const SensorInfo &)
int getCropOriginY() const
ONI_C_API OniStatus oniSetLogFileOutput(OniBool bFileOutput)
ONI_C_API OniStatus oniSetLogMinSeverity(int nMinSeverity)
OniDeviceInfoCallback deviceConnected
ONI_C_API OniStatus oniGetDeviceList(OniDeviceInfo **pDevices, int *pNumDevices)
bool getAutoWhiteBalanceEnabled() const
void setResolution(int resolutionX, int resolutionY)
struct _OniStream * OniStreamHandle
ONI_C_API OniStatus oniRecorderDestroy(OniRecorderHandle *pRecorder)
CameraSettings(VideoStream *pStream)
Status create(const char *fileName)
ONI_C_API OniStatus oniStreamSetFrameBuffersAllocator(OniStreamHandle stream, OniFrameAllocBufferCallback alloc, OniFrameFreeBufferCallback free, void *pCookie)
ONI_C_API OniStatus oniSetLogOutputFolder(const char *strOutputFolder)
@ STREAM_PROPERTY_NUMBER_OF_FRAMES
virtual ~DeviceStateChangedListener()
ONI_C_API OniStatus oniStreamGetProperty(OniStreamHandle stream, int propertyId, void *data, int *pDataSize)
virtual ~FrameAllocator()
@ STREAM_PROPERTY_SOFTWARE_REGISTRATION
Status setProperty(int propertyId, const void *data, int dataSize)
static void ONI_CALLBACK_TYPE callback(OniStreamHandle streamHandle, void *pCookie)
ImageRegistrationMode getImageRegistrationMode() const
bool getAutoExposureEnabled() const
static void enumerateDevices(Array< DeviceInfo > *deviceInfoList)
Status setProperty(int propertyId, const T &value)
ONI_C_API void oniStreamStop(OniStreamHandle stream)
int numSupportedVideoModes
Status attach(Device *device)
Status setSpeed(float speed)
Status setMirroringEnabled(bool isEnabled)
bool isPropertySupported(int propertyId) const
static void removeDeviceConnectedListener(DeviceConnectedListener *pListener)
bool isCommandSupported(int commandId) const
OniVideoMode * pSupportedVideoModes