summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi.h
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-09 20:13:36 -0300
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-11 16:37:02 -0300
commit58011810e5dad7c89a0123434fe9fe7cdaa26fac (patch)
treeb1dbde070bb38be44a8a32a10a558c30023234a7 /audio/out/ao_wasapi.h
parentf3514fb4bdfa339d142e784a09555bbe25ff76f4 (diff)
downloadmpv-58011810e5dad7c89a0123434fe9fe7cdaa26fac.tar.bz2
mpv-58011810e5dad7c89a0123434fe9fe7cdaa26fac.tar.xz
ao_wasapi: Split into 2 files
ao_wasapi.c was almost entirely init code mixed with option code and occasionally actual audio handling code. Split most things to ao_wasapi_utils.c and keep the audio handling code in ao_wasapi.c.
Diffstat (limited to 'audio/out/ao_wasapi.h')
-rwxr-xr-xaudio/out/ao_wasapi.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h
new file mode 100755
index 0000000000..8df45f042e
--- /dev/null
+++ b/audio/out/ao_wasapi.h
@@ -0,0 +1,95 @@
+/*
+ * This file is part of mpv.
+ *
+ * Original author: Jonathan Yong <10walls@gmail.com>
+ *
+ * mpv is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpv is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with mpv. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MP_AO_WASAPI_H_
+#define MP_AO_WASAPI_H_
+
+#define COBJMACROS 1
+#define _WIN32_WINNT 0x600
+
+#include <audioclient.h>
+#include <mmdeviceapi.h>
+#include <avrt.h>
+
+typedef struct wasapi_state {
+ struct mp_log *log;
+ HANDLE threadLoop;
+
+ /* 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;
+
+ /* Buffers */
+ size_t buffer_block_size; /* Size of each block in bytes */
+ REFERENCE_TIME
+ minRequestedDuration; /* minimum wasapi buffer block size, in 100-nanosecond units */
+ REFERENCE_TIME
+ defaultRequestedDuration; /* default wasapi default block size, in 100-nanosecond units */
+ UINT32 bufferFrameCount; /* wasapi buffer block size, number of frames, frame size at format.nBlockAlign */
+
+ /* WASAPI handles, owned by other thread */
+ IMMDevice *pDevice;
+ IAudioClient *pAudioClient;
+ IAudioRenderClient *pRenderClient;
+ IAudioEndpointVolume *pEndpointVolume;
+ HANDLE hFeed; /* wasapi event */
+ HANDLE hTask; /* AV thread */
+ DWORD taskIndex; /* AV task ID */
+ WAVEFORMATEXTENSIBLE format;
+
+ /* WASAPI internal clock information, for estimating delay */
+ IAudioClock *pAudioClock;
+ UINT64 clock_frequency; /* scale for the "samples" returned by the clock */
+ UINT64 sample_count; /* the amount of samples per channel written to a GetBuffer buffer */
+ LARGE_INTEGER qpc_frequency; /* frequency of windows' high resolution timer */
+
+ int opt_exclusive;
+ int opt_list;
+ char *opt_device;
+
+ /* We still need to support XP, don't use these functions directly, blob owned by main thread */
+ struct {
+ HMODULE hAvrt;
+ HANDLE (WINAPI *pAvSetMmThreadCharacteristicsW)(LPCWSTR, LPDWORD);
+ WINBOOL (WINAPI *pAvRevertMmThreadCharacteristics)(HANDLE);
+ } VistaBlob;
+} wasapi_state;
+
+#endif \ No newline at end of file