This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch release/9.1
in repository ffmpeg.
The following commit(s) were added to refs/heads/release/9.1 by this push:
new c0b96fd9de avutil/framepool: provide a single copy for static builds
c0b96fd9de is described below
commit c0b96fd9debea70c0f1c057fe1b5183967fa66ee
Author: Michael Niedermayer <[email protected]>
AuthorDate: Mon Oct 26 15:16:52 2026 +0000
Commit: ffmpeg-devel <[email protected]>
CommitDate: Mon Oct 26 16:57:59 2026 +0000
avutil/framepool: provide a single copy for static builds
Both libavfilter and libswscale currently put framepool.o in their regular
OBJS, defining the same four ff_frame_pool_* symbols. Loading both static
archives in full therefore fails with multiple definitions.
Move the implementation and internal header to libavutil. Include the
object in its STLIBOBJS when either consumer is enabled, and use SHLIBOBJS
for the private copies in libavfilter and libswscale. This preserves
independent builds and shared-library symbol visibility without adding
an inter-library dependency or exposing a new public API.
Verified whole-archive links with both consumers, and with each consumer
configured independently. Shared builds pass fate-filter-rgbtestsrc-gbrp12
and fate-filter-rgbtestsrc-gbrap12; static and shared video scaling and
audio volume smoke tests produce identical frame checksums. Also checked
static consumers linked against shared dependencies.
Fixes: 6c89a30ecdad349a3e2b504401b01bd9d21eb21f
Fixes: #25419
Assisted-by: Fairy
(cherry picked from commit a3f1b1e87c8f485b189f0d68f082342d701eceb0)
---
libavfilter/Makefile | 3 +-
libavfilter/audio.c | 2 +-
libavfilter/avfilter.c | 2 +-
libavfilter/avfilter_internal.h | 3 +-
libavfilter/framepool.c | 244 +--------------------------------
libavfilter/video.c | 2 +-
libavutil/Makefile | 3 +-
{libavfilter => libavutil}/framepool.c | 16 +--
{libavfilter => libavutil}/framepool.h | 12 +-
libswscale/Makefile | 3 +-
libswscale/framepool.c | 2 +-
libswscale/swscale_internal.h | 2 +-
12 files changed, 26 insertions(+), 268 deletions(-)
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ef2542b98b..e00652e456 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -17,7 +17,6 @@ OBJS = allfilters.o
\
ccfifo.o \
drawutils.o \
formats.o \
- framepool.o \
framequeue.o \
graphdump.o \
graphparser.o \
@@ -672,7 +671,7 @@ OBJS-$(CONFIG_AMOVIE_FILTER) += src_movie.o
OBJS-$(CONFIG_MOVIE_FILTER) += src_movie.o
# Objects duplicated from other libraries for shared builds
-SHLIBOBJS += log2_tab.o
+SHLIBOBJS += framepool.o log2_tab.o
# Windows resource file
SHLIBOBJS-$(HAVE_GNU_WINDRES) += avfilterres.o
diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index 785dac9f59..d0512d465f 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -24,12 +24,12 @@
#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/eval.h"
+#include "libavutil/framepool.h"
#include "audio.h"
#include "avfilter.h"
#include "avfilter_internal.h"
#include "filters.h"
-#include "framepool.h"
const AVFilterPad ff_audio_default_filterpad[1] = {
{
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index d078e404ff..a13cea2287 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -27,6 +27,7 @@
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/frame.h"
+#include "libavutil/framepool.h"
#include "libavutil/hwcontext.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
@@ -41,7 +42,6 @@
#include "filters.h"
#include "formats.h"
#include "framequeue.h"
-#include "framepool.h"
#include "video.h"
static void tlog_ref(void *ctx, AVFrame *ref, int end)
diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h
index 3056b2edc3..66f2394ea0 100644
--- a/libavfilter/avfilter_internal.h
+++ b/libavfilter/avfilter_internal.h
@@ -27,9 +27,10 @@
#include <stdint.h>
+#include "libavutil/framepool.h"
+
#include "avfilter.h"
#include "filters.h"
-#include "framepool.h"
#include "framequeue.h"
typedef struct FilterLinkInternal {
diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 20dbb342b6..b1f4a9baae 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -1,8 +1,6 @@
/*
* This file is part of FFmpeg.
*
- * Copyright (c) 2015 Matthieu Bouron <matthieu.bouron stupeflix.com>
- *
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -18,244 +16,4 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#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"
-
-static av_cold int frame_pool_video_init(int width, int height,
- enum AVPixelFormat format,
- int align, FFFramePool *pool)
-{
- int ret;
-
- *pool = (FFFramePool) {
- .type = AVMEDIA_TYPE_VIDEO,
- .width = width,
- .height = height,
- .pix_fmt = format,
- .align = align,
- };
-
- if ((ret = av_image_check_size2(width, height, INT64_MAX, format, 0,
NULL)) < 0)
- goto fail;
-
- ret = av_image_fill_linesizes(pool->linesize, pool->pix_fmt,
- FFALIGN(pool->width, align));
- if (ret < 0)
- goto fail;
-
- for (int i = 0; i < 4 && pool->linesize[i]; i++)
- pool->linesize[i] = FFALIGN(pool->linesize[i], pool->align);
-
- ptrdiff_t linesizes[4];
- for (int i = 0; i < 4; i++)
- linesizes[i] = pool->linesize[i];
-
- size_t sizes[4];
- ret = av_image_fill_plane_sizes(sizes, pool->pix_fmt,
- FFALIGN(pool->height, align),
- linesizes);
- if (ret < 0)
- goto fail;
-
- for (int 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,
- CONFIG_MEMORY_POISONING
- ? NULL
- : av_buffer_allocz);
- if (!pool->pools[i]) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- }
-
- return 0;
-
-fail:
- ff_frame_pool_uninit(pool);
- return ret;
-}
-
-static av_cold int frame_pool_audio_init(int channels, int nb_samples,
- enum AVSampleFormat format,
- int align, FFFramePool *pool)
-{
- int ret;
-
- int planar = av_sample_fmt_is_planar(format);
-
- *pool = (FFFramePool) {
- .type = AVMEDIA_TYPE_AUDIO,
- .planes = planar ? channels : 1,
- .channels = channels,
- .nb_samples = nb_samples,
- .sample_fmt = format,
- .align = align,
- };
-
- ret = av_samples_get_buffer_size(&pool->linesize[0], channels,
- nb_samples, format, 0);
- if (ret < 0)
- goto fail;
-
- if (pool->linesize[0] > SIZE_MAX - align) {
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
- pool->pools[0] = av_buffer_pool_init(pool->linesize[0] + align,
- av_buffer_allocz);
- if (!pool->pools[0]) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- return 0;
-
-fail:
- ff_frame_pool_uninit(pool);
- return ret;
-}
-
-AVFrame *ff_frame_pool_get(FFFramePool *pool)
-{
- const AVPixFmtDescriptor *desc;
-
- AVFrame *frame = av_frame_alloc();
- if (!frame)
- return NULL;
-
- switch(pool->type) {
- case AVMEDIA_TYPE_VIDEO:
- desc = av_pix_fmt_desc_get(pool->pix_fmt);
- if (!desc)
- goto fail;
-
- frame->width = pool->width;
- frame->height = pool->height;
- frame->format = pool->pix_fmt;
-
- for (int i = 0; i < 4; i++) {
- frame->linesize[i] = pool->linesize[i];
- if (!pool->pools[i])
- break;
-
- frame->buf[i] = av_buffer_pool_get(pool->pools[i]);
- if (!frame->buf[i])
- goto fail;
-
- frame->data[i] = (uint8_t
*)FFALIGN((uintptr_t)frame->buf[i]->data, pool->align);
- }
-
- if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
- enum AVPixelFormat format = pool->pix_fmt;
- if (format == AV_PIX_FMT_PAL8)
- format = AV_PIX_FMT_BGR8;
-
- av_assert0(frame->data[1] != NULL);
- if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format)
< 0)
- goto fail;
- }
-
- frame->extended_data = frame->data;
- break;
- case AVMEDIA_TYPE_AUDIO:
- frame->nb_samples = pool->nb_samples;
- frame->ch_layout.nb_channels = pool->channels;
- frame->format = pool->sample_fmt;
- frame->linesize[0] = pool->linesize[0];
-
- if (pool->planes > AV_NUM_DATA_POINTERS) {
- frame->extended_data = av_calloc(pool->planes,
- sizeof(*frame->extended_data));
- frame->nb_extended_buf = pool->planes - AV_NUM_DATA_POINTERS;
- frame->extended_buf = av_calloc(frame->nb_extended_buf,
- sizeof(*frame->extended_buf));
- if (!frame->extended_data || !frame->extended_buf)
- goto fail;
- } else {
- frame->extended_data = frame->data;
- av_assert0(frame->nb_extended_buf == 0);
- }
-
- for (int i = 0; i < FFMIN(pool->planes, AV_NUM_DATA_POINTERS); i++) {
- frame->buf[i] = av_buffer_pool_get(pool->pools[0]);
- if (!frame->buf[i])
- goto fail;
- frame->extended_data[i] = frame->data[i] =
- (uint8_t *)FFALIGN((uintptr_t)frame->buf[i]->data,
pool->align);
- }
- for (int i = 0; i < frame->nb_extended_buf; i++) {
- frame->extended_buf[i] = av_buffer_pool_get(pool->pools[0]);
- if (!frame->extended_buf[i])
- goto fail;
- frame->extended_data[i + AV_NUM_DATA_POINTERS] =
- (uint8_t *)FFALIGN((uintptr_t)frame->extended_buf[i]->data,
pool->align);
- }
-
- break;
- default:
- av_unreachable("only audio and video frame pools exist");
- }
-
- return frame;
-fail:
- av_frame_free(&frame);
- return NULL;
-}
-
-av_cold void ff_frame_pool_uninit(FFFramePool *pool)
-{
- for (int i = 0; i < 4; i++)
- av_buffer_pool_uninit(&pool->pools[i]);
-
- memset(pool, 0, sizeof(*pool));
-}
-
-int ff_frame_pool_video_reinit(FFFramePool *pool,
- int width,
- int height,
- enum AVPixelFormat format,
- int align)
-{
- if (pool->type == AVMEDIA_TYPE_VIDEO &&
- pool->pix_fmt == format &&
- FFALIGN(pool->width, pool->align) == FFALIGN(width, align) &&
- FFALIGN(pool->height, pool->align) == FFALIGN(height, align) &&
- pool->align == align)
- {
- pool->width = width;
- pool->height = height;
- return 0;
- }
-
- ff_frame_pool_uninit(pool);
- return frame_pool_video_init(width, height, format, align, pool);
-}
-
-int ff_frame_pool_audio_reinit(FFFramePool *pool,
- int channels,
- int nb_samples,
- enum AVSampleFormat format,
- int align)
-{
- if (pool->type == AVMEDIA_TYPE_AUDIO &&
- pool->sample_fmt == format &&
- pool->channels == channels &&
- pool->nb_samples == nb_samples &&
- pool->align == align)
- {
- return 0;
- }
-
- ff_frame_pool_uninit(pool);
- return frame_pool_audio_init(channels, nb_samples, format, align, pool);
-}
+#include "libavutil/framepool.c"
diff --git a/libavfilter/video.c b/libavfilter/video.c
index 6e20794d43..3480c15091 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -25,13 +25,13 @@
#include "libavutil/buffer.h"
#include "libavutil/cpu.h"
+#include "libavutil/framepool.h"
#include "libavutil/hwcontext.h"
#include "libavutil/pixfmt.h"
#include "avfilter.h"
#include "avfilter_internal.h"
#include "filters.h"
-#include "framepool.h"
#include "video.h"
const AVFilterPad ff_video_default_filterpad[1] = {
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 737d98e56f..1f91fd5d17 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -228,11 +228,12 @@ OBJS-$(!CONFIG_VULKAN) +=
hwcontext_stub.o
OBJS += $(COMPAT_OBJS:%=../compat/%)
# Object files to satisfy dependencies of other libraries for static builds
+STLIBOBJS-$(CONFIG_AVFILTER) += framepool.o
STLIBOBJS-$(CONFIG_EXR_DECODER) += half2float.o float2half.o
STLIBOBJS-$(CONFIG_EXR_ENCODER) += float2half.o
STLIBOBJS-$(CONFIG_PHM_DECODER) += half2float.o
STLIBOBJS-$(CONFIG_PHM_ENCODER) += float2half.o
-STLIBOBJS-$(CONFIG_SWSCALE) += half2float.o
+STLIBOBJS-$(CONFIG_SWSCALE) += framepool.o half2float.o
# Windows resource file
SHLIBOBJS-$(HAVE_GNU_WINDRES) += avutilres.o
diff --git a/libavfilter/framepool.c b/libavutil/framepool.c
similarity index 96%
copy from libavfilter/framepool.c
copy to libavutil/framepool.c
index 20dbb342b6..3d2ab85451 100644
--- a/libavfilter/framepool.c
+++ b/libavutil/framepool.c
@@ -19,14 +19,14 @@
*/
#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"
+#include "avassert.h"
+#include "avutil.h"
+#include "buffer.h"
+#include "frame.h"
+#include "imgutils.h"
+#include "imgutils_internal.h"
+#include "mem.h"
+#include "pixfmt.h"
static av_cold int frame_pool_video_init(int width, int height,
enum AVPixelFormat format,
diff --git a/libavfilter/framepool.h b/libavutil/framepool.h
similarity index 94%
rename from libavfilter/framepool.h
rename to libavutil/framepool.h
index 64826aecdb..a11093fe41 100644
--- a/libavfilter/framepool.h
+++ b/libavutil/framepool.h
@@ -18,12 +18,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVFILTER_FRAMEPOOL_H
-#define AVFILTER_FRAMEPOOL_H
+#ifndef AVUTIL_FRAMEPOOL_H
+#define AVUTIL_FRAMEPOOL_H
-#include "libavutil/buffer.h"
-#include "libavutil/frame.h"
-#include "libavutil/internal.h"
+#include "buffer.h"
+#include "frame.h"
+#include "internal.h"
/**
* Frame pool. This structure must be initialized with
@@ -106,4 +106,4 @@ void ff_frame_pool_uninit(FFFramePool *pool);
AVFrame *ff_frame_pool_get(FFFramePool *pool);
-#endif /* AVFILTER_FRAMEPOOL_H */
+#endif /* AVUTIL_FRAMEPOOL_H */
diff --git a/libswscale/Makefile b/libswscale/Makefile
index 4c12c888c6..7db08ef966 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -12,7 +12,6 @@ OBJS = alphablend.o \
hscale_fast_bilinear.o \
filters.o \
format.o \
- framepool.o \
gamma.o \
graph.o \
input.o \
@@ -44,7 +43,7 @@ include $(SRC_PATH)/libswscale/vulkan/Makefile
endif
# Objects duplicated from other libraries for shared builds
-SHLIBOBJS += log2_tab.o half2float.o
+SHLIBOBJS += framepool.o log2_tab.o half2float.o
# Windows resource file
SHLIBOBJS-$(HAVE_GNU_WINDRES) += swscaleres.o
diff --git a/libswscale/framepool.c b/libswscale/framepool.c
index 2d6bcb15de..b1f4a9baae 100644
--- a/libswscale/framepool.c
+++ b/libswscale/framepool.c
@@ -16,4 +16,4 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavfilter/framepool.c"
+#include "libavutil/framepool.c"
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index ac75cff04e..f3435be1a0 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -28,10 +28,10 @@
#include "swscale.h"
#include "graph.h"
-#include "libavfilter/framepool.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/frame.h"
+#include "libavutil/framepool.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/mem_internal.h"
--
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]