Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Private Attributes | List of all members
ClipQueue Class Reference

The ClipQueue class. More...

#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
 

Detailed Description

The ClipQueue class.

A fairly simple wrapper for a QVector and QMutex that cleans up AVFrames automatically when removing them.

Constructor & Destructor Documentation

ClipQueue::ClipQueue ( )

ClipQueue Constructor.

ClipQueue::~ClipQueue ( )

ClipQueue Destructor.

Automatically clears queue freeing any memory consumed by any AVFrames

Member Function Documentation

void ClipQueue::append ( AVFrame *  frame)

Add a frame to the end of the queue.

Parameters
frameThe frame to add
AVFrame * ClipQueue::at ( int  i)

Retrieve a frame at a certain index.

Parameters
iIndex to retrieve frame from
Returns

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.

Returns

TRUE if the queue contains the specified frame, FALSE if not.

AVFrame * ClipQueue::first ( )

Retrieve first frame in the queue.

Returns

The first AVFrame in the queue

bool ClipQueue::isEmpty ( )

Returns whether the queue is empty of not.

Returns

TRUE if the queue is empty and contains no frames, FALSE if not.

AVFrame * ClipQueue::last ( )

Retrieve last frame in the queue.

Returns

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

Parameters
iIndex 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.

Returns

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.

Returns

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.

Member Data Documentation

QVector<AVFrame*> ClipQueue::queue
private
QMutex ClipQueue::queue_lock
private

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