#include <clipqueue.h>
Public Member Functions | |
ClipQueue () | |
ClipQueue Constructor. More... | |
~ClipQueue () | |
ClipQueue Destructor. More... | |
void | lock () |
Lock queue mutex. More... | |
bool | tryLock () |
Try to lock queue mutex. More... | |
void | unlock () |
Unlock queue mutex. More... | |
void | append (AVFrame *frame) |
Add a frame to the end of the queue. More... | |
AVFrame * | at (int i) |
Retrieve a frame at a certain index. More... | |
AVFrame * | first () |
Retrieve first frame in the queue. More... | |
AVFrame * | last () |
Retrieve last frame in the queue. More... | |
void | removeFirst () |
Remove first frame in the queue. More... | |
void | removeLast () |
Remove last frame in the queue. More... | |
void | removeAt (int i) |
Remove frame in the queue at a certain index. More... | |
void | clear () |
Clear entire queue. More... | |
int | size () |
Retrieve current size of the queue. More... | |
bool | isEmpty () |
Returns whether the queue is empty of not. More... | |
bool | contains (AVFrame *frame) |
Returns whether the queue contains a frame or not. More... | |
Private Attributes | |
QVector< AVFrame * > | queue |
QMutex | queue_lock |
The ClipQueue class.
A fairly simple wrapper for a QVector and QMutex that cleans up AVFrames automatically when removing them.
ClipQueue::ClipQueue | ( | ) |
ClipQueue Constructor.
ClipQueue::~ClipQueue | ( | ) |
ClipQueue Destructor.
Automatically clears queue freeing any memory consumed by any AVFrames
void ClipQueue::append | ( | AVFrame * | frame | ) |
Add a frame to the end of the queue.
frame | The frame to add |
AVFrame * ClipQueue::at | ( | int | i | ) |
Retrieve a frame at a certain index.
i | Index to retrieve frame from |
AVFrame at this index
void ClipQueue::clear | ( | ) |
Clear entire queue.
Frees all memory occupied by all frames and clears the entire queue
bool ClipQueue::contains | ( | AVFrame * | frame | ) |
Returns whether the queue contains a frame or not.
TRUE if the queue contains the specified frame, FALSE if not.
AVFrame * ClipQueue::first | ( | ) |
Retrieve first frame in the queue.
The first AVFrame in the queue
bool ClipQueue::isEmpty | ( | ) |
Returns whether the queue is empty of not.
TRUE if the queue is empty and contains no frames, FALSE if not.
AVFrame * ClipQueue::last | ( | ) |
Retrieve last frame in the queue.
The last AVFrame in the queue
void ClipQueue::lock | ( | ) |
Lock queue mutex.
Used for multithreading to ensure queue is only accessed by one thread at a time. See QMutex::lock() for more information.
void ClipQueue::removeAt | ( | int | i | ) |
Remove frame in the queue at a certain index.
Frees all memory occupied by this frame and removes it from the queue
i | Index to remove a frame at |
void ClipQueue::removeFirst | ( | ) |
Remove first frame in the queue.
Frees all memory occupied by this frame and removes it from the queue
void ClipQueue::removeLast | ( | ) |
Remove last frame in the queue.
Frees all memory occupied by this frame and removes it from the queue
int ClipQueue::size | ( | ) |
Retrieve current size of the queue.
Current the current size of the queue. All indexes in the queue are guaranteed to be valid references to an AVFrame.
bool ClipQueue::tryLock | ( | ) |
Try to lock queue mutex.
Used for multithreading to ensure queue is only accessed by one thread at a time. Tries to lock, but doesn't block the calling thread and wait if it can't lock it. See QMutex::tryLock() for more information.
TRUE if the lock succeeded, FALSE if not.
void ClipQueue::unlock | ( | ) |
Unlock queue mutex.
Used for multithreading to ensure queue is only accessed by one thread at a time. See QMutex::unlock() for more information.
|
private |
|
private |