|
|
|
@ -69,25 +69,46 @@ DEFINE_GUID(_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP, |
|
|
|
0x000c, 0x0cea, 0x0010, 0x80, 0x00, |
|
|
|
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
|
|
|
|
|
|
|
static BOOL CALLBACK InitFreq(INIT_ONCE *once, void *param, void **context) |
|
|
|
{ |
|
|
|
(void) once; (void) context; |
|
|
|
return QueryPerformanceFrequency(param); |
|
|
|
} |
|
|
|
|
|
|
|
static LARGE_INTEGER freq; /* performance counters frequency */ |
|
|
|
|
|
|
|
static msftime_t GetQPC(void) |
|
|
|
{ |
|
|
|
LARGE_INTEGER counter; |
|
|
|
|
|
|
|
if (!QueryPerformanceCounter(&counter)) |
|
|
|
if (unlikely(!QueryPerformanceCounter(&counter))) |
|
|
|
abort(); |
|
|
|
|
|
|
|
lldiv_t d = lldiv(counter.QuadPart, freq.QuadPart); |
|
|
|
return (d.quot * 10000000) + ((d.rem * 10000000) / freq.QuadPart); |
|
|
|
} |
|
|
|
|
|
|
|
static msftime_t GetQPC_100ns(void) |
|
|
|
{ |
|
|
|
LARGE_INTEGER counter; |
|
|
|
|
|
|
|
if (unlikely(!QueryPerformanceCounter(&counter))) |
|
|
|
abort(); |
|
|
|
|
|
|
|
return counter.QuadPart; |
|
|
|
} |
|
|
|
|
|
|
|
static msftime_t (*get_qpc)(void); |
|
|
|
|
|
|
|
static BOOL CALLBACK InitFreq(INIT_ONCE *once, void *param, void **context) |
|
|
|
{ |
|
|
|
(void) once; (void) context; |
|
|
|
LARGE_INTEGER *qpc_freq = param; |
|
|
|
BOOL res = QueryPerformanceFrequency(qpc_freq); |
|
|
|
if (res) |
|
|
|
{ |
|
|
|
if (qpc_freq->QuadPart == 10000000) |
|
|
|
get_qpc = GetQPC_100ns; |
|
|
|
else |
|
|
|
get_qpc = GetQPC; |
|
|
|
} |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
typedef struct aout_stream_sys |
|
|
|
{ |
|
|
|
IAudioClient *client; |
|
|
|
@ -151,7 +172,7 @@ static HRESULT TimeGet(aout_stream_t *s, vlc_tick_t *restrict delay) |
|
|
|
static_assert((10000000 % CLOCK_FREQ) == 0, "Frequency conversion broken"); |
|
|
|
|
|
|
|
*delay = written - tick_pos |
|
|
|
- VLC_TICK_FROM_MSFTIME(GetQPC() - qpcpos); |
|
|
|
- VLC_TICK_FROM_MSFTIME(get_qpc() - qpcpos); |
|
|
|
|
|
|
|
return hr; |
|
|
|
} |
|
|
|
|