FFmpeg
Data Structures | Functions
queue.c File Reference
#include <stdio.h>
#include "queue.h"
#include "libavutil/mem.h"

Go to the source code of this file.

Data Structures

struct  QueueEntry
 
struct  Queue
 Linear double-ended data structure. More...
 

Functions

static QueueEntrycreate_entry (void *val)
 
Queueff_queue_create (void)
 Create a Queue instance. More...
 
void ff_queue_destroy (Queue *q)
 Destroy the Queue instance. More...
 
size_t ff_queue_size (Queue *q)
 Return the length of the Queue. More...
 
void * ff_queue_peek_front (Queue *q)
 Return a pointer to the data at the head of the queue. More...
 
void * ff_queue_peek_back (Queue *q)
 Return a pointer to the data at the tail of the queue. More...
 
int ff_queue_push_front (Queue *q, void *v)
 Add data to the head of the queue. More...
 
int ff_queue_push_back (Queue *q, void *v)
 Add data to the tail of the queue. More...
 
void * ff_queue_pop_front (Queue *q)
 Remove and free first element from the Queue. More...
 
void * ff_queue_pop_back (Queue *q)
 Remove and free last element from the Queue. More...
 

Function Documentation

◆ create_entry()

static QueueEntry* create_entry ( void *  val)
inlinestatic

Definition at line 39 of file queue.c.

Referenced by ff_queue_create(), ff_queue_push_back(), and ff_queue_push_front().

◆ ff_queue_create()

Queue* ff_queue_create ( void  )

Create a Queue instance.

It initializes the length of the Queue as 0.

Returns
Pointer to the Queue
Return values
NULLif allocation fails

Definition at line 47 of file queue.c.

Referenced by dnn_load_model_tf(), ff_safe_queue_create(), and init_model_ov().

◆ ff_queue_destroy()

void ff_queue_destroy ( Queue q)

Destroy the Queue instance.

It also frees all elements of the Queue.

Definition at line 72 of file queue.c.

Referenced by dnn_free_model_ov(), dnn_free_model_tf(), and ff_safe_queue_destroy().

◆ ff_queue_size()

size_t ff_queue_size ( Queue q)

◆ ff_queue_peek_front()

void* ff_queue_peek_front ( Queue q)

Return a pointer to the data at the head of the queue.

Return values
NULLif null pointer was passed or queue is empty

Definition at line 93 of file queue.c.

Referenced by execute_model_ov(), execute_model_tf(), ff_dnn_get_result_common(), and fill_model_input_ov().

◆ ff_queue_peek_back()

void* ff_queue_peek_back ( Queue q)

Return a pointer to the data at the tail of the queue.

Return values
NULLif null pointer was passed or queue is empty

Definition at line 101 of file queue.c.

◆ ff_queue_push_front()

int ff_queue_push_front ( Queue q,
void *  v 
)

Add data to the head of the queue.

It increases the length of Queue by one.

Parameters
qpointer to the Queue.
vdata to be added
Returns
The length of the Queue
Return values
0if the pointer to queue is NULL
-1if new entry cannot be created

Definition at line 109 of file queue.c.

Referenced by ff_safe_queue_push_front().

◆ ff_queue_push_back()

int ff_queue_push_back ( Queue q,
void *  v 
)

Add data to the tail of the queue.

It increases the length of Queue by one.

Parameters
qpointer to the Queue
vdata to be added
Returns
The length of the Queue
Return values
0if the pointer to queue is NULL
-1if new entry cannot be created

Definition at line 130 of file queue.c.

Referenced by dnn_execute_model_tf(), extract_lltask_from_task(), ff_safe_queue_push_back(), and get_output_ov().

◆ ff_queue_pop_front()

void* ff_queue_pop_front ( Queue q)

Remove and free first element from the Queue.

It shrinks the length of Queue by one.

Parameters
qpointer to the Queue.
Returns
The value of first element as void. If a null pointer or empty queue is passed, it returns NULL

Definition at line 151 of file queue.c.

Referenced by dnn_free_model_ov(), dnn_free_model_tf(), ff_dnn_get_result_common(), ff_safe_queue_pop_front(), fill_model_input_ov(), and fill_model_input_tf().

◆ ff_queue_pop_back()

void* ff_queue_pop_back ( Queue q)

Remove and free last element from the Queue.

It shrinks the length of Queue by one.

Parameters
qpointer to the Queue.
Returns
The value of last element as void. If a null pointer or empty queue is passed, it returns NULL

Definition at line 172 of file queue.c.