Jetson Inference
DNN Vision Library
gstBufferManager Class Reference

gstBufferManager recieves GStreamer buffers from appsink elements and unpacks/maps them into CUDA address space, and handles colorspace conversion into RGB format. More...

#include <gstBufferManager.h>

Public Member Functions

 gstBufferManager (videoOptions *options)
 Constructor. More...
 
 ~gstBufferManager ()
 Destructor. More...
 
bool Enqueue (GstBuffer *buffer, GstCaps *caps)
 Enqueue a GstBuffer from GStreamer. More...
 
int Dequeue (void **output, imageFormat format, uint64_t timeout=UINT64_MAX)
 Dequeue the next frame. More...
 
uint64_t GetLastTimestamp () const
 Get timestamp of the latest dequeued frame. More...
 
imageFormat GetRawFormat () const
 Get raw image format. More...
 
uint64_t GetFrameCount () const
 Get the total number of frames that have been recieved. More...
 

Protected Attributes

imageFormat mFormatYUV
 The YUV colorspace format coming from appsink (typically NV12 or YUY2) More...
 
RingBuffer mBufferYUV
 Ringbuffer of CPU-based YUV frames (non-NVMM) that come from appsink. More...
 
RingBuffer mTimestamps
 Ringbuffer of timestamps that come from appsink. More...
 
RingBuffer mBufferRGB
 Ringbuffer of frames that have been converted to RGB colorspace. More...
 
uint64_t mLastTimestamp
 Timestamp of the latest dequeued frame. More...
 
Event mWaitEvent
 Event that gets triggered when a new frame is recieved. More...
 
videoOptionsmOptions
 Options of the gstDecoder / gstCamera object. More...
 
uint64_t mFrameCount
 Total number of frames that have been recieved. More...
 
bool mNvmmUsed
 Is NVMM memory actually used by the stream? More...
 

Detailed Description

gstBufferManager recieves GStreamer buffers from appsink elements and unpacks/maps them into CUDA address space, and handles colorspace conversion into RGB format.

It can handle both normal CPU-based GStreamer buffers and NVMM memory which can be mapped directly to the GPU without requiring memory copies using the CPU.

To disable the use of NVMM memory, set -DENABLE_NVMM=OFF when building with CMake:

cmake -DENABLE_NVMM=OFF ../

Constructor & Destructor Documentation

◆ gstBufferManager()

gstBufferManager::gstBufferManager ( videoOptions options)

Constructor.

◆ ~gstBufferManager()

gstBufferManager::~gstBufferManager ( )

Destructor.

Member Function Documentation

◆ Dequeue()

int gstBufferManager::Dequeue ( void **  output,
imageFormat  format,
uint64_t  timeout = UINT64_MAX 
)

Dequeue the next frame.

Returns 1 on success, 0 on timeout, -1 on error.

◆ Enqueue()

bool gstBufferManager::Enqueue ( GstBuffer *  buffer,
GstCaps *  caps 
)

Enqueue a GstBuffer from GStreamer.

◆ GetFrameCount()

uint64_t gstBufferManager::GetFrameCount ( ) const
inline

Get the total number of frames that have been recieved.

◆ GetLastTimestamp()

uint64_t gstBufferManager::GetLastTimestamp ( ) const
inline

Get timestamp of the latest dequeued frame.

◆ GetRawFormat()

imageFormat gstBufferManager::GetRawFormat ( ) const
inline

Get raw image format.

Member Data Documentation

◆ mBufferRGB

RingBuffer gstBufferManager::mBufferRGB
protected

Ringbuffer of frames that have been converted to RGB colorspace.

◆ mBufferYUV

RingBuffer gstBufferManager::mBufferYUV
protected

Ringbuffer of CPU-based YUV frames (non-NVMM) that come from appsink.

◆ mFormatYUV

imageFormat gstBufferManager::mFormatYUV
protected

The YUV colorspace format coming from appsink (typically NV12 or YUY2)

◆ mFrameCount

uint64_t gstBufferManager::mFrameCount
protected

Total number of frames that have been recieved.

◆ mLastTimestamp

uint64_t gstBufferManager::mLastTimestamp
protected

Timestamp of the latest dequeued frame.

◆ mNvmmUsed

bool gstBufferManager::mNvmmUsed
protected

Is NVMM memory actually used by the stream?

◆ mOptions

videoOptions* gstBufferManager::mOptions
protected

Options of the gstDecoder / gstCamera object.

◆ mTimestamps

RingBuffer gstBufferManager::mTimestamps
protected

Ringbuffer of timestamps that come from appsink.

◆ mWaitEvent

Event gstBufferManager::mWaitEvent
protected

Event that gets triggered when a new frame is recieved.


The documentation for this class was generated from the following file: