Browse Source

aja: Fix compilation warnings on Clang and GCC

- Fix format warning
  On Linux uint64_t is a unsigned long and on macOS it is
  a unsigned long long.
- Fix macro-redefine warning on macOS
tytan652 3 years ago
parent
commit
ba92da8d74
2 changed files with 6 additions and 1 deletions
  1. 4 1
      plugins/aja/aja-output.cpp
  2. 2 0
      plugins/aja/aja-source.cpp

+ 4 - 1
plugins/aja/aja-output.cpp

@@ -15,6 +15,7 @@
 
 #include <atomic>
 #include <stdlib.h>
+#include <inttypes.h>
 
 // Log AJA Output video/audio delay/sync
 // #define AJA_OUTPUT_STATS
@@ -839,7 +840,9 @@ void AJAOutput::OutputThread(AJAThread *thread, void *ctx)
 	uint32_t audioSize = props.audioNumChannels / props.audioSampleSize;
 	if (audioSize > 0) {
 		blog(LOG_INFO,
-		     "AJAOutput::OutputThread: Thread stopped\n[Video] qf: %lu wf: %lu pf: %lu\n[Audio] qs: %lu ws: %lu ps: %lu",
+		     "AJAOutput::OutputThread: Thread stopped\n[Video] qf: %" PRIu64
+		     " wf: %" PRIu64 " pf: %" PRIu64 "\n[Audio] qs: %" PRIu64
+		     " ws: %" PRIu64 " ps: %" PRIu64,
 		     ajaOutput->mVideoQueueFrames, ajaOutput->mVideoWriteFrames,
 		     ajaOutput->mVideoPlayFrames,
 		     ajaOutput->mAudioQueueBytes / audioSize,

+ 2 - 0
plugins/aja/aja-source.cpp

@@ -13,7 +13,9 @@
 #include <ajantv2/includes/ntv2card.h>
 #include <ajantv2/includes/ntv2utils.h>
 
+#ifndef NSEC_PER_SEC
 #define NSEC_PER_SEC 1000000000LL
+#endif
 #define NTV2_AUDIOSIZE_MAX (401 * 1024)
 
 AJASource::AJASource(obs_source_t *source)