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

Go to the source code of this file.

Functions

FFFramePoolff_frame_pool_video_init (AVBufferRef *(*alloc)(int size), int width, int height, enum AVPixelFormat format, int align)
 Allocate and initialize a video frame pool. More...
 
FFFramePoolff_frame_pool_audio_init (AVBufferRef *(*alloc)(int size), int channels, int samples, enum AVSampleFormat format, int align)
 Allocate and initialize an audio frame pool. More...
 
void ff_frame_pool_uninit (FFFramePool **pool)
 Deallocate the frame pool. More...
 
int ff_frame_pool_get_video_config (FFFramePool *pool, int *width, int *height, enum AVPixelFormat *format, int *align)
 Get the video frame pool configuration. More...
 
int ff_frame_pool_get_audio_config (FFFramePool *pool, int *channels, int *nb_samples, enum AVSampleFormat *format, int *align)
 Get the audio frame pool configuration. More...
 
AVFrameff_frame_pool_get (FFFramePool *pool)
 Allocate a new AVFrame, reussing old buffers from the pool when available. More...
 

Function Documentation

FFFramePool* ff_frame_pool_video_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 51 of file framepool.c.

Referenced by ff_default_get_video_buffer().

FFFramePool* ff_frame_pool_audio_init ( AVBufferRef *(*)(int size alloc,
int  channels,
int  samples,
enum AVSampleFormat  format,
int  align 
)

Allocate and initialize an audio 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()).
channelschannels of each frame in this pool
nb_samplesnumber of samples of each frame in this pool
formatformat of each frame in this pool
alignbuffers alignement of each frame in this pool
Returns
newly created audio frame pool on success, NULL on error.

Definition at line 119 of file framepool.c.

Referenced by ff_default_get_audio_buffer().

void ff_frame_pool_uninit ( FFFramePool **  pool)

Deallocate the frame pool.

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

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

Definition at line 284 of file framepool.c.

Referenced by avfilter_link_free(), ff_default_get_audio_buffer(), ff_default_get_video_buffer(), ff_frame_pool_audio_init(), and ff_frame_pool_video_init().

int ff_frame_pool_get_video_config ( FFFramePool 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 157 of file framepool.c.

Referenced by ff_default_get_video_buffer().

int ff_frame_pool_get_audio_config ( FFFramePool pool,
int channels,
int nb_samples,
enum AVSampleFormat format,
int align 
)

Get the audio frame pool configuration.

Parameters
channelschannels of each frame in this pool
nb_samplesnumber of samples 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 176 of file framepool.c.

Referenced by ff_default_get_audio_buffer().

AVFrame* ff_frame_pool_get ( FFFramePool 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 195 of file framepool.c.

Referenced by ff_default_get_audio_buffer(), and ff_default_get_video_buffer().