vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
cQueue< T > Class Template Reference

Thread-safe queue class. More...

#include <queue.h>

Public Member Functions

 cQueue (size_t maxSize)
 
 ~cQueue (void)
 
bool Push (T *element)
 Push an element to the front of the queue.
 
T * Pop (void)
 Pop an element from the back of the queue.
 
T * Peek (void)
 Get a reference to the back element.
 
void Clear (void)
 Remove all elements from the queue.
 
bool IsEmpty (void)
 Check if the queue is empty.
 
bool IsFull (void)
 Check if the queue is full.
 
size_t Size (void)
 Get the current size of the queue.
 

Private Attributes

std::deque< T * > m_deque
 Underlying deque container.
 
std::mutex m_mutex
 Mutex for thread-safe access.
 
size_t m_maxSize
 Maximum queue capacity.
 

Detailed Description

template<typename T>
class cQueue< T >

Thread-safe queue class.

This class provides a thread-safe queue implementation using std::deque and std::mutex for synchronization. It supports both FIFO queue operations and bounded capacity management.

Template Parameters
TThe type of elements stored in the queue

Definition at line 35 of file queue.h.

Constructor & Destructor Documentation

◆ cQueue()

template<typename T >
cQueue< T >::cQueue ( size_t  maxSize)
inline

Definition at line 38 of file queue.h.

◆ ~cQueue()

template<typename T >
cQueue< T >::~cQueue ( void  )
inline

Definition at line 39 of file queue.h.

Member Function Documentation

◆ Clear()

template<typename T >
void cQueue< T >::Clear ( void  )
inline

Remove all elements from the queue.

Definition at line 95 of file queue.h.

References cQueue< T >::m_deque, and cQueue< T >::m_mutex.

Referenced by cVideoRender::ClearDecoderToDisplayQueue(), and cVideoRender::ClearPipDecoderToDisplayQueue().

◆ IsEmpty()

template<typename T >
bool cQueue< T >::IsEmpty ( void  )
inline

Check if the queue is empty.

Returns
true if queue is empty, false otherwise

Definition at line 106 of file queue.h.

References cQueue< T >::m_deque, and cQueue< T >::m_mutex.

Referenced by cFilterThread::Action(), cVideoStream::ClearVdrCoreToDecoderQueue(), cVideoStream::DecodeInput(), cVideoRender::DisplayFrame(), and cFilterThread::Stop().

◆ IsFull()

template<typename T >
bool cQueue< T >::IsFull ( void  )
inline

Check if the queue is full.

Returns
true if queue is full, false otherwise

Definition at line 117 of file queue.h.

References cQueue< T >::m_deque, cQueue< T >::m_maxSize, and cQueue< T >::m_mutex.

Referenced by cFilterThread::Action(), cVideoStream::DecodeInput(), cFilterThread::IsInputBufferFull(), and cVideoRender::IsOutputBufferFull().

◆ Peek()

template<typename T >
T * cQueue< T >::Peek ( void  )
inline

Get a reference to the back element.

Returns
T Element at the back (next to be popped), or nullptr if queue is empty

Definition at line 82 of file queue.h.

References cQueue< T >::m_deque, and cQueue< T >::m_mutex.

Referenced by cVideoStream::DecodeInput(), and cVideoStream::OpenDecoder().

◆ Pop()

template<typename T >
T * cQueue< T >::Pop ( void  )
inline

Pop an element from the back of the queue.

Returns
T The popped element, or nullptr if queue is empty

Definition at line 64 of file queue.h.

References cQueue< T >::m_deque, and cQueue< T >::m_mutex.

Referenced by cFilterThread::Action(), cVideoStream::ClearVdrCoreToDecoderQueue(), cVideoStream::DecodeInput(), cVideoRender::DisplayFrame(), cVideoStream::OpenDecoder(), and cFilterThread::Stop().

◆ Push()

template<typename T >
bool cQueue< T >::Push ( T *  element)
inline

Push an element to the front of the queue.

Parameters
elementThe element to push
Returns
true if successfully pushed, false if queue is full

Definition at line 47 of file queue.h.

References cQueue< T >::m_deque, cQueue< T >::m_maxSize, and cQueue< T >::m_mutex.

Referenced by cVideoStream::Flush(), cVideoStream::PushAvPacket(), cFilterThread::PushFrame(), and cVideoRender::PushFrame().

◆ Size()

template<typename T >
size_t cQueue< T >::Size ( void  )
inline

Get the current size of the queue.

Returns
Number of elements currently in the queue

Definition at line 128 of file queue.h.

References cQueue< T >::m_deque, and cQueue< T >::m_mutex.

Referenced by cVideoStream::ClearVdrCoreToDecoderQueue(), cVideoStream::GetAvPacketsFilled(), cVideoRender::GetFramesFilled(), cVideoStream::IsInputBufferFull(), and cVideoRender::LogDroppedDuped().

Member Data Documentation

◆ m_deque

template<typename T >
std::deque<T*> cQueue< T >::m_deque
private

◆ m_maxSize

template<typename T >
size_t cQueue< T >::m_maxSize
private

Maximum queue capacity.

Definition at line 137 of file queue.h.

Referenced by cQueue< T >::IsFull(), and cQueue< T >::Push().

◆ m_mutex

template<typename T >
std::mutex cQueue< T >::m_mutex
private

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