From patchwork Sat May 6 01:07:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Levinson X-Patchwork-Id: 3590 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp484491vsd; Fri, 5 May 2017 18:07:34 -0700 (PDT) X-Received: by 10.223.165.5 with SMTP id i5mr28619016wrb.197.1494032854422; Fri, 05 May 2017 18:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494032854; cv=none; d=google.com; s=arc-20160816; b=TZEgAgInCnqkQOmggtoUTI0Sqsb3eP7SKu14i0qGmVqw4qpmHllqmQKDsYsdFsBdNl f3E5E6IQuF8gRSEmpVZmQRkEQCvYVh79wYhqhDgF3xUjKxSj0mTgxRsiGtFfkFaAsqKd PxYYebBMRoHRiR0sufJWOOFEWEI7w9YoAz5A+5gFle+YiUH0UF0eIi5h6+NLKxMFq6yx cUpiMTEWAwl1hI8wv4eZWpcPYEZgXcFSgQBQjnIphU4Ydkn5tFQ7KulJG86YF2hCTppf mGXf1FqaRrcb9Te243qJ08FGHZov3BBjWciszVy9IWhZqPdWyR9pBpHuag41aY/BWOy1 +rSg== 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:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:delivered-to :arc-authentication-results; bh=bQxS7zoWDXwj0guOEs5U8NxUZljFQp3rD9+3EIP1jTk=; b=IFqjR2Y/8IJc8LpAx6Jv4Gmw8/oJLB04CLf5EfX5/UC6HLupnVPuep96jQt0Kk3MKY Q1c/0QO3yalTXp3O2K3L0tsqw9rOhhmQedAo+Yn6WzBJ0Wd9z8bIMvGj9btmuYsmquxN tYJIIHAV6ppPbTHVlOMKvgzOjyU18m+WqOolycQdADVxR17SJHj/jmKayz1pyHXuGykh NciuRsFI3cn4qsFo7mZ+DOP4A0H7tI+43cPViLFwVWQYb+2canzNN52w8ChwfdUBdDA/ X0ySFAM0cK/impK+1zwy6YhIjKrJsWm+zBekZIsVXEf2MITbrPd+thtqxx/bzAZUfspS PnPA== ARC-Authentication-Results: i=1; mx.google.com; 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 l37si8102442wrl.237.2017.05.05.18.07.31; Fri, 05 May 2017 18:07:34 -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; 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 BF376680564; Sat, 6 May 2017 04:07:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from white.spiritone.com (white.spiritone.com [216.99.193.38]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F50E6803A4 for ; Sat, 6 May 2017 04:07:15 +0300 (EEST) Received: from [192.168.3.101] (184-100-204-251.ptld.qwest.net [184.100.204.251]) by white.spiritone.com (Postfix) with ESMTPSA id ED7B37340602 for ; Fri, 5 May 2017 18:07:18 -0700 (PDT) To: FFmpeg development discussions and patches References: <71cba29c-68f9-b40b-d8f5-9d19292876d7@aracnet.com> <4a4660c5-2f40-242c-3dfb-18dc374a7d72@aracnet.com> <80fdcb09-c7e6-b6f5-6e57-f719ff098845@aracnet.com> <4540627e-3d35-521a-86a7-4ce59fd8a27b@aracnet.com> From: Aaron Levinson Message-ID: <7b70c4ab-ff1e-6efc-07bb-a7ccb2c5c22f@aracnet.com> Date: Fri, 5 May 2017 18:07:17 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] Made minor changes to get the decklink avdevice code to build using Visual C++ 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" On 5/5/2017 4:57 PM, Marton Balint wrote: > > > On Fri, 5 May 2017, Aaron Levinson wrote: > >> On 4/16/2017 4:11 PM, Aaron Levinson wrote: >>> On 4/15/2017 6:13 AM, Aaron Levinson wrote: >>>> On 4/15/2017 4:19 AM, Marton Balint wrote: >>>>> >>>>> On Thu, 13 Apr 2017, Aaron Levinson wrote: >>>>> >>>>>> On 4/13/2017 1:23 PM, Hendrik Leppkes wrote: >>>>> [...] >> >> Ping, and in addition, I've provided a new patch below since the >> original won't apply anymore. I've also adjusted the patch text a >> little bit. The original patch went through a few different reviews. >> These changes are necessary to get the decklink code to build using >> MSVC on Windows. >> >> Thanks, >> Aaron Levinson >> >> ------------------------------------------------------------------------------------ >> [...] >> case PTS_SRC_WALLCLOCK: >> - pts = av_rescale_q(wallclock, AV_TIME_BASE_Q, time_base); >> + { >> + /* MSVC does not support compound literals like >> AV_TIME_BASE_Q >> + * in C++ code (compiler error C4576) */ >> + // pts = av_rescale_q(wallclock, AV_TIME_BASE_Q, time_base); > > I'd rather remove the old code, i see no point in keeping it as a comment. Done--new patch with this change follows at the end. >> [...] > > The decklink part seems fine otherwise, maybe you should get an ACK from > Hendrik for the configure part, which I have no opinion about. Hendrik already reviewed the configure changes last month, and the configure part of the patch went through three iterations till it was determined that it was adequate, although it wouldn't hurt to have another look since then. New patch with the slight alteration follows. Thanks, Aaron Levinson -------------------------------------------------------------------------------------- From 269fcccc836b50f8949dbc45a2578bd16a53952b Mon Sep 17 00:00:00 2001 From: Aaron Levinson Date: Fri, 5 May 2017 17:59:21 -0700 Subject: [PATCH] decklink: Fixed MSVC build issues Purpose: Made minor changes to get the decklink avdevice code to build using Visual C++. Notes: Made changes to configure per Hendrik Leppkes's review of first and second versions of patch. Also made slight alterations per Marton Balint's reviews. Comments: -- configure: Added if enabled decklink section and setting decklink_indev_extralibs and decklink_outdev_extralibs here for both mingw and Windows. Also eliminated the setting of these variables in the mingw section earlier in the file. -- libavdevice/decklink_common.cpp: Switched the order of the include of libavformat/internal.h to workaround build issues with Visual C++. See comment in file for more details. -- libavdevice/decklink_dec.cpp: a) Rearranged the include of libavformat/internal.h (for reasons as described above). b) Made slight alteration to an argument for call to av_rescale_q() to workaround a compiler error with Visual C++. This appears to only be an issue when building C++ files with Visual C++. See comment in code for more details. -- libavdevice/decklink_enc.cpp: Rearranged the include of libavformat/internal.h (for reasons as described above). Signed-off-by: Aaron Levinson --- configure | 11 +++++++++-- libavdevice/decklink_common.cpp | 7 ++++++- libavdevice/decklink_dec.cpp | 16 ++++++++++++++-- libavdevice/decklink_enc.cpp | 7 ++++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 2e77a1034e..6f2c900a7b 100755 --- a/configure +++ b/configure @@ -4850,8 +4850,6 @@ case $target_os in else target_os=mingw32 fi - decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" - decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" LIBTARGET=i386 if enabled x86_64; then LIBTARGET="i386:x86-64" @@ -5957,6 +5955,15 @@ if ! disabled sdl2; then fi enabled sdl2 && enable sdl && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs +if enabled decklink; then + case $target_os in + mingw32*|mingw64*|win32|win64) + decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" + decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" + ;; + esac +fi + disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security"; } diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index f01fba953e..cbb591ce64 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -19,6 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* Include internal.h first to avoid conflict between winsock.h (used by + * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */ +extern "C" { +#include "libavformat/internal.h" +} + #include #ifdef _WIN32 #include @@ -28,7 +34,6 @@ extern "C" { #include "libavformat/avformat.h" -#include "libavformat/internal.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" #include "libavutil/bswap.h" diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 67eaf97e89..39974e3ff4 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -19,12 +19,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* Include internal.h first to avoid conflict between winsock.h (used by + * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */ +extern "C" { +#include "libavformat/internal.h" +} + #include extern "C" { #include "config.h" #include "libavformat/avformat.h" -#include "libavformat/internal.h" #include "libavutil/avutil.h" #include "libavutil/common.h" #include "libavutil/imgutils.h" @@ -262,8 +267,15 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame, res = videoFrame->GetHardwareReferenceTimestamp(time_base.den, &bmd_pts, &bmd_duration); break; case PTS_SRC_WALLCLOCK: - pts = av_rescale_q(wallclock, AV_TIME_BASE_Q, time_base); + { + /* MSVC does not support compound literals like AV_TIME_BASE_Q + * in C++ code (compiler error C4576) */ + AVRational timebase; + timebase.num = 1; + timebase.den = AV_TIME_BASE; + pts = av_rescale_q(wallclock, timebase, time_base); break; + } } if (res == S_OK) pts = bmd_pts / time_base.num; diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index 5105967101..be01bcd64c 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -22,11 +22,16 @@ #include using std::atomic; +/* Include internal.h first to avoid conflict between winsock.h (used by + * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */ +extern "C" { +#include "libavformat/internal.h" +} + #include extern "C" { #include "libavformat/avformat.h" -#include "libavformat/internal.h" #include "libavutil/imgutils.h" }