FFmpeg
Data Structures | Functions
framepool.h File Reference
#include "libavutil/buffer.h"
#include "libavutil/frame.h"
#include "libavutil/internal.h"

Go to the source code of this file.

Data Structures

struct  FFFramePool
 Frame pool. More...
 

Functions

int ff_frame_pool_video_reinit (FFFramePool *pool, int width, int height, enum AVPixelFormat format, int align)
 Recreate the video frame pool if its current configuration differs from the provided configuration. More...
 
int ff_frame_pool_audio_reinit (FFFramePool *pool, int channels, int nb_samples, enum AVSampleFormat format, int align)
 Recreate the audio frame pool if its current configuration differs from the provided configuration. More...
 
void ff_frame_pool_uninit (FFFramePool *pool)
 Deallocate the frame pool. More...
 
AVFrameff_frame_pool_get (FFFramePool *pool)
 Allocate a new AVFrame, reusing old buffers from the pool when available. More...
 

Function Documentation

◆ ff_frame_pool_video_reinit()

int ff_frame_pool_video_reinit ( FFFramePool pool,
int  width,
int  height,
enum AVPixelFormat  format,
int  align 
)

Recreate the video frame pool if its current configuration differs from the provided configuration.

If initialization fails, the old pool is kept unchanged.

Parameters
poolpointer to the frame pool to be (re)initialized
widthwidth of each frame in this pool
heightheight of each frame in this pool
formatformat of each frame in this pool
alignbuffers alignment of each frame in this pool
Returns
0 on success, a negative AVERROR otherwise.

Definition at line 223 of file framepool.c.

Referenced by ff_default_get_video_buffer2(), and sws_frame_setup().

◆ ff_frame_pool_audio_reinit()

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

Recreate the audio frame pool if its current configuration differs from the provided configuration.

If initialization fails, the old pool is kept unchanged.

Parameters
poolpointer to the frame pool to be (re)initialized
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 alignment of each frame in this pool
Returns
0 on success, a negative AVERROR otherwise.

Definition at line 244 of file framepool.c.

Referenced by ff_default_get_audio_buffer().

◆ ff_frame_pool_uninit()

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 uninitialized

Definition at line 215 of file framepool.c.

Referenced by ff_frame_pool_audio_reinit(), ff_frame_pool_video_reinit(), frame_pool_audio_init(), frame_pool_video_init(), link_free(), and sws_freeContext().

◆ ff_frame_pool_get()

AVFrame* ff_frame_pool_get ( FFFramePool pool)

Allocate a new AVFrame, reusing 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 128 of file framepool.c.

Referenced by ff_default_get_audio_buffer(), and ff_default_get_video_buffer2().