Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: softworkz <ffmpegagent@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: softworkz <softworkz@hotmail.com>,
	Derek Buitenhuis <derek.buitenhuis@gmail.com>,
	Timo Rothenpieler <timo@rothenpieler.org>
Subject: [FFmpeg-devel] [PATCH v2] avcodec/libx264: allow to disable definition of X264_API_IMPORTS macro
Date: Fri, 20 May 2022 15:23:24 +0000
Message-ID: <pull.29.v2.ffstaging.FFmpeg.1653060204841.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.29.ffstaging.FFmpeg.1653000752870.ffmpegagent@gmail.com>

From: softworkz <softworkz@hotmail.com>

When MSVC is used, the definition of X264_API_IMPORTS is
required for shared linking to libx264.dll, but it must
not be defined in case of statically linking to libx264.

Defining DISABLE_X264_API_IMPORTS allows to disable the
definition of X264_API_IMPORTS for those cases.

This has become necessary due to:

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

A better fix would eventually be this one:
http://ffmpeg.org/pipermail/ffmpeg-devel/2021-October/287426.html

But there has been disagreement and the issue stalled.

This patch is intended to be a stop-gap solution until
the mention fix will have been worked out.

Signed-off-by: softworkz <softworkz@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:
    
    v2 use custom macro for control, so there's no mechanism imposed and no
    change as long as that macro isn't explicitly defined

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

Range-diff vs v1:

 1:  640a17b84f ! 1:  bc86a3e903 avcodec/libx264: don't define X264_API_IMPORTS when compiling static
     @@ Metadata
      Author: softworkz <softworkz@hotmail.com>
      
       ## Commit message ##
     -    avcodec/libx264: don't define X264_API_IMPORTS when compiling static
     +    avcodec/libx264: allow to disable definition of X264_API_IMPORTS macro
      
     -    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:
     +    When MSVC is used, the definition of X264_API_IMPORTS is
     +    required for shared linking to libx264.dll, but it must
     +    not be defined in case of statically linking to libx264.
     +
     +    Defining DISABLE_X264_API_IMPORTS allows to disable the
     +    definition of X264_API_IMPORTS for those cases.
     +
     +    This has become necessary due to:
      
          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.
     +    A better fix would eventually be this one:
     +    http://ffmpeg.org/pipermail/ffmpeg-devel/2021-October/287426.html
     +
     +    But there has been disagreement and the issue stalled.
     +
     +    This patch is intended to be a stop-gap solution until
     +    the mention fix will have been worked out.
      
          Signed-off-by: softworkz <softworkz@hotmail.com>
      
     @@ libavcodec/libx264.c
       #include "sei.h"
       
      -#if defined(_MSC_VER)
     -+#if defined(_MSC_VER) && !defined(_LIB)
     ++#if defined(_MSC_VER) && !defined(DISABLE_X264_API_IMPORTS)
       #define X264_API_IMPORTS 1
       #endif
       


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

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ce3791ae8..adeaf0f52f 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(DISABLE_X264_API_IMPORTS)
 #define X264_API_IMPORTS 1
 #endif
 

base-commit: 41a558fea06cc0a23b8d2d0dfb03ef6a25cf5100
-- 
ffmpeg-codebot
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2022-05-20 15:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 22:52 [FFmpeg-devel] [PATCH] avcodec/libx264: don't define X264_API_IMPORTS when compiling static softworkz
2022-05-20  8:49 ` Derek Buitenhuis
2022-05-20  9:36   ` Soft Works
2022-05-20 10:18 ` Timo Rothenpieler
2022-05-20 10:39   ` Soft Works
2022-05-20 11:37     ` Timo Rothenpieler
2022-05-20 12:07       ` Soft Works
2022-05-20 12:49         ` Derek Buitenhuis
2022-05-20 12:51           ` Derek Buitenhuis
2022-05-20 12:54             ` Soft Works
2022-05-20 13:00               ` Derek Buitenhuis
2022-05-20 13:06                 ` Soft Works
2022-05-20 13:13                   ` Derek Buitenhuis
2022-05-20 13:24                     ` Soft Works
2022-05-20 13:14           ` Soft Works
2022-05-20 15:23 ` softworkz [this message]
2022-05-20 16:22   ` [FFmpeg-devel] [PATCH v2] avcodec/libx264: allow to disable definition of X264_API_IMPORTS macro Derek Buitenhuis
2022-05-20 16:34     ` Hendrik Leppkes
2022-05-20 16:37     ` Soft Works
2022-05-20 16:47       ` Derek Buitenhuis
2022-05-20 16:51         ` Martin Storsjö
2022-05-20 16:55           ` Derek Buitenhuis
2022-05-20 17:47             ` Soft Works

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.29.v2.ffstaging.FFmpeg.1653060204841.ffmpegagent@gmail.com \
    --to=ffmpegagent@gmail.com \
    --cc=derek.buitenhuis@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=softworkz@hotmail.com \
    --cc=timo@rothenpieler.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git