mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
ao_wasapi: code formatting and alignment
This commit is contained in:
parent
46b9df9f9e
commit
bf3e0bc1da
@ -244,10 +244,10 @@ static int init(struct ao *ao)
|
||||
MP_WARN(ao, "Error loading thread priority functions\n");
|
||||
|
||||
state->init_done = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
state->hUninit = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
state->hFeed = CreateEventW(NULL, FALSE, FALSE, NULL); /* for wasapi event mode */
|
||||
state->hResume = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
state->hReset = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
state->hUninit = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
state->hFeed = CreateEventW(NULL, FALSE, FALSE, NULL); /* for wasapi event mode */
|
||||
state->hResume = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
state->hReset = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
if (!state->init_done || !state->hFeed || !state->hUninit ||
|
||||
!state->hResume || !state->hReset)
|
||||
{
|
||||
@ -400,18 +400,18 @@ static int hotplug_init(struct ao *ao)
|
||||
#define OPT_BASE_STRUCT struct wasapi_state
|
||||
|
||||
const struct ao_driver audio_out_wasapi = {
|
||||
.description = "Windows WASAPI audio output (event mode)",
|
||||
.name = "wasapi",
|
||||
.init = init,
|
||||
.uninit = uninit,
|
||||
.control = control,
|
||||
.reset = audio_reset,
|
||||
.resume = audio_resume,
|
||||
.list_devs = wasapi_list_devs,
|
||||
.hotplug_init = hotplug_init,
|
||||
.description = "Windows WASAPI audio output (event mode)",
|
||||
.name = "wasapi",
|
||||
.init = init,
|
||||
.uninit = uninit,
|
||||
.control = control,
|
||||
.reset = audio_reset,
|
||||
.resume = audio_resume,
|
||||
.list_devs = wasapi_list_devs,
|
||||
.hotplug_init = hotplug_init,
|
||||
.hotplug_uninit = hotplug_uninit,
|
||||
.priv_size = sizeof(wasapi_state),
|
||||
.options = (const struct m_option[]) {
|
||||
.priv_size = sizeof(wasapi_state),
|
||||
.options = (const struct m_option[]) {
|
||||
OPT_FLAG("exclusive", opt_exclusive, 0),
|
||||
OPT_STRING("device", opt_device, 0),
|
||||
{NULL},
|
||||
|
@ -181,7 +181,7 @@ static char *wasapi_explain_err(const HRESULT hr)
|
||||
|
||||
char *mp_HRESULT_to_str_buf(char *buf, size_t buf_size, HRESULT hr)
|
||||
{
|
||||
snprintf(buf,buf_size,"%s (0x%"PRIx32")",
|
||||
snprintf(buf, buf_size, "%s (0x%"PRIx32")",
|
||||
wasapi_explain_err(hr), (uint32_t) hr);
|
||||
return buf;
|
||||
}
|
||||
@ -226,15 +226,15 @@ static void set_waveformat(WAVEFORMATEXTENSIBLE *wformat,
|
||||
int format, WORD valid_bits,
|
||||
DWORD samplerate, struct mp_chmap *channels)
|
||||
{
|
||||
wformat->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
wformat->Format.nChannels = channels->num;
|
||||
wformat->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
wformat->Format.nChannels = channels->num;
|
||||
wformat->Format.nSamplesPerSec = samplerate;
|
||||
wformat->Format.wBitsPerSample = af_fmt2bits(format);
|
||||
wformat->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
|
||||
|
||||
wformat->SubFormat = *format_to_subtype(format);
|
||||
wformat->SubFormat = *format_to_subtype(format);
|
||||
wformat->Samples.wValidBitsPerSample = valid_bits ? valid_bits : wformat->Format.wBitsPerSample;
|
||||
wformat->dwChannelMask = mp_chmap_to_waveext(channels);
|
||||
wformat->dwChannelMask = mp_chmap_to_waveext(channels);
|
||||
update_waveformat_datarate(wformat);
|
||||
}
|
||||
|
||||
@ -373,8 +373,8 @@ static bool set_ao_format(struct ao *ao, WAVEFORMATEX *wf, AUDCLNT_SHAREMODE sha
|
||||
return false;
|
||||
}
|
||||
ao->samplerate = wf->nSamplesPerSec;
|
||||
ao->format = format;
|
||||
ao->channels = channels;
|
||||
ao->format = format;
|
||||
ao->channels = channels;
|
||||
}
|
||||
waveformat_copy(&state->format, wf);
|
||||
state->share_mode = share_mode;
|
||||
@ -1117,8 +1117,7 @@ retry:
|
||||
|
||||
MP_DBG(ao, "Fixing format\n");
|
||||
hr = fix_format(ao);
|
||||
if ((hr == AUDCLNT_E_DEVICE_IN_USE ||
|
||||
hr == AUDCLNT_E_DEVICE_INVALIDATED) &&
|
||||
if ((hr == AUDCLNT_E_DEVICE_IN_USE || hr == AUDCLNT_E_DEVICE_INVALIDATED) &&
|
||||
retry_wait <= 8)
|
||||
{
|
||||
wasapi_thread_uninit(ao);
|
||||
|
Loading…
Reference in New Issue
Block a user