From patchwork Fri May 20 15:23:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 35851 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:9992:b0:82:461d:f3b with SMTP id ve18csp655277pzb; Fri, 20 May 2022 08:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtuD13EHBLCU6bIxRddsx4SGugGGbq+JpVSKwnt08Pm0zAytJWQTv7K9aVVqUn+VyMV7/Z X-Received: by 2002:a17:907:c12:b0:6fe:22bb:7a0 with SMTP id ga18-20020a1709070c1200b006fe22bb07a0mr9398323ejc.450.1653060219946; Fri, 20 May 2022 08:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653060219; cv=none; d=google.com; s=arc-20160816; b=jlTyDHVhAv1N1Cnc6xl3GV8x/4lQ45KLvQR2rdXClhb8dYeyYAmsr8DukOyz7/als0 E+PH5TpfqovKCwbeg4BW5wWP2Ha0qaC4P+ten9UyOO4tX/w1VPD4PNWr/Fb5XhFODb4U g56AYNbdbbdtvWCIMH87liJtWmRgit+Pc0lyutbt9b6fE8dYgv1aubupzBuIDiQd5QwR ASKCGwsn+k/fp77/VkYPPUslifDN5/SSbpKISZm48hUVbmmMIRF6dLG1F9+AJVQqrVK4 DI1tUj7b43U6cXoLoH+FxYw5bTFlUkA0kxxCKE2x9547/KRv6tYbGtOmQSYHEck90LDZ P5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:mime-version:fcc:date:references :in-reply-to:message-id:from:dkim-signature:delivered-to; bh=q84tvawaUVDhU4Ics06877N5g4ROb00djbTvEFenwp0=; b=Gq84punAbMzctjcbkxY2+/yjr+CGSWIwvIXlpJmOIVJyLFss0VxA6BiDxEOq4caQnL G+pBWBN2f+WlixVwzQGy+g0RtAkyXrzcIMZ1KevK5mafOUG5hYAuaSXxED7MwJ4mJnhG rIwZwKFeGe7ITByvIc2THgHSvNrpXbvWyOoGO+7FSL7ucOcsy1a96Zd1HhRWd2Db5pID qZvGFsGgxTt8oz5ti0HRCo6or17/00mgRmTFzwvTajK05UHcQC3vzVavXwBkmUm7aeI5 kmUtzLAzAqBEMnUE5IvzvwcNVE0P5J8gTrm7fSPBHqI7KwOIppnKNa+cFWG4ZscY6nfY oYtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=KhQDqkug; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dn19-20020a17090794d300b006df76385bc2si1820602ejc.98.2022.05.20.08.23.39; Fri, 20 May 2022 08:23:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=KhQDqkug; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 87D3368B3C2; Fri, 20 May 2022 18:23:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B043068B3C2 for ; Fri, 20 May 2022 18:23:28 +0300 (EEST) Received: by mail-pg1-f172.google.com with SMTP id 137so8009756pgb.5 for ; Fri, 20 May 2022 08:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:in-reply-to:references:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=ccXVkGv8yifOq9Tr6pWd7GNRdHM6dZJFNR90vVHAgO8=; b=KhQDqkugkjItKXWd5uPLnRbUebDdK/2FNejJuLgHMkwUmY4k+k+Y1Mpg9FrJ7RGWkk xrhrrWeAKOrL8Vvc1Juu6QtvkcfgqUSCZRmVQA6KgAoN3NZU5cT39SfIn+90rEU5dAFo kHWmU83sBXhwCjKgBaG8rA9MW7QxQsHVl8QeGXhF9/8XBcq+DKE1q5AbAG3LHzNRjNkw o8I5sK9+WL5xI9RmRkn6C18Xw3xIXL9EscZv2Mg9DSlx4EfHJjh1p+F8zt6vSay0YITA 7B/kjt5mvvL8JmhVkUZDCopdCP1P1f8/O4DzHEkGxnkrszY5KswPgYRajM7FqwVFd95l a2rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:in-reply-to:references:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=ccXVkGv8yifOq9Tr6pWd7GNRdHM6dZJFNR90vVHAgO8=; b=nxr5iFD4gDPqO4uKc4YlujKxA2iSGGwutUMkAPy3gIW30Vkv7HQboRkxs+I5emxLOS VJVennXxa1W1EJ54IfmruNq2hMO4KLVZ9GSMD/f97mjghXRrfvzobI8S/Oa03qCbyGCw 5C1SL6y4qpLLiATHAzuCneXwriwA4GBIH29NZDUUSFjqhVJONIo23eJBEUI2l1q1+miy QqTZj3gX5LTzT58l8shDZsJ/DwszHfXmvdORYwSy71fCx8lxQXoc5Tvv60w7Z2zr9QzF 3IYysH4bOx29z7IwZyGUSUC1jiv5w1yV81AyK8wPAgNli9EK77m+eEDOL9FpzWEPZgv6 oX/g== X-Gm-Message-State: AOAM5339U9srzQujxTx4WycgcsisFEEMm7BLXVYh46SkK2r9Luj7/tHm ywHBXkfIkkN8cLroR1t+CIc2GbtFux/rfA== X-Received: by 2002:a62:b515:0:b0:50a:3d51:671e with SMTP id y21-20020a62b515000000b0050a3d51671emr10446410pfe.48.1653060206671; Fri, 20 May 2022 08:23:26 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id f23-20020a170902ab9700b0015e8d4eb26dsm5741859plr.183.2022.05.20.08.23.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 May 2022 08:23:25 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: In-Reply-To: References: Date: Fri, 20 May 2022 15:23:24 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2] avcodec/libx264: allow to disable definition of X264_API_IMPORTS macro X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: softworkz , Derek Buitenhuis , Timo Rothenpieler Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 0Fhl9AMCG8zA From: softworkz 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 --- 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 ## 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 @@ 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(-) base-commit: 41a558fea06cc0a23b8d2d0dfb03ef6a25cf5100 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