diff --git a/src/native/windows/wasapi/HResultException.h b/src/native/windows/wasapi/HResultException.h index 6e1fc1affc873972c592f3920767d6d994549aa3..b412c43f595531dda899a215f3812325bd88fd6f 100644 --- a/src/native/windows/wasapi/HResultException.h +++ b/src/native/windows/wasapi/HResultException.h @@ -11,6 +11,10 @@ #include <jni.h> /* jclass, jmethodID, JNIEnv */ #include <windows.h> /* HRESULT */ +#ifdef _MSC_VER +#define __func__ __FUNCTION__ +#endif /* #ifdef _MSC_VER */ + extern jclass WASAPI_hResultExceptionClass; extern jmethodID WASAPI_hResultExceptionMethodID; diff --git a/src/native/windows/wasapi/MediaBuffer.c b/src/native/windows/wasapi/MediaBuffer.c index c2d42a778d7058e08595f2e3f9bc888c3a6fd963..836a9b201c61f71d9a887167a932e7f6b4cd8511 100644 --- a/src/native/windows/wasapi/MediaBuffer.c +++ b/src/native/windows/wasapi/MediaBuffer.c @@ -11,6 +11,8 @@ #include <string.h> /* memcpy */ #include <windows.h> /* InterlockedDecrement, InterlockedIncrement */ +#include "Typecasting.h" + struct MediaBuffer { CONST_VTBL IMediaBufferVtbl *lpVtbl; @@ -63,8 +65,8 @@ MediaBuffer_QueryInterface(IMediaBuffer *thiz, REFIID riid, void **ppvObject) { if (ppvObject) { - if (IsEqualIID(&IID_IUnknown, riid) - || IsEqualIID(&IID_IMediaBuffer, riid)) + if (IsEqualIID(__uuidof(IID_IUnknown), riid) + || IsEqualIID(__uuidof(IID_IMediaBuffer), riid)) { *ppvObject = thiz; IMediaObject_AddRef(thiz); @@ -133,10 +135,12 @@ MediaBuffer_alloc(DWORD maxLength) DWORD MediaBuffer_pop(MediaBuffer *thiz, BYTE *buffer, DWORD length) { + DWORD i; + if (buffer) memcpy(buffer, thiz->_buffer, length); thiz->_length -= length; - for (DWORD i = 0; i < thiz->_length; i++) + for (i = 0; i < thiz->_length; i++) thiz->_buffer[i] = thiz->_buffer[length + i]; return length; } diff --git a/src/native/windows/wasapi/MinGW_dmo.h b/src/native/windows/wasapi/MinGW_dmo.h index d743c90179dadf400466757a7f3629f04900641b..12091a7a527744528eaf301c1ca51d8032154ba0 100644 --- a/src/native/windows/wasapi/MinGW_dmo.h +++ b/src/native/windows/wasapi/MinGW_dmo.h @@ -8,24 +8,26 @@ #ifndef _ORG_JITSI_IMPL_NEOMEDIA_JMFEXT_MEDIA_PROTOCOL_WASAPI_MINGWDMO_H_ #define _ORG_JITSI_IMPL_NEOMEDIA_JMFEXT_MEDIA_PROTOCOL_WASAPI_MINGWDMO_H_ -#ifndef _COM_Outptr_ -#define _COM_Outptr_ -#endif /* #ifndef _COM_Outptr_ */ -#ifndef _Out_opt_ -#define _Out_opt_ -#endif /* #ifndef _Out_opt_ */ -#ifndef _Out_writes_ -#define _Out_writes_(x) -#endif /* #ifndef _Out_writes_ */ -#ifndef _Out_writes_bytes_ -#define _Out_writes_bytes_(x) -#endif /* #ifndef _Out_writes_bytes_ */ -#ifndef _Out_writes_to_ -#define _Out_writes_to_(x,y) -#endif /* #ifndef _Out_writes_to_ */ -#ifndef _Outptr_opt_result_bytebuffer_ -#define _Outptr_opt_result_bytebuffer_(x) -#endif /* #ifndef _Outptr_opt_result_bytebuffer_ */ +#ifndef _MSC_VER + #ifndef _COM_Outptr_ + #define _COM_Outptr_ + #endif /* #ifndef _COM_Outptr_ */ + #ifndef _Out_opt_ + #define _Out_opt_ + #endif /* #ifndef _Out_opt_ */ + #ifndef _Out_writes_ + #define _Out_writes_(x) + #endif /* #ifndef _Out_writes_ */ + #ifndef _Out_writes_bytes_ + #define _Out_writes_bytes_(x) + #endif /* #ifndef _Out_writes_bytes_ */ + #ifndef _Out_writes_to_ + #define _Out_writes_to_(x,y) + #endif /* #ifndef _Out_writes_to_ */ + #ifndef _Outptr_opt_result_bytebuffer_ + #define _Outptr_opt_result_bytebuffer_(x) + #endif /* #ifndef _Outptr_opt_result_bytebuffer_ */ +#endif /* #ifndef _MSC_VER */ #include <dmo.h> #endif /* #ifndef _ORG_JITSI_IMPL_NEOMEDIA_JMFEXT_MEDIA_PROTOCOL_WASAPI_MINGWDMO_H_ */ diff --git a/src/native/windows/wasapi/Typecasting.h b/src/native/windows/wasapi/Typecasting.h index 952f0e76bddf1de79c943619dbe3af9532aff938..e225ba827a96526af0b0f89bc2de301ff7de8782 100644 --- a/src/native/windows/wasapi/Typecasting.h +++ b/src/native/windows/wasapi/Typecasting.h @@ -11,6 +11,10 @@ #include <jni.h> /* JNIEnv, jstring */ #include <windows.h> /* HRESULT */ +#ifndef __uuidof +#define __uuidof(i) &i +#endif /* #ifndef __uuidof */ + HRESULT WASAPI_iidFromString(JNIEnv *env, jstring str, LPIID iid); #endif /* #ifndef _ORG_JITSI_IMPL_NEOMEDIA_JMFEXT_MEDIA_PROTOCOL_WASAPI_TYPECASTING_H_ */ diff --git a/src/native/windows/wasapi/org_jitsi_impl_neomedia_jmfext_media_protocol_wasapi_WASAPI.c b/src/native/windows/wasapi/org_jitsi_impl_neomedia_jmfext_media_protocol_wasapi_WASAPI.c index 536d4a3b383a13ee1db76d3cf2f55048da8accc2..13f2856adaf4a2a7a6e0e042d927d6b0bcf5bbbd 100644 --- a/src/native/windows/wasapi/org_jitsi_impl_neomedia_jmfext_media_protocol_wasapi_WASAPI.c +++ b/src/native/windows/wasapi/org_jitsi_impl_neomedia_jmfext_media_protocol_wasapi_WASAPI.c @@ -25,13 +25,10 @@ #include "HResultException.h" #include "Typecasting.h" -#ifndef __uuidof -#define __uuidof(i) &i -#endif /* #ifndef __uuidof */ #define PSPropertyKeyFromString(pszString,pkey) \ WASAPI_pPSPropertyKeyFromString(pszString,pkey) -typedef HRESULT WINAPI (*LPPSPropertyKeyFromString)(LPCWSTR,PROPERTYKEY*); +typedef HRESULT (WINAPI *LPPSPropertyKeyFromString)(LPCWSTR,PROPERTYKEY*); ULONG STDMETHODCALLTYPE MMNotificationClient_AddRef (IMMNotificationClient* thiz); @@ -56,6 +53,11 @@ static UINT32 WASAPI_audiocopy (void *src, jint srcSampleSize, jint srcChannels, void *dst, jint dstSampleSize, jint dstChannels, UINT32 numFramesRequested); +#ifdef _MSC_VER + DEFINE_GUID(IID_IMMDeviceEnumerator,0xa95664d2,0x9614,0x4f35,0xa7,0x46,0xde,0x8d,0xb6,0x36,0x17,0xe6); + DEFINE_GUID(IID_IMMNotificationClient,0x7991eec9,0x7e89,0x4d85,0x83,0x90,0x6c,0x70,0x3c,0xec,0x60,0xc0); +#endif /* #ifdef _MSC_VER */ + static jclass MMNotificationClient_class = 0; static jmethodID MMNotificationClient_onDefaultDeviceChangedMethodID = 0; static jmethodID MMNotificationClient_onDeviceAddedMethodID = 0;