From c188240ab923f3e986655dfa8ef316f8d9905500 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Sun, 20 Dec 2015 18:19:12 -0800 Subject: ao_wasapi: reorganize private structure --- audio/out/ao_wasapi.h | 73 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 37 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h index 7f15e90332..54ab00b1f8 100755 --- a/audio/out/ao_wasapi.h +++ b/audio/out/ao_wasapi.h @@ -52,58 +52,57 @@ enum wasapi_thread_state { typedef struct wasapi_state { struct mp_log *log; - /* Init phase */ - HRESULT init_ret; - HANDLE hInitDone; - int share_mode; - /* volume control */ - DWORD vol_hw_support; + // Thread handles + HRESULT init_ret; // status of init phase + HANDLE hInitDone; // set when init is complete in audio thread + HANDLE hAudioThread; // the audio thread itself + HANDLE hWake; // thread wakeup event + atomic_int thread_state; // enum wasapi_thread_state (what to do on wakeup) - /* WASAPI handles, owned by audio thread */ + // for setting the audio thread priority + HANDLE hTask; + + // WASAPI object handles owned and used by audio thread IMMDevice *pDevice; IAudioClient *pAudioClient; IAudioRenderClient *pRenderClient; - ISimpleAudioVolume *pAudioVolume; - IAudioEndpointVolume *pEndpointVolume; - IAudioSessionControl *pSessionControl; IMMDeviceEnumerator *pEnumerator; - /* thread handles */ - HANDLE hAudioThread; /* the thread itself */ - HANDLE hWake; /* thread wakeup event */ - atomic_int thread_state; /* enum wasapi_thread_state */ - - /* for setting the audio thread priority */ - HANDLE hTask; /* AV thread */ - - /* WASAPI proxy handles, for Single-Threaded Apartment communication. - One is needed for each audio thread object that's accessed from the main thread. */ - ISimpleAudioVolume *pAudioVolumeProxy; - IAudioEndpointVolume *pEndpointVolumeProxy; - IAudioSessionControl *pSessionControlProxy; - - /* Streams used to marshal the proxy objects. The thread owning the actual objects - needs to marshal proxy objects into these streams, and the thread that wants the - proxies unmarshals them from here. */ - IStream *sAudioVolume; - IStream *sEndpointVolume; + // WASAPI internal clock information, for estimating delay + IAudioClock *pAudioClock; + atomic_ullong sample_count; // samples per channel written by GetBuffer + UINT64 clock_frequency; // scale for position returned by GetPosition + LARGE_INTEGER qpc_frequency; // frequency of Windows' high resolution timer + + // WASAPI control (handles owned by audio thread but used by main thread) + IAudioSessionControl *pSessionControl; // setting the stream title + IAudioEndpointVolume *pEndpointVolume; // exclusive mode volume/mute + ISimpleAudioVolume *pAudioVolume; // shared mode volume/mute + DWORD vol_hw_support; // is hardware volume supported for exclusive-mode? + + // Streams used to marshal the proxy objects. The thread owning the actual + // objects needs to marshal proxy objects into these streams, and the thread + // that wants the proxies unmarshals them from here. IStream *sSessionControl; + IStream *sEndpointVolume; + IStream *sAudioVolume; - /* WASAPI internal clock information, for estimating delay */ - IAudioClock *pAudioClock; - UINT64 clock_frequency; /* scale for the "samples" returned by the clock */ - atomic_ullong sample_count; /* the amount of samples per channel written to a GetBuffer buffer */ - LARGE_INTEGER qpc_frequency; /* frequency of windows' high resolution timer */ + // WASAPI proxy handles, for Single-Threaded Apartment communication. One is + // needed for each audio thread object that's accessed from the main thread. + IAudioSessionControl *pSessionControlProxy; + IAudioEndpointVolume *pEndpointVolumeProxy; + ISimpleAudioVolume *pAudioVolumeProxy; - /* ao options */ + // ao options int opt_exclusive; int opt_list; char *opt_device; - /* format info */ + // format info WAVEFORMATEXTENSIBLE format; - UINT32 bufferFrameCount; /* wasapi buffer block size, number of frames, frame size at format.nBlockAlign */ + AUDCLNT_SHAREMODE share_mode; // AUDCLNT_SHAREMODE_EXCLUSIVE / SHARED + UINT32 bufferFrameCount; // number of frames in buffer change_notify change; } wasapi_state; -- cgit v1.2.3