diff options
author | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2013-07-18 23:16:42 -0300 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-20 02:20:46 +0200 |
commit | 9ab73b6373a5f78d27a9587deedc8e9b2d565cc0 (patch) | |
tree | 95f2c4ae00f35382c110f2209c928c8e9b400ef2 /audio/out | |
parent | 6ab2eebe5fdf9a4e075b6aa164f40e2bd89ee76e (diff) | |
download | mpv-9ab73b6373a5f78d27a9587deedc8e9b2d565cc0.tar.bz2 mpv-9ab73b6373a5f78d27a9587deedc8e9b2d565cc0.tar.xz |
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:
<Kovensky> 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?
<Kovensky> ok, it seems that it expects ks.h and ksmedia.h to declare those
structs, but it doesn't
<Kovensky> the included files declare KDATAFORMAT, KSIDENTIFIER and LUID (and
the associated pointer typedefs)
<Kovensky> but everything else is essentially inside #if 0
<Kovensky> changing the #ifndef _KS_ to only include KDATAFORMAT, KSIDENTIFIER
and LUID (and putting the KSJACK stuff outside that #ifndef) makes the
header compile
<Kovensky> it solves my immediate problem, but if that happened to begin with
there's probably something more wrong with the ks headers :S
Diffstat (limited to 'audio/out')
-rw-r--r-- | audio/out/ao_wasapi0.c | 15 |
1 files changed, 10 insertions, 5 deletions
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 <stdlib.h> +#include <inttypes.h> #include <process.h> #include <initguid.h> #include <audioclient.h> @@ -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"); |