FFmpeg
Data Structures | Functions
queue.c File Reference
#include <stdio.h>
#include "queue.h"
#include "libavutil/mem.h"
#include "libavutil/avassert.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 40 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 48 of file queue.c.

Referenced by 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 73 of file queue.c.

Referenced by ff_dnn_free_model_ov(), 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 94 of file queue.c.

Referenced by execute_model_ov(), ff_dnn_get_async_result_ov(), 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 102 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 110 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 131 of file queue.c.

Referenced by extract_inference_from_task(), ff_dnn_execute_model_async_ov(), and ff_safe_queue_push_back().

◆ 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 152 of file queue.c.

Referenced by ff_dnn_free_model_ov(), ff_dnn_get_async_result_ov(), ff_safe_queue_pop_front(), and fill_model_input_ov().

◆ 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 173 of file queue.c.