FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
framepool.c File Reference
#include "framepool.h"
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/pixfmt.h"

Go to the source code of this file.

Data Structures

struct  FFVideoFramePool
 Video frame pool. More...
 

Functions

FFVideoFramePoolff_video_frame_pool_init (AVBufferRef *(*alloc)(int size), int width, int height, enum AVPixelFormat format, int align)
 Allocate and initialize a video frame pool. More...
 
int ff_video_frame_pool_get_config (FFVideoFramePool *pool, int *width, int *height, enum AVPixelFormat *format, int *align)
 Get the video frame pool configuration. More...
 
AVFrameff_video_frame_pool_get (FFVideoFramePool *pool)
 Allocate a new AVFrame, reussing old buffers from the pool when available. More...
 
void ff_video_frame_pool_uninit (FFVideoFramePool **pool)
 Deallocate the video frame pool. More...
 

Function Documentation

FFVideoFramePool* ff_video_frame_pool_init ( AVBufferRef *(*)(int size alloc,
int  width,
int  height,
enum AVPixelFormat  format,
int  align 
)

Allocate and initialize a video frame pool.

Parameters
alloca function that will be used to allocate new frame buffers when the pool is empty. May be NULL, then the default allocator will be used (av_buffer_alloc()).
widthwidth of each frame in this pool
heightheight of each frame in this pool
formatformat of each frame in this pool
alignbuffers alignement of each frame in this pool
Returns
newly created video frame pool on success, NULL on error.

Definition at line 40 of file framepool.c.

Referenced by ff_default_get_video_buffer().

int ff_video_frame_pool_get_config ( FFVideoFramePool pool,
int *  width,
int *  height,
enum AVPixelFormat format,
int *  align 
)

Get the video frame pool configuration.

Parameters
widthwidth of each frame in this pool
heightheight of each frame in this pool
formatformat of each frame in this pool
alignbuffers alignement of each frame in this pool
Returns
0 on success, a negative AVERROR otherwise.

Definition at line 107 of file framepool.c.

Referenced by ff_default_get_video_buffer().

AVFrame* ff_video_frame_pool_get ( FFVideoFramePool pool)

Allocate a new AVFrame, reussing old buffers from the pool when available.

This function may be called simultaneously from multiple threads.

Returns
a new AVFrame on success, NULL on error.

Definition at line 125 of file framepool.c.

Referenced by ff_default_get_video_buffer().

void ff_video_frame_pool_uninit ( FFVideoFramePool **  pool)

Deallocate the video frame pool.

It is safe to call this function while some of the allocated video frame are still in use.

Parameters
poolpointer to the video frame pool to be freed. It will be set to NULL.

Definition at line 177 of file framepool.c.

Referenced by avfilter_link_free(), ff_default_get_video_buffer(), and ff_video_frame_pool_init().