[FFmpeg-devel] [PATCH v6 3/3] avfilter: Make avpriv_open a library-internal function on msvcrt

softworkz ffmpegagent at gmail.com
Fri May 20 02:15:14 EEST 2022


From: softworkz <softworkz at hotmail.com>

This applies the same change for libavfilter as commit
e743e7ae6ee7e535c4394bec6fe6650d2b0dbf65 did for the other libraries.

Original commit message:

Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.

This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.

On systems not using msvcrt, the function is not duplicated.

Based-on-patch-by: Martin Storsjö <martin at martin.st>
Signed-off-by: softworkz <softworkz at hotmail.com>
---
 libavfilter/Makefile    | 1 +
 libavfilter/file_open.c | 1 +
 tests/ref/fate/source   | 1 +
 3 files changed, 3 insertions(+)
 create mode 100644 libavfilter/file_open.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ee2ea51e69..78ccfa37d3 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -23,6 +23,7 @@ OBJS = allfilters.o                                                     \
        version.o                                                        \
        video.o                                                          \
 
+OBJS-$(HAVE_LIBC_MSVCRT)                     += file_open.o
 OBJS-$(HAVE_THREADS)                         += pthread.o
 
 # subsystems
diff --git a/libavfilter/file_open.c b/libavfilter/file_open.c
new file mode 100644
index 0000000000..494a5d37a4
--- /dev/null
+++ b/libavfilter/file_open.c
@@ -0,0 +1 @@
+#include "libavutil/file_open.c"
diff --git a/tests/ref/fate/source b/tests/ref/fate/source
index 69dcdc4f27..16ea7ef9c1 100644
--- a/tests/ref/fate/source
+++ b/tests/ref/fate/source
@@ -8,6 +8,7 @@ libavcodec/reverse.c
 libavdevice/file_open.c
 libavdevice/reverse.c
 libavfilter/af_arnndn.c
+libavfilter/file_open.c
 libavfilter/log2_tab.c
 libavformat/file_open.c
 libavformat/golomb_tab.c
-- 
ffmpeg-codebot


More information about the ffmpeg-devel mailing list