Varjo Native SDK
Varjo_datastream.h
Go to the documentation of this file.
1 // Copyright 2019-2022 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 
63 VARJO_API void varjo_StartDataStream(
64  struct varjo_Session* session, varjo_StreamId id, varjo_ChannelFlag channels, varjo_FrameListener* callback, void* userData);
65 
82 VARJO_API void varjo_StopDataStream(struct varjo_Session* session, varjo_StreamId id);
83 
102  struct varjo_Session* session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index);
103 
121 VARJO_API struct varjo_Matrix varjo_GetCameraExtrinsics(struct varjo_Session* session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index);
122 
141 VARJO_API varjo_BufferId varjo_GetBufferId(struct varjo_Session* session, varjo_StreamId id, int64_t frameNumber, varjo_ChannelIndex index);
142 
165 VARJO_API void varjo_LockDataStreamBuffer(struct varjo_Session* session, varjo_BufferId id);
166 
167 /*
168  * Unlock a previously locked data stream buffer.
169  *
170  * Unlock can be called from any thread (i.e. not necessarily from the frame callback thread).
171  *
172  * Possible errors:
173  * #varjo_Error_OperationFailed, #varjo_Error_NotAvailable, #varjo_Error_CapabilityNotAvailable,
174  * #varjo_Error_DataStreamBufferNotLocked, #varjo_Error_DataStreamBufferInvalidId
175  *
176  * @param session Varjo session handle.
177  * @param id Buffer ID.
178  */
179 VARJO_API void varjo_UnlockDataStreamBuffer(struct varjo_Session* session, varjo_BufferId id);
180 
195 VARJO_API struct varjo_BufferMetadata varjo_GetBufferMetadata(struct varjo_Session* session, varjo_BufferId id);
196 
211 VARJO_API struct varjo_Texture varjo_GetBufferGPUData(struct varjo_Session* session, varjo_BufferId id);
212 
227 VARJO_API void* varjo_GetBufferCPUData(struct varjo_Session* session, varjo_BufferId id);
228 
229 #if defined __cplusplus
230 }
231 #endif
232 #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:119
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:157
varjo_StreamConfig
Data stream configuration.
Definition: Varjo_types_datastream.h:129
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:145
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:512
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:330
varjo_StreamId
int64_t varjo_StreamId
Stream ID to identify a data stream configuration.
Definition: Varjo_types_datastream.h:114
varjo_ChannelFlag
uint64_t varjo_ChannelFlag
Bitfield for different data stream channels.
Definition: Varjo_types_datastream.h:16
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:258
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:31