FFmpeg
Enumerations | Functions
thread_queue.h File Reference
#include <string.h>

Go to the source code of this file.

Enumerations

 

Functions

ThreadQueuetq_alloc (unsigned int nb_streams, size_t queue_size, enum ThreadQueueType type)
  Allocate a queue for sending data between threads. More...
 
void  tq_free (ThreadQueue **tq)
 
int  tq_send (ThreadQueue *tq, unsigned int stream_idx, void *data)
  Send an item for the given stream to the queue. More...
 
void  tq_send_finish (ThreadQueue *tq, unsigned int stream_idx)
  Mark the given stream finished from the sending side. More...
 
void  tq_choke (ThreadQueue *tq, int choked)
  Prevent further reads from the thread queue until it is unchoked. More...
 
int  tq_receive (ThreadQueue *tq, int *stream_idx, void *data)
  Read the next item from the queue. More...
 
void  tq_receive_finish (ThreadQueue *tq, unsigned int stream_idx)
  Mark the given stream finished from the receiving side. More...
 

Enumeration Type Documentation

ThreadQueueType

Enumerator
THREAD_QUEUE_FRAMES 
THREAD_QUEUE_PACKETS 

Definition at line 24 of file thread_queue.h.

Function Documentation

tq_alloc()

ThreadQueue* tq_alloc ( unsigned int  nb_streams,
size_t  queue_size,
enum ThreadQueueType  type 
)

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

Definition at line 72 of file thread_queue.c.

Referenced by queue_alloc().

tq_free()

void tq_free ( ThreadQueue **  tq )

Definition at line 54 of file thread_queue.c.

Referenced by sch_free(), sch_remove_filtergraph(), and tq_alloc().

tq_send()

int tq_send ( ThreadQueuetq,
unsigned int  stream_idx,
void *  data 
)

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 117 of file thread_queue.c.

Referenced by demux_flush(), demux_stream_send_to_dst(), enc_send_to_dst(), mux_task_start(), sch_mux_sub_heartbeat(), send_to_enc_thread(), send_to_filter(), and send_to_mux().

tq_send_finish()

void tq_send_finish ( ThreadQueuetq,
unsigned int  stream_idx 
)

Mark the given stream finished from the sending side.

Definition at line 227 of file thread_queue.c.

Referenced by demux_stream_send_to_dst(), enc_send_to_dst(), mux_task_start(), send_to_enc_thread(), send_to_filter(), and send_to_mux().

tq_choke()

void tq_choke ( ThreadQueuetq,
int  choked 
)

Prevent further reads from the thread queue until it is unchoked.

Threads attempting to read from the queue will block, similar to when the queue is empty.

Parameters
choked 1 to choke, 0 to unchoke

Definition at line 258 of file thread_queue.c.

Referenced by choke_demux().

tq_receive()

int tq_receive ( ThreadQueuetq,
int *  stream_idx,
void *  data 
)

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 197 of file thread_queue.c.

Referenced by sch_dec_receive(), sch_enc_receive(), sch_filter_receive(), and sch_mux_receive().

tq_receive_finish()

void tq_receive_finish ( ThreadQueuetq,
unsigned int  stream_idx 
)

Mark the given stream finished from the receiving side.

Definition at line 243 of file thread_queue.c.

Referenced by dec_done(), enc_done(), filter_done(), mux_done(), sch_filter_receive_finish(), and sch_mux_receive_finish().


Generated on Wed Nov 19 2025 19:23:37 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /