From patchwork Mon Dec 4 23:31:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mateusz X-Patchwork-Id: 6547 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp4990607jah; Mon, 4 Dec 2017 15:31:52 -0800 (PST) X-Google-Smtp-Source: AGs4zMbeLYLwf5Q7YLE5ooFJYR+HywuUwv+pEQruP/B/YFPQDY+a0dNZsnXPb945rz/yal2+ygoc X-Received: by 10.223.135.59 with SMTP id a56mr14404823wra.173.1512430312841; Mon, 04 Dec 2017 15:31:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512430312; cv=none; d=google.com; s=arc-20160816; b=OaYRezQEHaXlnwFP6R1UQp3RJAYt8OcExUvvzzHug7+eO5kwWq52VWBl8C+D+a74Ib HhojoAeAMfvQSe3a5D3a3x7O4+XR2pVr9R70xYgQcli5wTgYGeVxCcYsKHbp9HD2zr5i KZqdQN0FTVM14dKNopCQ5Z7dJb14Wf4u8pmubyXmbGSSHz2fHs/UvasqIO1sQ60GT6O8 7SyKXsV1VejREw1iCxzJkM5D8woG2xqWmDH1amOqvusq/zWtgDIrKwfqSVvoa9SENsQ1 khuVVZZd22TFtgU2NGXhvqA9jngFWPD/Cjh0KWyexBVfdq3XqXQHRA0EHGAyXTOYdigD FcZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:dkim-signature :delivered-to:arc-authentication-results; bh=dS9nagIaKc4uWS2rbMPsf9EHM4LvyhajmXO3aCJoM9c=; b=lWnB32636RT8nkW0Bok7QU7K/vTn+Z+D/oey0qVPt01NzMb0nP4zlL5BWAb2Z4MgG2 ZSTNHXtJO5IO5Q2na+zQ4DfyAh5JxPwMKm4sf0ajwtb84bSUSGHPaDePxRlgRTNeXz9Z uFP9Vuu+zP3XvbIKe9OkVblSTpkDg4FtLAXQVqzcM4Z0v5mgcuntTiEt+4iUx6t9BUJR 5E8NMLjEva63CDenvj+uBrB+OWSSZ4WewwayRtoZ+qOAPS9yythU7r6ssvGmuulaiGFJ VWqXA2VpBaj0HrJC3LQHX3CrRLVqQihvMn1a5rf/kOhjCnaGi+tz2D52eLzplDPbuoF3 JQhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@poczta.onet.pl header.s=2011 header.b=seU39a++; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v8si2456943wmh.128.2017.12.04.15.31.51; Mon, 04 Dec 2017 15:31:52 -0800 (PST) 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=@poczta.onet.pl header.s=2011 header.b=seU39a++; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B552068A139; Tue, 5 Dec 2017 01:31:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpo96.poczta.onet.pl (smtpo99.poczta.onet.pl [213.180.149.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4EAFE68A08A for ; Tue, 5 Dec 2017 01:31:40 +0200 (EET) Received: from [192.168.1.2] (aent158.neoplus.adsl.tpnet.pl [79.191.97.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mateuszb@poczta.onet.pl) by smtp.poczta.onet.pl (Onet) with ESMTPSA id 3yrLjx3pk6zFS6cg for ; Tue, 5 Dec 2017 00:31:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poczta.onet.pl; s=2011; t=1512430294; bh=2hJFmZbqSkXP9v15QbaK/IhzQNHbZlRmyvZGrk6s3eg=; h=Subject:To:References:From:Date:In-Reply-To:From; b=seU39a++2NTZFDIuotPgQ6KvEHFZfAdN7GDxYlVCa1eiF9TsVuiJ6LigFhdwEhb2v 9CRYVeiIQYx5NYr9LP2m2YTkFkHjszWzlQJtzuoT51k9Wa3GEwjlc/TyXUncapiQOJ yvfNmX6dexcXQAnprAGQ0Gt6RpT0PK4X/YPYod60= To: ffmpeg-devel@ffmpeg.org References: <20171202205026.8516-1-mateuszb@poczta.onet.pl> <20171204080310.6484-1-mateuszb@poczta.onet.pl> <45c61de8-a913-8f4c-79b7-a08d87af8438@gmail.com> From: Mateusz Message-ID: <63cad17b-9ecb-fb65-f647-0c59e6952405@poczta.onet.pl> Date: Tue, 5 Dec 2017 00:31:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Subject: Re: [FFmpeg-devel] [PATCH] fix MSVC compilation errors X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" After some tests: 1) #undef far after #include is wrong -- in oleauto.h is declaration WINOLEAUTAPI VarUI1FromI8(LONG64 i64In, _Out_ BYTE FAR* pbOut); and 'FAR' is defined as 'far' which is define as empty. 2) #undef near after #include works in ffmpeg but is danger -- see 1) 3) after git revert 3701d499f8734ec5f3e7359de7311b15d92070b0 git revert 590136e78da3d091ea99ab5432543d47a559a461 and patch Mateusz W dniu 04.12.2017 o 20:27, Mateusz pisze: > W dniu 04.12.2017 o 15:02, Derek Buitenhuis pisze: >> On 12/4/2017 8:03 AM, Mateusz wrote: >>> After commit 3701d49 'error_resilience: remove avpriv_atomic usage' >>> we have included windows.h in much more files and we should >>> avoid conflicts with defines/function declarations. >>> >>> Signed-off-by: Mateusz Brzostek >>> --- >>> libavcodec/jpegls.h | 4 ++++ >>> libavcodec/mss2.c | 6 +++--- >>> libavformat/mxfenc.c | 2 +- >>> 3 files changed, 8 insertions(+), 4 deletions(-) >> >> Sprinkling these weird ifdefs and renames around is pretty ugly. Is there >> some sort of canonical list on MSDN or something we can use globally-ish? >> >> - Derek > > There is a list of "Predefined Macros" in MSVC -- IMO there are OK > https://msdn.microsoft.com/en-us/library/b0084kay(v=vs.140).aspx > > More danger are macros from windows.h -- there is a list of macros > to exclude some parts (from MSDN and windows.h): > Define WIN32_LEAN_AND_MEAN to exclude APIs such as > Cryptography, DDE, RPC, Shell, and Windows Sockets. > > /* If defined, the following flags inhibit definition > * of the indicated items. > * > * NOGDICAPMASKS - CC_*, LC_*, PC_*, CP_*, TC_*, RC_ > * NOVIRTUALKEYCODES - VK_* > * NOWINMESSAGES - WM_*, EM_*, LB_*, CB_* > * NOWINSTYLES - WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_* > * NOSYSMETRICS - SM_* > * NOMENUS - MF_* > * NOICONS - IDI_* > * NOKEYSTATES - MK_* > * NOSYSCOMMANDS - SC_* > * NORASTEROPS - Binary and Tertiary raster ops > * NOSHOWWINDOW - SW_* > * OEMRESOURCE - OEM Resource values > * NOATOM - Atom Manager routines > * NOCLIPBOARD - Clipboard routines > * NOCOLOR - Screen colors > * NOCTLMGR - Control and Dialog routines > * NODRAWTEXT - DrawText() and DT_* > * NOGDI - All GDI defines and routines > * NOKERNEL - All KERNEL defines and routines > * NOUSER - All USER defines and routines > * NONLS - All NLS defines and routines > * NOMB - MB_* and MessageBox() > * NOMEMMGR - GMEM_*, LMEM_*, GHND, LHND, associated routines > * NOMETAFILE - typedef METAFILEPICT > * NOMINMAX - Macros min(a,b) and max(a,b) > * NOMSG - typedef MSG and associated routines > * NOOPENFILE - OpenFile(), OemToAnsi, AnsiToOem, and OF_* > * NOSCROLL - SB_* and scrolling routines > * NOSERVICE - All Service Controller routines, SERVICE_ equates, etc. > * NOSOUND - Sound driver routines > * NOTEXTMETRIC - typedef TEXTMETRIC and associated routines > * NOWH - SetWindowsHook and WH_* > * NOWINOFFSETS - GWL_*, GCL_*, associated routines > * NOCOMM - COMM driver routines > * NOKANJI - Kanji support stuff. > * NOHELP - Help engine interface. > * NOPROFILER - Profiler interface. > * NODEFERWINDOWPOS - DeferWindowPos routines > * NOMCX - Modem Configuration Extensions > */ > > The most danger are small caps macros defined as empty in minwindef.h: > far > near > pascal > cdecl > > I think it is possible to make in ffmpeg's *.h files which include windows.h > something like this: > #define WIN32_LEAN_AND_MEAN > #define NOMINMAX > #define NOGDI > #include > #undef far > #undef near > #undef pascal > #undef cdecl > > I will make some test and write back. > > Mateusz diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c - MXFPackage packages[2] = {}; + MXFPackage packages[2] = {{NULL}}; VS 2017 can compile ffmpeg and fate stops at audiomatch-nero-16000-mono-he-m4a (without reverting 590136e hangs at api-flac-test.exe) 4) if for any reasons commits 3701d49 and 590136e shouldn't be reverted, we can apply this patch and diff --git a/libavcodec/utils.c b/libavcodec/utils.c index baf09119fe..b34a3803b8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1943,7 +1943,7 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) { - _Bool exp = 0; + atomic_bool exp = 0; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; @@ -1969,7 +1969,7 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) int ff_unlock_avcodec(const AVCodec *codec) { - _Bool exp = 1; + atomic_bool exp = 1; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0;