Varjo Native SDK
Varjo_datastream.h
Go to the documentation of this file.
1 // Copyright 2019-2020 Varjo Technologies Oy. All rights reserved.
2 
3 #ifndef VARJO_DATASTREAM_H
4 #define VARJO_DATASTREAM_H
5 
6 #include "Varjo_export.h"
7 #include "Varjo_types.h"
9 
10 #if defined __cplusplus
11 extern "C" {
12 #endif
13 
21 VARJO_API int32_t varjo_GetDataStreamConfigCount(struct varjo_Session* session);
22 
38 VARJO_API void varjo_GetDataStreamConfigs(struct varjo_Session* session, struct varjo_StreamConfig* configs, int32_t maxSize);
39 
61 VARJO_API void varjo_StartDataStream(
62  struct varjo_Session* session, varjo_StreamId id, varjo_ChannelFlag channels, varjo_FrameListener* callback, void* userData);
63 
80 VARJO_API void varjo_StopDataStream(struct varjo_Session* session, varjo_StreamId id);
81 
100  struct varjo_Session* session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index);
101 
119 VARJO_API struct varjo_Matrix varjo_GetCameraExtrinsics(struct varjo_Session* session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index);
120 
139 VARJO_API varjo_BufferId varjo_GetBufferId(struct varjo_Session* session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index);
140 
164 VARJO_API void varjo_LockDataStreamBuffer(struct varjo_Session* session, varjo_BufferId id);
165 
166 /*
167  * Unlock a previously locked data stream buffer.
168  *
169  * Unlock can be called from any thread (i.e. not necessarily from the frame callback thread).
170  *
171  * Possible errors:
172  * #varjo_Error_OperationFailed, #varjo_Error_NotAvailable, #varjo_Error_CapabilityNotAvailable,
173  * #varjo_Error_DataStreamBufferNotLocked, #varjo_Error_DataStreamBufferInvalidId
174  *
175  * @param session Varjo session handle.
176  * @param id Buffer ID.
177  */
178 VARJO_API void varjo_UnlockDataStreamBuffer(struct varjo_Session* session, varjo_BufferId id);
179 
194 VARJO_API struct varjo_BufferMetadata varjo_GetBufferMetadata(struct varjo_Session* session, varjo_BufferId id);
195 
210 VARJO_API struct varjo_Texture varjo_GetBufferGPUData(struct varjo_Session* session, varjo_BufferId id);
211 
226 VARJO_API void* varjo_GetBufferCPUData(struct varjo_Session* session, varjo_BufferId id);
227 
228 #if defined __cplusplus
229 }
230 #endif
231 #endif // VARJO_DATASTREAM_H
varjo_BufferId
int64_t varjo_BufferId
Buffer ID to lock and use a data stream buffer.
Definition: Varjo_types_datastream.h:110
varjo_UnlockDataStreamBuffer
void varjo_UnlockDataStreamBuffer(struct varjo_Session *session, varjo_BufferId id)
varjo_GetBufferMetadata
struct varjo_BufferMetadata varjo_GetBufferMetadata(struct varjo_Session *session, varjo_BufferId id)
Get buffer related metadata.
varjo_StartDataStream
void varjo_StartDataStream(struct varjo_Session *session, varjo_StreamId id, varjo_ChannelFlag channels, varjo_FrameListener *callback, void *userData)
Start frame streaming into the provided callback.
Varjo_export.h
varjo_GetCameraExtrinsics
struct varjo_Matrix varjo_GetCameraExtrinsics(struct varjo_Session *session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index)
Get camera extrinsics for the current frame.
varjo_GetDataStreamConfigCount
int32_t varjo_GetDataStreamConfigCount(struct varjo_Session *session)
Get number of available stream configurations.
varjo_BufferMetadata
Buffer for data streams.
Definition: Varjo_types_datastream.h:148
varjo_StreamConfig
Data stream configuration.
Definition: Varjo_types_datastream.h:120
varjo_GetDataStreamConfigs
void varjo_GetDataStreamConfigs(struct varjo_Session *session, struct varjo_StreamConfig *configs, int32_t maxSize)
Get available data stream configurations.
varjo_CameraIntrinsics
Camera intrinsics parameter for undistorting a distorted camera frame.
Definition: Varjo_types_datastream.h:136
varjo_StopDataStream
void varjo_StopDataStream(struct varjo_Session *session, varjo_StreamId id)
Stop frame streaming.
varjo_GetCameraIntrinsics
struct varjo_CameraIntrinsics varjo_GetCameraIntrinsics(struct varjo_Session *session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index)
Get camera intrinsics for the current frame.
Varjo_types_datastream.h
varjo_GetBufferCPUData
void * varjo_GetBufferCPUData(struct varjo_Session *session, varjo_BufferId id)
Get data buffer if it resides in the CPU memory (can be checked with varjo_BufferMetadata::type).
varjo_Texture
API-agnostic texture handle.
Definition: Varjo_types.h:457
varjo_GetBufferId
varjo_BufferId varjo_GetBufferId(struct varjo_Session *session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index)
Get bufferId for the current frame.
Varjo_types.h
varjo_GetBufferGPUData
struct varjo_Texture varjo_GetBufferGPUData(struct varjo_Session *session, varjo_BufferId id)
Get data buffer if it resides in the GPU memory (can be checked with varjo_BufferMetadata::type).
varjo_Matrix
Double precision 4x4 matrix.
Definition: Varjo_types.h:294
varjo_StreamId
int64_t varjo_StreamId
Stream ID to identify a data stream configuration.
Definition: Varjo_types_datastream.h:105
varjo_ChannelFlag
uint64_t varjo_ChannelFlag
Bitfield for different data stream channels.
Definition: Varjo_types_datastream.h:15
varjo_FrameListener
void() varjo_FrameListener(const struct varjo_StreamFrame *frame, struct varjo_Session *session, void *userData)
Camera frame stream callback function.
Definition: Varjo_types_datastream.h:224
varjo_LockDataStreamBuffer
void varjo_LockDataStreamBuffer(struct varjo_Session *session, varjo_BufferId id)
Lock a data stream buffer for reading.
varjo_ChannelIndex
int64_t varjo_ChannelIndex
Values for indexing buffers and settings of data streams.
Definition: Varjo_types_datastream.h:30