FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
bufferqueue.h File Reference
#include "avfilter.h"
#include "libavutil/avassert.h"

Go to the source code of this file.

Data Structures

struct  FFBufQueue
 Structure holding the queue. More...
 

Macros

#define FF_BUFQUEUE_SIZE   64
 FFBufQueue: simple AVFrame queue API. More...
 
#define BUCKET(i)   queue->queue[(queue->head + (i)) % FF_BUFQUEUE_SIZE]
 

Functions

static int ff_bufqueue_is_full (struct FFBufQueue *queue)
 Test if a buffer queue is full. More...
 
static void ff_bufqueue_add (void *log, struct FFBufQueue *queue, AVFrame *buf)
 Add a buffer to the queue. More...
 
static AVFrameff_bufqueue_peek (struct FFBufQueue *queue, unsigned index)
 Get a buffer from the queue without altering it. More...
 
static AVFrameff_bufqueue_get (struct FFBufQueue *queue)
 Get the first buffer from the queue and remove it. More...
 
static void ff_bufqueue_discard_all (struct FFBufQueue *queue)
 Unref and remove all buffers from the queue. More...
 

Macro Definition Documentation

#define FF_BUFQUEUE_SIZE   64

FFBufQueue: simple AVFrame queue API.

Note: this API is not thread-safe. Concurrent access to the same queue must be protected by a mutex or any synchronization mechanism. Maximum size of the queue.

This value can be overridden by definying it before including this header. Powers of 2 are recommended.

Definition at line 40 of file bufferqueue.h.

Referenced by ff_bufqueue_get(), and ff_bufqueue_is_full().

#define BUCKET (   i)    queue->queue[(queue->head + (i)) % FF_BUFQUEUE_SIZE]

Definition at line 55 of file bufferqueue.h.

Referenced by ff_bufqueue_add(), and ff_bufqueue_peek().

Function Documentation

static int ff_bufqueue_is_full ( struct FFBufQueue queue)
inlinestatic

Test if a buffer queue is full.

Definition at line 60 of file bufferqueue.h.

Referenced by ff_bufqueue_add(), and ffat_encode().

static void ff_bufqueue_add ( void log,
struct FFBufQueue queue,
AVFrame buf 
)
inlinestatic

Add a buffer to the queue.

If the queue is already full, then the current last buffer is dropped (and unrefed) with a warning before adding the new buffer.

Definition at line 71 of file bufferqueue.h.

Referenced by ffat_encode(), ffat_encode_callback(), filter_frame(), opus_encode_frame(), opus_encode_init(), and vorbis_encode_frame().

static AVFrame* ff_bufqueue_peek ( struct FFBufQueue queue,
unsigned  index 
)
inlinestatic

Get a buffer from the queue without altering it.

Buffer with index 0 is the first buffer in the queue. Return NULL if the queue has not enough buffers.

Definition at line 87 of file bufferqueue.h.

Referenced by celt_frame_setup_input(), filter_frame(), opus_encode_init(), push_frame(), request_frame(), and step_collect_psy_metrics().

static AVFrame* ff_bufqueue_get ( struct FFBufQueue queue)
inlinestatic

Get the first buffer from the queue and remove it.

Do not use on an empty queue.

Definition at line 98 of file bufferqueue.h.

Referenced by celt_frame_setup_input(), ff_bufqueue_discard_all(), ffat_encode_callback(), filter_frame(), move_audio(), push_frame(), and request_frame().

static void ff_bufqueue_discard_all ( struct FFBufQueue queue)
inlinestatic

Unref and remove all buffers from the queue.

Definition at line 111 of file bufferqueue.h.

Referenced by ffat_close_encoder(), ffat_encode(), ffat_encode_flush(), opus_encode_end(), uninit(), and vorbis_encode_close().