From 0a5e63b6585479a5fff9ecf690860e1ecda0496b Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Tue, 13 Dec 2016 17:32:58 -0500
Subject: [PATCH] media: syntax modifications for native Windows build

- includes <functional> in media_buffer.h for std::function.

- forward declare AudioFrame and DeviceParams as structs in
  media_decoder.h, as they are both defined as such.

- remove AVRational compound literal from media_encoder.cpp.

- use a #pragma message instead of a #warning in Visual Studio

Change-Id: If32cfbb7504d65c9687814dcc3b5dfa859017fc5
Tuleap: #790
Reviewed-by: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
---
 src/media/media_buffer.h    | 1 +
 src/media/media_decoder.h   | 4 ++--
 src/media/media_encoder.cpp | 2 +-
 src/media/srtp.c            | 6 +++++-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/media/media_buffer.h b/src/media/media_buffer.h
index 948519a9fa..357edd504b 100644
--- a/src/media/media_buffer.h
+++ b/src/media/media_buffer.h
@@ -23,6 +23,7 @@
 #include "config.h"
 
 #include <memory>
+#include <functional>
 
 class AVFrame;
 
diff --git a/src/media/media_decoder.h b/src/media/media_decoder.h
index 68edb6a4a0..1e32226d92 100644
--- a/src/media/media_decoder.h
+++ b/src/media/media_decoder.h
@@ -50,12 +50,12 @@ class HardwareAccel;
 }
 #endif
 
-class AudioFrame;
+struct AudioFrame;
 class AudioFormat;
 class RingBuffer;
 class Resampler;
 class MediaIOHandle;
-class DeviceParams;
+struct DeviceParams;
 
 class MediaDecoder {
     public:
diff --git a/src/media/media_encoder.cpp b/src/media/media_encoder.cpp
index 81d3bdb508..694cf672ea 100644
--- a/src/media/media_encoder.cpp
+++ b/src/media/media_encoder.cpp
@@ -594,7 +594,7 @@ void MediaEncoder::prepareEncoderContext(bool is_video)
         auto v = av_dict_get(options_, "sample_rate", NULL, 0);
         if (v) {
             encoderCtx_->sample_rate = atoi(v->value);
-            encoderCtx_->time_base = (AVRational) {1, encoderCtx_->sample_rate};
+            encoderCtx_->time_base = AVRational{1, encoderCtx_->sample_rate};
         } else {
             RING_WARN("[%s] No sample rate set", encoderName);
             encoderCtx_->sample_rate = 8000;
diff --git a/src/media/srtp.c b/src/media/srtp.c
index f60d0be39f..bd44fd7ec4 100644
--- a/src/media/srtp.c
+++ b/src/media/srtp.c
@@ -127,7 +127,11 @@ int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr)
 {
     uint8_t iv[16] = { 0 }, hmac[20];
     int len = *lenptr;
-#warning seq_largest and roc may be unitialized
+#ifdef _MSC_VER
+#pragma message (__FILE__ "(" STR2(__LINE__) ") : -NOTE- " seq_largest and roc may be unitialized)
+#else
+#warning seq_largest and roc may be unitialized
+#endif
     int av_uninit(seq_largest);
     uint32_t ssrc, av_uninit(roc);
     uint64_t index;
-- 
GitLab