diff options
author | Aaron Levinson <alevinsn@aracnet.com> | 2017-05-05 17:59:21 -0700 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2017-05-08 22:43:35 +0200 |
commit | 7f7ee86d5a494ddbcb22c83dec970f38a8ccd7b4 (patch) | |
tree | 219a264e5ccd7462a8c45ad07610ed00b587e27b /libavdevice | |
parent | f089e02fa2b7716d9fa5228c734e55678437db85 (diff) | |
download | ffmpeg-7f7ee86d5a494ddbcb22c83dec970f38a8ccd7b4.tar.gz |
avdevice/decklink: fix 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 <alevinsn@aracnet.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice')
-rw-r--r-- | libavdevice/decklink_common.cpp | 7 | ||||
-rw-r--r-- | libavdevice/decklink_dec.cpp | 16 | ||||
-rw-r--r-- | libavdevice/decklink_enc.cpp | 7 |
3 files changed, 26 insertions, 4 deletions
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 <DeckLinkAPI.h> #ifdef _WIN32 #include <DeckLinkAPI_i.c> @@ -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 <DeckLinkAPI.h> 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 <atomic> 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 <DeckLinkAPI.h> extern "C" { #include "libavformat/avformat.h" -#include "libavformat/internal.h" #include "libavutil/imgutils.h" } |