DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

GL Image Streamer

Detailed Description

Defines the GL image streamer function, enabling streaming images between different APIs.

Functions

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_consumerReceive (dwImageHandle_t *image, dwTime_t timeout_us, dwImageStreamerHandle_t streamer)
 Receive a pointer to a dwImageHandle_t from the streamer, acting as a consumer. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_consumerReturn (dwImageHandle_t *image, dwImageStreamerHandle_t streamer)
 Return the received image back to the producer. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_getCUDAStream (cudaStream_t *stream, dwImageStreamerHandle_t streamer)
 Get CUDA stream used by the image streamer. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_getOutputProperties (dwImageProperties *props, dwImageStreamerHandle_t streamer)
 Get image properties of the image received from the streamer. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_initialize (dwImageStreamerHandle_t *streamer, const dwImageProperties *from, dwImageType to, dwContextHandle_t ctx)
 Creates and initializes the image streamer capable of moving images between GL and different API types. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_initializeCrossProcess (dwImageStreamerHandle_t *streamer, const dwImageProperties *from, dwImageType to, dwImageStreamerCrossProcessModeParams params, dwContextHandle_t ctx)
 Creates and initializes the image streamer capable of moving images between GL and different API types across processes. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_producerReturn (dwImageHandle_t *image, dwTime_t timeout_us, dwImageStreamerHandle_t streamer)
 The producer streamer waits for the image sent to be returned by the consumer. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_producerSend (dwImageHandle_t image, dwImageStreamerHandle_t streamer)
 Sends an image through the streamer acting as the producer. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_release (dwImageStreamerHandle_t streamer)
 Releases the image streamer. More...
 
DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_setCUDAStream (cudaStream_t stream, dwImageStreamerHandle_t streamer)
 Sets the CUDA stream for CUDA related streaming operations such as post and receive. More...
 

Function Documentation

◆ dwImageStreamerGL_consumerReceive()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_consumerReceive ( dwImageHandle_t image,
dwTime_t  timeout_us,
dwImageStreamerHandle_t  streamer 
)

Receive a pointer to a dwImageHandle_t from the streamer, acting as a consumer.

Can wait until timeout before failing.

Parameters
[out]imageA pointer to a dwImageHandle_t sent by the producer, not null if successfully converted.
[in]timeout_usTimeout in milliseconds before interrupting the waiting for producer.
[in]streamerA handle to the image streamer.
Returns
DW_INVALID_HANDLE if the given streamer handle (consumer) is invalid,
DW_TIME_OUT if times out
or DW_SUCCESS otherwise.

◆ dwImageStreamerGL_consumerReturn()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_consumerReturn ( dwImageHandle_t image,
dwImageStreamerHandle_t  streamer 
)

Return the received image back to the producer.

Ownership is given back and image goes back to null

Parameters
[in]imageA pointer to the dwImageHandle_t to return to the producer.
[in]streamerA handle to the image streamer.
Returns
DW_INVALID_HANDLE if the given streamer handle (consumer) is invalid,
DW_INTERNAL_ERROR if the image has been received yet or an underlying error depending on the producer/consumer combination has occurred
or DW_SUCCESS otherwise.

◆ dwImageStreamerGL_getCUDAStream()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_getCUDAStream ( cudaStream_t *  stream,
dwImageStreamerHandle_t  streamer 
)

Get CUDA stream used by the image streamer.

Parameters
[out]streamCUDA stream used by the streamer
[in]streamerA handle to the image streamer.
Returns
DW_INVALID_HANDLE if the given context handle is invalid,
DW_NOT_SUPPORTED if the streamer does not work with CUDA images,
or DW_SUCCESS otherwise.
See also
dwImageStreamer_getCUDAStream

◆ dwImageStreamerGL_getOutputProperties()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_getOutputProperties ( dwImageProperties props,
dwImageStreamerHandle_t  streamer 
)

Get image properties of the image received from the streamer.

Parameters
[out]propsProperties of the resulting images
[in]streamerA handle to the image streamer.
Returns
DW_INVALID_HANDLE if the given context handle is invalid,
DW_SUCCESS if successful.
See also
dwImageStreamer_getOutputProperties

◆ dwImageStreamerGL_initialize()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_initialize ( dwImageStreamerHandle_t streamer,
const dwImageProperties from,
dwImageType  to,
dwContextHandle_t  ctx 
)

Creates and initializes the image streamer capable of moving images between GL and different API types.

For example an image can be moved from NvMedia API into GL textured type or from GL memory to CPU.

Parameters
[out]streamerA handle to the image streamer (if successfully initialized.)
[in]fromThe properties of the source image for streaming.
[in]toThe type of the destination image.
[in]ctxThe DriveWorks context.
Returns
DW_SUCCESS if the translator was created,
DW_INVALID_ARGUMENT if the given image types are invalid or the streamer pointer is null,
DW_INVALID_HANDLE if the given context handle is invalid,
DW_NOT_IMPLEMENTED if the desired streamer between given types is not implemented,
DW_NOT_AVAILABLE if the desired streamer between given two types is currently not available due to missing resources or non-initialized APIs,
DW_NOT_INITIALIZED if GL context has not been yet initialized, i.e. missing call to dwVisualizationInitialize()
or DW_NOT_SUPPORTED if the desired streamer cannot work with given pixel format or type.

◆ dwImageStreamerGL_initializeCrossProcess()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_initializeCrossProcess ( dwImageStreamerHandle_t streamer,
const dwImageProperties from,
dwImageType  to,
dwImageStreamerCrossProcessModeParams  params,
dwContextHandle_t  ctx 
)

Creates and initializes the image streamer capable of moving images between GL and different API types across processes.

Note
DW_IMAGE_STREAMER_CROSS_PROCESS_CONSUMER must be initialized before DW_IMAGE_STREAMER_CROSS_PROCESS_PRODUCER.
Parameters
[out]streamerA handle to the image streamer (if successfully initialized.)
[in]fromThe type of the source image and the expected image properties.
[in]toThe type of the destination image.
[in]paramsSpecifies the parameters for cross-process image streamer creation.
[in]ctxThe DriveWorks context.
Returns
DW_SUCCESS if the translator was created,
DW_INVALID_ARGUMENT if the given image types are invalid or the streamer pointer is null,
DW_INVALID_HANDLE if the given context handle is invalid,
DW_NOT_IMPLEMENTED if the desired streamer between given types is not implemented,
DW_NOT_AVAILABLE if the desired streamer between given two types is currently not available due to missing resources or non-initialized APIs,
or DW_NOT_SUPPORTED if the desired streamer cannot work with given pixel format or type.

◆ dwImageStreamerGL_producerReturn()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_producerReturn ( dwImageHandle_t image,
dwTime_t  timeout_us,
dwImageStreamerHandle_t  streamer 
)

The producer streamer waits for the image sent to be returned by the consumer.

Waits for a max timeout. Returns a pointer to the dwImageHandle of the returned image, if the pointer passed is not null, otherwise it does not return a pointer

Parameters
[out]imageA pointer to a dwImageHandle_t returned by the producer
[in]timeout_usTimeout in milliseconds before interrupting the waiting and return a timeout error. Image was not returned
[in]streamerA handle to the image streamer.
Returns
DW_INVALID_HANDLE if the given streamer handle (producer) is invalid,
DW_TIME_OUT if times out
or DW_SUCCESS otherwise.

◆ dwImageStreamerGL_producerSend()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_producerSend ( dwImageHandle_t  image,
dwImageStreamerHandle_t  streamer 
)

Sends an image through the streamer acting as the producer.

Note
The ownership of the image remains by the caller.
Parameters
[in]imageA dwImageHandle_t to send through the streamer
[in]streamerA handle to the image streamer.
Returns
DW_INVALID_HANDLE if the given streamer handle (producer) is invalid,
DW_INVALID_HANDLE if the dwImageType of the input image doesn't match the streamer's
DW_BUSY_WAITING if the image cannot be sent. Non fatal error, it is possible to retry
or DW_SUCCESS otherwise.

◆ dwImageStreamerGL_release()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_release ( dwImageStreamerHandle_t  streamer)

Releases the image streamer.

This releases all memory and closes all related resources. The handle is set to null.

Parameters
[in]streamerA handle to the image streamer.
Returns
DW_SUCCESS if successful.
See also
dwImageStreamer_release

◆ dwImageStreamerGL_setCUDAStream()

DW_VIZ_API_PUBLIC dwStatus dwImageStreamerGL_setCUDAStream ( cudaStream_t  stream,
dwImageStreamerHandle_t  streamer 
)

Sets the CUDA stream for CUDA related streaming operations such as post and receive.

Note
The ownership of the stream remains by the callee.
Parameters
[in]streamThe CUDA stream to be used. Default is 0.
[in]streamerA handle to the image streamer.
Returns
DW_INVALID_HANDLE if the given context handle is invalid,
DW_NOT_SUPPORTED if the streamer does not work with CUDA images,
or DW_SUCCESS otherwise.
See also
dwImageStreamer_setCUDAStream