avfilter/framepool: remove alloc argument

Not really needed by anything and makes this API a bit clunkier to extend.

Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
Niklas Haas
2026-03-24 18:29:56 +01:00
parent 82871857eb
commit 143b810e75
4 changed files with 16 additions and 28 deletions

View File

@@ -51,8 +51,8 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples)
int align = av_cpu_max_align();
if (!li->frame_pool) {
li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels,
nb_samples, link->format, align);
li->frame_pool = ff_frame_pool_audio_init(channels, nb_samples,
link->format, align);
if (!li->frame_pool)
return NULL;
} else {
@@ -71,8 +71,8 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples)
pool_format != link->format || pool_align != align) {
ff_frame_pool_uninit(&li->frame_pool);
li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels,
nb_samples, link->format, align);
li->frame_pool = ff_frame_pool_audio_init(channels, nb_samples,
link->format, align);
if (!li->frame_pool)
return NULL;
}

View File

@@ -49,8 +49,7 @@ struct FFFramePool {
};
av_cold FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
int width, int height,
av_cold FFFramePool *ff_frame_pool_video_init(int width, int height,
enum AVPixelFormat format,
int align)
{
@@ -97,7 +96,10 @@ av_cold FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size)
for (i = 0; i < 4 && sizes[i]; i++) {
if (sizes[i] > SIZE_MAX - align)
goto fail;
pool->pools[i] = av_buffer_pool_init(sizes[i] + align, alloc);
pool->pools[i] = av_buffer_pool_init(sizes[i] + align,
CONFIG_MEMORY_POISONING
? NULL
: av_buffer_allocz);
if (!pool->pools[i])
goto fail;
}
@@ -109,8 +111,7 @@ fail:
return NULL;
}
av_cold FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
int channels, int nb_samples,
av_cold FFFramePool *ff_frame_pool_audio_init(int channels, int nb_samples,
enum AVSampleFormat format,
int align)
{
@@ -137,7 +138,8 @@ av_cold FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size)
if (pool->linesize[0] > SIZE_MAX - align)
goto fail;
pool->pools[0] = av_buffer_pool_init(pool->linesize[0] + align, alloc);
pool->pools[0] = av_buffer_pool_init(pool->linesize[0] + align,
av_buffer_allocz);
if (!pool->pools[0])
goto fail;

View File

@@ -35,17 +35,13 @@ typedef struct FFFramePool FFFramePool;
/**
* Allocate and initialize a video frame pool.
*
* @param alloc a 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()).
* @param width width of each frame in this pool
* @param height height of each frame in this pool
* @param format format of each frame in this pool
* @param align buffers alignment of each frame in this pool
* @return newly created video frame pool on success, NULL on error.
*/
FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
int width,
FFFramePool *ff_frame_pool_video_init(int width,
int height,
enum AVPixelFormat format,
int align);
@@ -53,17 +49,13 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
/**
* Allocate and initialize an audio frame pool.
*
* @param alloc a 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()).
* @param channels channels of each frame in this pool
* @param nb_samples number of samples of each frame in this pool
* @param format format of each frame in this pool
* @param align buffers alignment of each frame in this pool
* @return newly created audio frame pool on success, NULL on error.
*/
FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
int channels,
FFFramePool *ff_frame_pool_audio_init(int channels,
int samples,
enum AVSampleFormat format,
int align);

View File

@@ -71,10 +71,7 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig
}
if (!li->frame_pool) {
li->frame_pool = ff_frame_pool_video_init(CONFIG_MEMORY_POISONING
? NULL
: av_buffer_allocz,
w, h, link->format, align);
li->frame_pool = ff_frame_pool_video_init(w, h, link->format, align);
if (!li->frame_pool)
return NULL;
} else {
@@ -89,10 +86,7 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig
pool_format != link->format || pool_align != align) {
ff_frame_pool_uninit(&li->frame_pool);
li->frame_pool = ff_frame_pool_video_init(CONFIG_MEMORY_POISONING
? NULL
: av_buffer_allocz,
w, h, link->format, align);
li->frame_pool = ff_frame_pool_video_init(w, h, link->format, align);
if (!li->frame_pool)
return NULL;
}