summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi.h
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-11 00:47:33 -0300
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-11 16:37:02 -0300
commitf3e9b9462210021286bfbe98eef228ab74c8b490 (patch)
tree07c2b6691a37f220717dd88cd7579a1f2b46851f /audio/out/ao_wasapi.h
parent58011810e5dad7c89a0123434fe9fe7cdaa26fac (diff)
downloadmpv-f3e9b9462210021286bfbe98eef228ab74c8b490.tar.bz2
mpv-f3e9b9462210021286bfbe98eef228ab74c8b490.tar.xz
ao_wasapi: Move non-critical code outside of the event thread
Due to the COM Single-Threaded Apartment model, the thread owning the objects will still do all the actual method calls (in the form of message dispatches), but at least this will be COM's problem rather than having to set up several handles and adding extra code to the event thread. Since the event thread still needs to own the WASAPI handles to avoid waiting on another thread to dispatch the messages, the init and uninit code still has to run in the thread. This also removes a broken drain implementation and removes unused headers from each of the files split from the original ao_wasapi.c.
Diffstat (limited to 'audio/out/ao_wasapi.h')
-rwxr-xr-xaudio/out/ao_wasapi.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h
index 8df45f042e..a0ce654d4d 100755
--- a/audio/out/ao_wasapi.h
+++ b/audio/out/ao_wasapi.h
@@ -34,25 +34,11 @@ typedef struct wasapi_state {
/* Init phase */
int init_ret;
HANDLE init_done;
- HANDLE fatal_error; /* signal to indicate unrecoverable error */
int share_mode;
- /* Events */
- HANDLE hPause;
-
- /* Play */
- HANDLE hPlay;
- int is_playing;
-
- /* Reset */
- HANDLE hReset;
-
- /* uninit */
HANDLE hUninit;
- LONG immed;
/* volume control */
- HANDLE hGetvol, hSetvol, hDoneVol;
DWORD vol_hw_support, status;
float audio_volume;
@@ -70,10 +56,23 @@ typedef struct wasapi_state {
IAudioRenderClient *pRenderClient;
IAudioEndpointVolume *pEndpointVolume;
HANDLE hFeed; /* wasapi event */
+ HANDLE hForceFeed; /* forces writing a buffer (e.g. before audio_resume) */
+ HANDLE hFeedDone; /* set only after a hForceFeed */
HANDLE hTask; /* AV thread */
DWORD taskIndex; /* AV task ID */
WAVEFORMATEXTENSIBLE format;
+ /* WASAPI proxy handles, for Single-Threaded Apartment communication.
+ One is needed for each object that's accessed by a different thread. */
+ IAudioClient *pAudioClientProxy;
+ IAudioEndpointVolume *pEndpointVolumeProxy;
+
+ /* 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 *sAudioClient;
+ IStream *sEndpointVolume;
+
/* WASAPI internal clock information, for estimating delay */
IAudioClock *pAudioClock;
UINT64 clock_frequency; /* scale for the "samples" returned by the clock */
@@ -92,4 +91,4 @@ typedef struct wasapi_state {
} VistaBlob;
} wasapi_state;
-#endif \ No newline at end of file
+#endif