[FFmpeg-devel] [PATCH] avcodec/libx264: don't define X264_API_IMPORTS when compiling static

softworkz ffmpegagent at gmail.com
Fri May 20 01:52:32 EEST 2022


From: softworkz <softworkz at hotmail.com>

The definition of X264_API_IMPORTS is required for shared linking
(when MSVC is used) but it must not be defined in case of static
builds as is stated in x264.h:

https://code.videolan.org/videolan/x264/-/blob/
bfc87b7a330f75f5c9a21e56081e4b20344f139e/x264.h#L63-67

This commit adds a check for the definition of _LIB which indicates
static linking.

Signed-off-by: softworkz <softworkz at hotmail.com>
---
    avcodec/libx264: don't define X264_API_IMPORTS when compiling static
    
    The definition of X264_API_IMPORTS is required for shared linking (when
    MSVC is used) but it must not be defined in case of static builds as is
    stated in x264.h:
    
    https://code.videolan.org/videolan/x264/-/blob/bfc87b7a330f75f5c9a21e56081e4b20344f139e/x264.h#L63-67

Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-29%2Fsoftworkz%2Fsubmit_x264_api_imports-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-29/softworkz/submit_x264_api_imports-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/29

 libavcodec/libx264.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ce3791ae8..2304bbb774 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -37,7 +37,7 @@
 #include "atsc_a53.h"
 #include "sei.h"
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(_LIB)
 #define X264_API_IMPORTS 1
 #endif
 

base-commit: 41a558fea06cc0a23b8d2d0dfb03ef6a25cf5100
-- 
ffmpeg-codebot


More information about the ffmpeg-devel mailing list