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).
Showing the changes to libavdevice/decklink_dec.cpp (1 of 4 files). Show all
Unified · Split
| @@ -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; |