My Project
Queues of buffer headers

Typedefs

typedef struct MMAL_QUEUE_T MMAL_QUEUE_T
 

Functions

MMAL_QUEUE_Tmmal_queue_create (void)
 
void mmal_queue_put (MMAL_QUEUE_T *queue, MMAL_BUFFER_HEADER_T *buffer)
 
void mmal_queue_put_back (MMAL_QUEUE_T *queue, MMAL_BUFFER_HEADER_T *buffer)
 
MMAL_BUFFER_HEADER_Tmmal_queue_get (MMAL_QUEUE_T *queue)
 
MMAL_BUFFER_HEADER_Tmmal_queue_wait (MMAL_QUEUE_T *queue)
 
MMAL_BUFFER_HEADER_Tmmal_queue_timedwait (MMAL_QUEUE_T *queue, VCOS_UNSIGNED timeout)
 
unsigned int mmal_queue_length (MMAL_QUEUE_T *queue)
 
void mmal_queue_destroy (MMAL_QUEUE_T *queue)
 

Detailed Description

This provides a thread-safe implementation of a queue of buffer headers (MMAL_BUFFER_HEADER_T). The queue works in a first-in, first-out basis so the buffer headers will be dequeued in the order they have been queued.

Typedef Documentation

◆ MMAL_QUEUE_T

typedef struct MMAL_QUEUE_T MMAL_QUEUE_T

Definition at line 43 of file mmal_queue.h.

Function Documentation

◆ mmal_queue_create()

MMAL_QUEUE_T* mmal_queue_create ( void  )

Create a queue of MMAL_BUFFER_HEADER_T

Returns
Pointer to the newly created queue or NULL on failure.

◆ mmal_queue_destroy()

void mmal_queue_destroy ( MMAL_QUEUE_T queue)

Destroy a queue of MMAL_BUFFER_HEADER_T.

Parameters
queuePointer to a queue

◆ mmal_queue_get()

MMAL_BUFFER_HEADER_T* mmal_queue_get ( MMAL_QUEUE_T queue)

Get a MMAL_BUFFER_HEADER_T from a queue

Parameters
queuePointer to a queue
Returns
pointer to the next MMAL_BUFFER_HEADER_T or NULL if the queue is empty.

◆ mmal_queue_length()

unsigned int mmal_queue_length ( MMAL_QUEUE_T queue)

Get the number of MMAL_BUFFER_HEADER_T currently in a queue.

Parameters
queuePointer to a queue
Returns
length (in elements) of the queue.

◆ mmal_queue_put()

void mmal_queue_put ( MMAL_QUEUE_T queue,
MMAL_BUFFER_HEADER_T buffer 
)

Put a MMAL_BUFFER_HEADER_T into a queue

Parameters
queuePointer to a queue
bufferPointer to the MMAL_BUFFER_HEADER_T to add to the queue

◆ mmal_queue_put_back()

void mmal_queue_put_back ( MMAL_QUEUE_T queue,
MMAL_BUFFER_HEADER_T buffer 
)

Put a MMAL_BUFFER_HEADER_T back at the start of a queue. This is used when a buffer header was removed from the queue but not fully processed and needs to be put back where it was originally taken.

Parameters
queuePointer to a queue
bufferPointer to the MMAL_BUFFER_HEADER_T to add to the queue

◆ mmal_queue_timedwait()

MMAL_BUFFER_HEADER_T* mmal_queue_timedwait ( MMAL_QUEUE_T queue,
VCOS_UNSIGNED  timeout 
)

Wait for a MMAL_BUFFER_HEADER_T from a queue, up to a given timeout. This is the same as a wait, except that it will abort in case of timeout.

Parameters
queuePointer to a queue
timeoutNumber of milliseconds to wait before returning if the semaphore can't be acquired.
Returns
pointer to the next MMAL_BUFFER_HEADER_T.

◆ mmal_queue_wait()

MMAL_BUFFER_HEADER_T* mmal_queue_wait ( MMAL_QUEUE_T queue)

Wait for a MMAL_BUFFER_HEADER_T from a queue. This is the same as a get except that this will block until a buffer header is available.

Parameters
queuePointer to a queue
Returns
pointer to the next MMAL_BUFFER_HEADER_T.