From 9ab73b6373a5f78d27a9587deedc8e9b2d565cc0 Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Thu, 18 Jul 2013 23:16:42 -0300 Subject: ao_wasapi0: Make it compile on cygwin64 Fixes format specifies that assume windows TYPEDEFS are as long as they look like they are. Remove calls to _beginthreadex and _endthreadex, these are only present on microsoft's C runtimes. Replace by the otherwise identical CreateThread and ExitThread calls. This actually requires fixes to devicetopology.h, but the problem has been (kinda) reported to mingw-w64: I see that those KSJACK* structs are supposedly declared in devicetopology.h itself, but for some reason (some of?) the decls that use them aren't seeing them? ok, it seems that it expects ks.h and ksmedia.h to declare those structs, but it doesn't the included files declare KDATAFORMAT, KSIDENTIFIER and LUID (and the associated pointer typedefs) but everything else is essentially inside #if 0 changing the #ifndef _KS_ to only include KDATAFORMAT, KSIDENTIFIER and LUID (and putting the KSJACK stuff outside that #ifndef) makes the header compile it solves my immediate problem, but if that happened to begin with there's probably something more wrong with the ks headers :S --- audio/out/ao_wasapi0.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'audio/out/ao_wasapi0.c') diff --git a/audio/out/ao_wasapi0.c b/audio/out/ao_wasapi0.c index a45ca829e5..f2efffed2b 100644 --- a/audio/out/ao_wasapi0.c +++ b/audio/out/ao_wasapi0.c @@ -19,6 +19,7 @@ #define _WIN32_WINNT 0x600 #include +#include #include #include #include @@ -33,6 +34,10 @@ #include "core/mp_ring.h" #include "ao.h" +#ifndef BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE +#define BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE 0x00000001 +#endif + #define RING_BUFFER_COUNT 64 /* 20 millisecond buffer? */ @@ -236,7 +241,7 @@ static HRESULT check_support(struct wasapi0_state *state, EnterCriticalSection(&state->print_lock); mp_msg( MSGT_AO, MSGL_ERR, - "IAudioClient::IsFormatSupported failed with %s (%d at %ldHz %dchannels, channelmask = %lx)\n", + "IAudioClient::IsFormatSupported failed with %s (%d at %"PRId32"Hz %dchannels, channelmask = %"PRIx32")\n", explain_err( hr), wformat->Format.wBitsPerSample, wformat->Format.nSamplesPerSec, @@ -366,7 +371,7 @@ reinit: EnterCriticalSection(&state->print_lock); mp_msg(MSGT_AO, MSGL_V, "ao-wasapi: fix_format OK, using %lld byte buffer block size!\n", - state->buffer_block_size); + (long long) state->buffer_block_size); LeaveCriticalSection(&state->print_lock); return 0; exit_label: @@ -463,7 +468,7 @@ static void thread_feed(wasapi0_state *state,int force_feed) return; exit_label: EnterCriticalSection(&state->print_lock); - mp_msg(MSGT_AO, MSGL_ERR, "ao-wasapi: thread_feed fails with %lx!\n", hr); + mp_msg(MSGT_AO, MSGL_ERR, "ao-wasapi: thread_feed fails with %"PRIx32"!\n", hr); LeaveCriticalSection(&state->print_lock); return; } @@ -515,7 +520,7 @@ static void thread_uninit(wasapi0_state *state) if (state->hTask) state->VistaBlob.pAvRevertMmThreadCharacteristics(state->hTask); CoUninitialize(); - _endthreadex(0); + ExitThread(0); } static unsigned int __stdcall ThreadLoop(void *lpParameter) @@ -670,7 +675,7 @@ static int init(struct ao *ao, char *params) return -1; } state->init_ret = -1; - state->threadLoop = (HANDLE)_beginthreadex(NULL, 0, &ThreadLoop, ao, 0, NULL); + state->threadLoop = (HANDLE)CreateThread(NULL, 0, &ThreadLoop, ao, 0, NULL); if (!state->threadLoop) { /* failed to init thread */ mp_msg(MSGT_AO, MSGL_ERR, "ao-wasapi0: fail to create thread!\n"); -- cgit v1.2.3