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).
Unified · Split
| @@ -4853,8 +4853,6 @@ case $target_os in · 4852 unmodified lines | |||
| 4853 | else | 4853 | else |
| 4854 | target_os=mingw32 | 4854 | target_os=mingw32 |
| 4855 | fi | 4855 | fi |
| 4856 | decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" | ||
| 4857 | decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" | ||
| 4858 | LIBTARGET=i386 | 4856 | LIBTARGET=i386 |
| 4859 | if enabled x86_64; then | 4857 | if enabled x86_64; then |
| 4860 | LIBTARGET="i386:x86-64" | 4858 | LIBTARGET="i386:x86-64" |
| @@ -5959,6 +5957,15 @@ if ! disabled sdl2; then · 1098 unmodified lines | |||
| 5959 | fi | 5957 | fi |
| 5960 | enabled sdl2 && enable sdl && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs | 5958 | enabled sdl2 && enable sdl && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs |
| 5961 | 5959 | ||
| 5960 | if enabled decklink; then | ||
| 5961 | case $target_os in | ||
| 5962 | mingw32*|mingw64*|win32|win64) | ||
| 5963 | decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" | ||
| 5964 | decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" | ||
| 5965 | ;; | ||
| 5966 | esac | ||
| 5967 | fi | ||
| 5968 | |||
| 5962 | disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && | 5969 | disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && |
| 5963 | check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security"; } | 5970 | check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security"; } |
| 5964 | 5971 | ||
| @@ -19,6 +19,12 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | /* Include internal.h first to avoid conflict between winsock.h (used by | ||
| 23 | * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */ | ||
| 24 | extern "C" { | ||
| 25 | #include "libavformat/internal.h" | ||
| 26 | } | ||
| 27 | |||
| 22 | #include <DeckLinkAPI.h> | 28 | #include <DeckLinkAPI.h> |
| 23 | #ifdef _WIN32 | 29 | #ifdef _WIN32 |
| 24 | #include <DeckLinkAPI_i.c> | 30 | #include <DeckLinkAPI_i.c> |
| @@ -28,7 +34,6 @@ · 3 unmodified lines | |||
| 28 | 34 | ||
| 29 | extern "C" { | 35 | extern "C" { |
| 30 | #include "libavformat/avformat.h" | 36 | #include "libavformat/avformat.h" |
| 31 | #include "libavformat/internal.h" | ||
| 32 | #include "libavutil/imgutils.h" | 37 | #include "libavutil/imgutils.h" |
| 33 | #include "libavutil/intreadwrite.h" | 38 | #include "libavutil/intreadwrite.h" |
| 34 | #include "libavutil/bswap.h" | 39 | #include "libavutil/bswap.h" |
| @@ -19,12 +19,17 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | /* Include internal.h first to avoid conflict between winsock.h (used by | ||
| 23 | * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */ | ||
| 24 | extern "C" { | ||
| 25 | #include "libavformat/internal.h" | ||
| 26 | } | ||
| 27 | |||
| 22 | #include <DeckLinkAPI.h> | 28 | #include <DeckLinkAPI.h> |
| 23 | 29 | ||
| 24 | extern "C" { | 30 | extern "C" { |
| 25 | #include "config.h" | 31 | #include "config.h" |
| 26 | #include "libavformat/avformat.h" | 32 | #include "libavformat/avformat.h" |
| 27 | #include "libavformat/internal.h" | ||
| 28 | #include "libavutil/avutil.h" | 33 | #include "libavutil/avutil.h" |
| 29 | #include "libavutil/common.h" | 34 | #include "libavutil/common.h" |
| 30 | #include "libavutil/imgutils.h" | 35 | #include "libavutil/imgutils.h" |
| @@ -262,8 +267,15 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame, · 231 unmodified lines | |||
| 262 | res = videoFrame->GetHardwareReferenceTimestamp(time_base.den, &bmd_pts, &bmd_duration); | 267 | res = videoFrame->GetHardwareReferenceTimestamp(time_base.den, &bmd_pts, &bmd_duration); |
| 263 | break; | 268 | break; |
| 264 | case PTS_SRC_WALLCLOCK: | 269 | case PTS_SRC_WALLCLOCK: |
| 265 | pts = av_rescale_q(wallclock, AV_TIME_BASE_Q, time_base); | 270 | { |
| 271 | /* MSVC does not support compound literals like AV_TIME_BASE_Q | ||
| 272 | * in C++ code (compiler error C4576) */ | ||
| 273 | AVRational timebase; | ||
| 274 | timebase.num = 1; | ||
| 275 | timebase.den = AV_TIME_BASE; | ||
| 276 | pts = av_rescale_q(wallclock, timebase, time_base); | ||
| 266 | break; | 277 | break; |
| 278 | } | ||
| 267 | } | 279 | } |
| 268 | if (res == S_OK) | 280 | if (res == S_OK) |
| 269 | pts = bmd_pts / time_base.num; | 281 | pts = bmd_pts / time_base.num; |
| @@ -22,11 +22,16 @@ · 21 unmodified lines | |||
| 22 | #include <atomic> | 22 | #include <atomic> |
| 23 | using std::atomic; | 23 | using std::atomic; |
| 24 | 24 | ||
| 25 | /* Include internal.h first to avoid conflict between winsock.h (used by | ||
| 26 | * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */ | ||
| 27 | extern "C" { | ||
| 28 | #include "libavformat/internal.h" | ||
| 29 | } | ||
| 30 | |||
| 25 | #include <DeckLinkAPI.h> | 31 | #include <DeckLinkAPI.h> |
| 26 | 32 | ||
| 27 | extern "C" { | 33 | extern "C" { |
| 28 | #include "libavformat/avformat.h" | 34 | #include "libavformat/avformat.h" |
| 29 | #include "libavformat/internal.h" | ||
| 30 | #include "libavutil/imgutils.h" | 35 | #include "libavutil/imgutils.h" |
| 31 | } | 36 | } |
| 32 | 37 | ||