0
0
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:
Kevin Mitchell 2015-04-02 22:16:57 -07:00
parent 46b9df9f9e
commit bf3e0bc1da
2 changed files with 23 additions and 24 deletions

View File

@ -244,10 +244,10 @@ static int init(struct ao *ao)
MP_WARN(ao, "Error loading thread priority functions\n"); MP_WARN(ao, "Error loading thread priority functions\n");
state->init_done = CreateEventW(NULL, FALSE, FALSE, NULL); state->init_done = CreateEventW(NULL, FALSE, FALSE, NULL);
state->hUninit = CreateEventW(NULL, FALSE, FALSE, NULL); state->hUninit = CreateEventW(NULL, FALSE, FALSE, NULL);
state->hFeed = CreateEventW(NULL, FALSE, FALSE, NULL); /* for wasapi event mode */ state->hFeed = CreateEventW(NULL, FALSE, FALSE, NULL); /* for wasapi event mode */
state->hResume = CreateEventW(NULL, FALSE, FALSE, NULL); state->hResume = CreateEventW(NULL, FALSE, FALSE, NULL);
state->hReset = CreateEventW(NULL, FALSE, FALSE, NULL); state->hReset = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!state->init_done || !state->hFeed || !state->hUninit || if (!state->init_done || !state->hFeed || !state->hUninit ||
!state->hResume || !state->hReset) !state->hResume || !state->hReset)
{ {
@ -400,18 +400,18 @@ static int hotplug_init(struct ao *ao)
#define OPT_BASE_STRUCT struct wasapi_state #define OPT_BASE_STRUCT struct wasapi_state
const struct ao_driver audio_out_wasapi = { const struct ao_driver audio_out_wasapi = {
.description = "Windows WASAPI audio output (event mode)", .description = "Windows WASAPI audio output (event mode)",
.name = "wasapi", .name = "wasapi",
.init = init, .init = init,
.uninit = uninit, .uninit = uninit,
.control = control, .control = control,
.reset = audio_reset, .reset = audio_reset,
.resume = audio_resume, .resume = audio_resume,
.list_devs = wasapi_list_devs, .list_devs = wasapi_list_devs,
.hotplug_init = hotplug_init, .hotplug_init = hotplug_init,
.hotplug_uninit = hotplug_uninit, .hotplug_uninit = hotplug_uninit,
.priv_size = sizeof(wasapi_state), .priv_size = sizeof(wasapi_state),
.options = (const struct m_option[]) { .options = (const struct m_option[]) {
OPT_FLAG("exclusive", opt_exclusive, 0), OPT_FLAG("exclusive", opt_exclusive, 0),
OPT_STRING("device", opt_device, 0), OPT_STRING("device", opt_device, 0),
{NULL}, {NULL},

View File

@ -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) 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); wasapi_explain_err(hr), (uint32_t) hr);
return buf; return buf;
} }
@ -226,15 +226,15 @@ static void set_waveformat(WAVEFORMATEXTENSIBLE *wformat,
int format, WORD valid_bits, int format, WORD valid_bits,
DWORD samplerate, struct mp_chmap *channels) DWORD samplerate, struct mp_chmap *channels)
{ {
wformat->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; wformat->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wformat->Format.nChannels = channels->num; wformat->Format.nChannels = channels->num;
wformat->Format.nSamplesPerSec = samplerate; wformat->Format.nSamplesPerSec = samplerate;
wformat->Format.wBitsPerSample = af_fmt2bits(format); wformat->Format.wBitsPerSample = af_fmt2bits(format);
wformat->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); 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->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); update_waveformat_datarate(wformat);
} }
@ -373,8 +373,8 @@ static bool set_ao_format(struct ao *ao, WAVEFORMATEX *wf, AUDCLNT_SHAREMODE sha
return false; return false;
} }
ao->samplerate = wf->nSamplesPerSec; ao->samplerate = wf->nSamplesPerSec;
ao->format = format; ao->format = format;
ao->channels = channels; ao->channels = channels;
} }
waveformat_copy(&state->format, wf); waveformat_copy(&state->format, wf);
state->share_mode = share_mode; state->share_mode = share_mode;
@ -1117,8 +1117,7 @@ retry:
MP_DBG(ao, "Fixing format\n"); MP_DBG(ao, "Fixing format\n");
hr = fix_format(ao); hr = fix_format(ao);
if ((hr == AUDCLNT_E_DEVICE_IN_USE || if ((hr == AUDCLNT_E_DEVICE_IN_USE || hr == AUDCLNT_E_DEVICE_INVALIDATED) &&
hr == AUDCLNT_E_DEVICE_INVALIDATED) &&
retry_wait <= 8) retry_wait <= 8)
{ {
wasapi_thread_uninit(ao); wasapi_thread_uninit(ao);