FFmpeg
Functions
framepool.c File Reference
#include "framepool.h"
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/buffer.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/imgutils_internal.h"
#include "libavutil/mem.h"
#include "libavutil/pixfmt.h"

Go to the source code of this file.

Functions

static av_cold int frame_pool_video_init (int width, int height, enum AVPixelFormat format, int align, FFFramePool *pool)
 
static av_cold int frame_pool_audio_init (int channels, int nb_samples, enum AVSampleFormat format, int align, FFFramePool *pool)
 
AVFrameff_frame_pool_get (FFFramePool *pool)
 Allocate a new AVFrame, reusing old buffers from the pool when available. More...
 
av_cold void ff_frame_pool_uninit (FFFramePool *pool)
 Deallocate the frame pool. More...
 
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...
 

Function Documentation

◆ frame_pool_video_init()

static av_cold int frame_pool_video_init ( int  width,
int  height,
enum AVPixelFormat  format,
int  align,
FFFramePool pool 
)
static

Definition at line 31 of file framepool.c.

Referenced by ff_frame_pool_video_reinit().

◆ frame_pool_audio_init()

static av_cold int frame_pool_audio_init ( int  channels,
int  nb_samples,
enum AVSampleFormat  format,
int  align,
FFFramePool pool 
)
static

Definition at line 87 of file framepool.c.

Referenced by ff_frame_pool_audio_reinit().

◆ 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().

◆ ff_frame_pool_uninit()

av_cold 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_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 226 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 247 of file framepool.c.

Referenced by ff_default_get_audio_buffer().