mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 09:57:34 +00:00
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
This commit is contained in:
parent
6ab2eebe5f
commit
9ab73b6373
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user