Go to the source code of this file.
|
void | tq_free (ThreadQueue **ptq) |
|
ThreadQueue * | tq_alloc (unsigned int nb_streams, size_t queue_size, ObjPool *obj_pool, void(*obj_move)(void *dst, void *src)) |
|
int | tq_send (ThreadQueue *tq, unsigned int stream_idx, void *data) |
|
static int | receive_locked (ThreadQueue *tq, int *stream_idx, void *data) |
|
int | tq_receive (ThreadQueue *tq, int *stream_idx, void *data) |
|
void | tq_send_finish (ThreadQueue *tq, unsigned int stream_idx) |
|
void | tq_receive_finish (ThreadQueue *tq, unsigned int stream_idx) |
|
◆ FifoElem
◆ anonymous enum
◆ receive_locked()
◆ tq_alloc()
ThreadQueue * tq_alloc |
( |
unsigned int |
nb_streams, |
|
|
size_t |
queue_size, |
|
|
ObjPool * |
obj_pool, |
|
|
void(*)(void *dst, void *src) |
obj_move |
|
) |
| |
Allocate a queue for sending data between threads.
- Parameters
-
nb_streams | number of streams for which a distinct EOF state is maintained |
queue_size | number of items that can be stored in the queue without blocking |
obj_pool | object pool that will be used to allocate items stored in the queue; the pool becomes owned by the queue |
callback | that moves the contents between two data pointers |
Definition at line 93 of file fftools_thread_queue.c.
◆ tq_free()
◆ tq_receive()
Read the next item from the queue.
- Parameters
-
stream_idx | the index of the stream that was processed or -1 will be written here |
data | the data item will be written here on success using the callback provided to tq_alloc() |
- Returns
- 0 a data item was successfully read; *stream_idx contains a non-negative stream index
- AVERROR_EOF When *stream_idx is non-negative, this signals that the sending side has marked the given stream as finished. This will happen at most once for each stream. When *stream_idx is -1, all streams are done.
Definition at line 205 of file fftools_thread_queue.c.
◆ tq_receive_finish()
◆ tq_send()
Send an item for the given stream to the queue.
- Parameters
-
data | the item to send, its contents will be moved using the callback provided to tq_alloc(); on failure the item will be left untouched |
- Returns
- 0 the item was successfully sent
- AVERROR(ENOMEM) could not allocate an item for writing to the FIFO
- AVERROR(EINVAL) the sending side has previously been marked as finished
- AVERROR_EOF the receiving side has marked the given stream as finished
Definition at line 134 of file fftools_thread_queue.c.
◆ tq_send_finish()