- making rtphone buildable on Windows

This commit is contained in:
2025-04-21 13:12:56 +03:00
parent 8d0c8ba4de
commit 83373cb586
11 changed files with 52 additions and 9 deletions

View File

@@ -6,6 +6,7 @@
#include "Agent_AudioManager.h"
#include "../engine/audio/Audio_WavFile.h"
#include "../engine/audio/Audio_Null.h"
#include "HL_String.h"
#if defined(TARGET_ANDROID)
# include "../engine/audio/Audio_Android.h"
@@ -171,7 +172,7 @@ void AudioManager::startPlayFile(int usageId, const std::string& path, AudioTarg
// Check if file exists
Audio::PWavFileReader r = std::make_shared<Audio::WavFileReader>();
#ifdef TARGET_WIN
r->open(StringHelper::makeTstring(path));
r->open(strx::makeTstring(path));
#else
r->open(path);
#endif

View File

@@ -1,4 +1,4 @@
/* Copyright(C) 2007-2017 VoIP objects (voipobjects.com)
/* Copyright(C) 2007-2025 VoIP objects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -6,7 +6,7 @@
#ifndef __AUDIO_DSOUND_H
#define __AUDIO_DSOUND_H
#include "../config.h"
#include "../engine_config.h"
#include <winsock2.h>
#include <windows.h>

View File

@@ -1,6 +1,7 @@
#include "Audio_Null.h"
#include "helper/HL_Log.h"
#include <assert.h>
#include <chrono>
#define LOG_SUBSYSTEM "NULL audio"
using namespace Audio;

View File

@@ -8,7 +8,7 @@
#ifdef TARGET_WIN
#include "../config.h"
#include "../engine_config.h"
#include <winsock2.h>
#include <windows.h>

View File

@@ -423,3 +423,26 @@ std::string strx::removeQuotes(const std::string& s)
return r;
}
#if defined(TARGET_WIN)
// MSVC++ lacks memmem support
const void *memmem(const void *haystack, size_t haystack_len,
const void * const needle, const size_t needle_len)
{
if (haystack == NULL) return NULL; // or assert(haystack != NULL);
if (haystack_len == 0) return NULL;
if (needle == NULL) return NULL; // or assert(needle != NULL);
if (needle_len == 0) return NULL;
for (const char *h = (const char*)haystack;
haystack_len >= needle_len;
++h, --haystack_len) {
if (!memcmp(h, needle, needle_len)) {
return h;
}
}
return nullptr;
}
#endif

View File

@@ -84,4 +84,11 @@ public:
};
#if defined(TARGET_WIN)
// MSVC++ lacks memmem support
extern const void *memmem(const void *haystack, size_t haystack_len,
const void * const needle, const size_t needle_len);
#endif
#endif

View File

@@ -14,6 +14,11 @@
#include <functional>
#include <assert.h>
#if defined(TARGET_WIN)
# include <WinSock2.h>
# include <Windows.h>
#endif
typedef std::recursive_mutex Mutex;
typedef std::unique_lock<std::recursive_mutex> Lock;

View File

@@ -6,6 +6,8 @@
#include "../helper/HL_Log.h"
#include "../helper/HL_IuUP.h"
#include <iostream>
#define LOG_SUBSYSTEM "AmrCodec"
using namespace MT;

View File

@@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define NOMINMAX
#if defined(TARGET_WIN) && !defined(NOMINMAX)
# define NOMINMAX
#endif
#include "../engine_config.h"
#include "MT_AudioReceiver.h"
@@ -14,6 +16,7 @@
#include "../audio/Audio_Interface.h"
#include "../audio/Audio_Resampler.h"
#include <cmath>
#include <iostream>
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_WIN) && !defined(TARGET_RPI) && defined(USE_AMR_CODEC)
# include "MT_AmrCodec.h"