VLC
4.0.0-dev
|
Thread-safe block queue functions. More...
![]() |
Macros | |
#define | vlc_fifo_CleanupPush(fifo) vlc_cleanup_push(vlc_fifo_Cleanup, fifo) |
Typedefs | |
typedef struct block_fifo_t | vlc_fifo_t |
Functions | |
block_fifo_t * | block_FifoNew (void) |
Creates a thread-safe FIFO queue of blocks. More... | |
void | block_FifoRelease (block_fifo_t *) |
Destroys a FIFO created by block_FifoNew(). More... | |
block_t * | block_FifoGet (block_fifo_t *) |
Dequeue the first block from the FIFO. More... | |
block_t * | block_FifoShow (block_fifo_t *) |
Peeks the first block in the FIFO. More... | |
static vlc_queue_t * | vlc_fifo_queue (const vlc_fifo_t *fifo) |
static void | vlc_fifo_Lock (vlc_fifo_t *fifo) |
Locks a block FIFO. More... | |
static void | vlc_fifo_Unlock (vlc_fifo_t *fifo) |
Unlocks a block FIFO. More... | |
static void | vlc_fifo_Signal (vlc_fifo_t *fifo) |
Wakes up one thread waiting on the FIFO, if any. More... | |
static void | vlc_fifo_Wait (vlc_fifo_t *fifo) |
Waits on the FIFO. More... | |
static void | vlc_fifo_WaitCond (vlc_fifo_t *fifo, vlc_cond_t *condvar) |
void | vlc_fifo_QueueUnlocked (vlc_fifo_t *fifo, block_t *) |
Queues a linked-list of blocks into a locked FIFO. More... | |
block_t * | vlc_fifo_DequeueUnlocked (vlc_fifo_t *) |
Dequeues the first block from a locked FIFO, if any. More... | |
block_t * | vlc_fifo_DequeueAllUnlocked (vlc_fifo_t *) |
Dequeues the all blocks from a locked FIFO. More... | |
size_t | vlc_fifo_GetCount (const vlc_fifo_t *) |
Counts blocks in a FIFO. More... | |
size_t | vlc_fifo_GetBytes (const vlc_fifo_t *) |
Counts bytes in a FIFO. More... | |
static bool | vlc_fifo_IsEmpty (const vlc_fifo_t *fifo) |
static void | vlc_fifo_Cleanup (void *fifo) |
static void | block_FifoEmpty (block_fifo_t *fifo) |
Clears all blocks in a FIFO. More... | |
static void | block_FifoPut (block_fifo_t *fifo, block_t *block) |
Immediately queue one block at the end of a FIFO. More... | |
static size_t | block_FifoSize (block_fifo_t *fifo) |
static size_t | block_FifoCount (block_fifo_t *fifo) |
Thread-safe block queue functions.
#define vlc_fifo_CleanupPush | ( | fifo | ) | vlc_cleanup_push(vlc_fifo_Cleanup, fifo) |
Referenced by block_FifoGet().
typedef struct block_fifo_t vlc_fifo_t |
|
inlinestatic |
References vlc_fifo_GetCount(), vlc_fifo_Lock(), and vlc_fifo_Unlock().
Referenced by sout_MuxDeleteStream(), and sout_MuxGetStream().
|
inlinestatic |
Clears all blocks in a FIFO.
References block_ChainRelease(), vlc_fifo_queue(), and vlc_queue_DequeueAll().
Referenced by block_FifoRelease(), and sout_MuxFlush().
block_t* block_FifoGet | ( | block_fifo_t * | ) |
Dequeue the first block from the FIFO.
If necessary, wait until there is one block in the queue. This function is (always) cancellation point.
References vlc_cleanup_pop, vlc_fifo_CleanupPush, vlc_fifo_DequeueUnlocked(), vlc_fifo_IsEmpty(), vlc_fifo_Lock(), vlc_fifo_Unlock(), vlc_fifo_Wait(), and vlc_testcancel().
Referenced by block_ChainGather().
block_fifo_t* block_FifoNew | ( | void | ) |
Creates a thread-safe FIFO queue of blocks.
See also block_FifoPut() and block_FifoGet(). The created queue must be released with block_FifoRelease().
References block_fifo_t::i_depth, block_fifo_t::i_size, likely, block_fifo_t::q, and vlc_queue_Init().
Referenced by block_ChainGather(), CreateDecoder(), and sout_MuxAddStream().
|
inlinestatic |
Immediately queue one block at the end of a FIFO.
fifo | queue |
block | head of a block list to queue (may be NULL) |
References VLC_DEPRECATED, vlc_fifo_Lock(), vlc_fifo_QueueUnlocked(), vlc_fifo_Unlock(), and VLC_USED.
Referenced by DecoderPlayCc(), and sout_MuxSendBuffer().
void block_FifoRelease | ( | block_fifo_t * | ) |
Destroys a FIFO created by block_FifoNew().
References block_FifoEmpty().
Referenced by block_ChainGather(), DeleteDecoder(), sout_MuxAddStream(), and sout_MuxDeleteStream().
block_t* block_FifoShow | ( | block_fifo_t * | ) |
Peeks the first block in the FIFO.
References vlc_queue::first, block_fifo_t::q, vlc_fifo_Lock(), and vlc_fifo_Unlock().
Referenced by block_ChainGather(), and sout_MuxGetStream().
|
inlinestatic |
References VLC_DEPRECATED, vlc_fifo_GetBytes(), vlc_fifo_Lock(), vlc_fifo_Unlock(), and VLC_USED.
Referenced by vlc_input_decoder_GetFifoSize().
|
inlinestatic |
References vlc_fifo_Unlock().
block_t* vlc_fifo_DequeueAllUnlocked | ( | vlc_fifo_t * | ) |
Dequeues the all blocks from a locked FIFO.
This is equivalent to calling vlc_fifo_DequeueUnlocked() repeatedly until the FIFO is emptied, but this function is much faster.
References block_fifo_t::i_depth, block_fifo_t::i_size, block_fifo_t::q, and vlc_queue_DequeueAllUnlocked().
Referenced by vlc_fifo_WaitCond(), vlc_input_decoder_Decode(), and vlc_input_decoder_Flush().
block_t* vlc_fifo_DequeueUnlocked | ( | vlc_fifo_t * | ) |
Dequeues the first block from a locked FIFO, if any.
References block_t::i_buffer, block_fifo_t::i_depth, block_fifo_t::i_size, block_fifo_t::q, and vlc_queue_DequeueUnlocked().
Referenced by block_FifoGet(), DecoderThread(), and vlc_fifo_WaitCond().
size_t vlc_fifo_GetBytes | ( | const vlc_fifo_t * | ) |
Counts bytes in a FIFO.
Checks how many bytes are queued in a locked FIFO.
References block_fifo_t::i_size, vlc_queue::lock, block_fifo_t::q, and vlc_mutex_assert.
Referenced by block_FifoSize(), vlc_fifo_WaitCond(), and vlc_input_decoder_Decode().
size_t vlc_fifo_GetCount | ( | const vlc_fifo_t * | ) |
Counts blocks in a FIFO.
Checks how many blocks are queued in a locked FIFO.
References block_fifo_t::i_depth, vlc_queue::lock, block_fifo_t::q, and vlc_mutex_assert.
Referenced by block_FifoCount(), vlc_fifo_WaitCond(), and vlc_input_decoder_Decode().
|
inlinestatic |
References vlc_fifo_queue(), and vlc_queue_IsEmpty().
Referenced by block_FifoGet(), vlc_input_decoder_IsEmpty(), and vlc_input_decoder_Wait().
|
inlinestatic |
Locks a block FIFO.
No more than one thread can lock the FIFO at any given time, and no other thread can modify the FIFO while it is locked. vlc_fifo_Unlock() releases the lock.
References vlc_fifo_queue(), and vlc_queue_Lock().
Referenced by block_FifoCount(), block_FifoGet(), block_FifoPut(), block_FifoShow(), block_FifoSize(), CreateVoutIfNeeded(), DecoderThread(), ModuleThread_PlayVideo(), ModuleThread_UpdateAudioFormat(), vlc_input_decoder_ChangeDelay(), vlc_input_decoder_ChangePause(), vlc_input_decoder_ChangeRate(), vlc_input_decoder_Decode(), vlc_input_decoder_Delete(), vlc_input_decoder_Drain(), vlc_input_decoder_Flush(), vlc_input_decoder_FrameNext(), vlc_input_decoder_IsEmpty(), and vlc_input_decoder_Wait().
|
inlinestatic |
Referenced by block_FifoEmpty(), vlc_fifo_IsEmpty(), vlc_fifo_Lock(), vlc_fifo_Signal(), vlc_fifo_Unlock(), vlc_fifo_Wait(), and vlc_fifo_WaitCond().
void vlc_fifo_QueueUnlocked | ( | vlc_fifo_t * | fifo, |
block_t * | |||
) |
Queues a linked-list of blocks into a locked FIFO.
block | the head of the list of blocks (if NULL, this function has no effects) |
References block_t::i_buffer, block_fifo_t::i_depth, block_fifo_t::i_size, block_t::p_next, block_fifo_t::q, and vlc_queue_EnqueueUnlocked().
Referenced by block_FifoPut(), vlc_fifo_WaitCond(), and vlc_input_decoder_Decode().
|
inlinestatic |
Wakes up one thread waiting on the FIFO, if any.
References vlc_fifo_queue(), and vlc_queue_Signal().
Referenced by vlc_input_decoder_ChangePause(), vlc_input_decoder_Delete(), vlc_input_decoder_Drain(), vlc_input_decoder_Flush(), and vlc_input_decoder_FrameNext().
|
inlinestatic |
Unlocks a block FIFO.
The calling thread must have locked the FIFO previously with vlc_fifo_Lock(). Otherwise, the behaviour is undefined.
References vlc_fifo_queue(), and vlc_queue_Unlock().
Referenced by block_FifoCount(), block_FifoGet(), block_FifoPut(), block_FifoShow(), block_FifoSize(), CreateVoutIfNeeded(), DecoderThread(), ModuleThread_PlayVideo(), ModuleThread_UpdateAudioFormat(), vlc_fifo_Cleanup(), vlc_input_decoder_ChangeDelay(), vlc_input_decoder_ChangePause(), vlc_input_decoder_ChangeRate(), vlc_input_decoder_Decode(), vlc_input_decoder_Delete(), vlc_input_decoder_Drain(), vlc_input_decoder_Flush(), vlc_input_decoder_FrameNext(), vlc_input_decoder_IsEmpty(), and vlc_input_decoder_Wait().
|
inlinestatic |
Waits on the FIFO.
Atomically unlocks the FIFO and waits until one thread signals the FIFO, then locks the FIFO again. A signal can be sent by queueing a block to the previously empty FIFO or by calling vlc_fifo_Signal() directly. This function may also return spuriously at any moment.
References vlc_fifo_queue(), and vlc_queue_Wait().
Referenced by block_FifoGet(), and DecoderThread().
|
inlinestatic |