FFmpegKit Linux API 6.0
Loading...
Searching...
No Matches
Typedefs | Functions
fftools_thread_queue.h File Reference

Go to the source code of this file.

Typedefs

typedef struct ThreadQueue ThreadQueue
 

Functions

ThreadQueuetq_alloc (unsigned int nb_streams, size_t queue_size, ObjPool *obj_pool, void(*obj_move)(void *dst, void *src))
 
void tq_free (ThreadQueue **tq)
 
int tq_send (ThreadQueue *tq, unsigned int stream_idx, void *data)
 
void tq_send_finish (ThreadQueue *tq, unsigned int stream_idx)
 
int tq_receive (ThreadQueue *tq, int *stream_idx, void *data)
 
void tq_receive_finish (ThreadQueue *tq, unsigned int stream_idx)
 

Typedef Documentation

◆ ThreadQueue

typedef struct ThreadQueue ThreadQueue

Definition at line 39 of file fftools_thread_queue.h.

Function Documentation

◆ 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_streamsnumber of streams for which a distinct EOF state is maintained
queue_sizenumber of items that can be stored in the queue without blocking
obj_poolobject pool that will be used to allocate items stored in the queue; the pool becomes owned by the queue
callbackthat moves the contents between two data pointers

Definition at line 93 of file fftools_thread_queue.c.

◆ tq_free()

void tq_free ( ThreadQueue **  tq)

Definition at line 69 of file fftools_thread_queue.c.

◆ tq_receive()

int tq_receive ( ThreadQueue tq,
int stream_idx,
void *  data 
)

Read the next item from the queue.

Parameters
stream_idxthe index of the stream that was processed or -1 will be written here
datathe 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()

void tq_receive_finish ( ThreadQueue tq,
unsigned int  stream_idx 
)

Mark the given stream finished from the receiving side.

Definition at line 246 of file fftools_thread_queue.c.

◆ tq_send()

int tq_send ( ThreadQueue tq,
unsigned int  stream_idx,
void *  data 
)

Send an item for the given stream to the queue.

Parameters
datathe 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()

void tq_send_finish ( ThreadQueue tq,
unsigned int  stream_idx 
)

Mark the given stream finished from the sending side.

Definition at line 231 of file fftools_thread_queue.c.