From 9e284660b1735d7878069f4d489ac6bb773836f4 Mon Sep 17 00:00:00 2001 From: Ryan Lucia Date: Sun, 17 Feb 2019 12:25:57 -0500 Subject: [PATCH] meson: add DirectSound detection --- meson.build | 15 +++++++++++++++ meson_options.txt | 3 ++- src/meson.build | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ab4242d20..9c9b7ace7 100644 --- a/meson.build +++ b/meson.build @@ -82,6 +82,21 @@ foreach dep: [ endif endforeach +if host_machine.system() == 'windows' and not get_option('directsound').disabled() + dsound_dep = cc.find_library('dsound', required: get_option('directsound')) + winmm_dep = cc.find_library('winmm', required: get_option('directsound')) + ole32_dep = cc.find_library('ole32', required: get_option('directsound')) + have_dsound_h = cc.has_header('dsound.h') + if not have_dsound_h and get_option('directsound').enabled() + error('DirectSound enabled but dsound.h not found') + endif + if dsound_dep.found() and winmm_dep.found() and ole32_dep.found() and have_dsound_h + deps += [dsound_dep, winmm_dep, ole32_dep] + conf.set('WITH_DIRECTSOUND', '1') + dep_avail += 'DirectSound' + endif +endif + # TODO: OSS def_audio = get_option('default_audio_output') diff --git a/meson_options.txt b/meson_options.txt index 80e0ddf73..e99e25cc8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,7 +2,8 @@ option('alsa', type: 'feature', description: 'ALSA audio output') option('openal', type: 'feature', description: 'OpenAL audio output') option('libpulse', type: 'feature', description: 'PulseAudio audio output') option('portaudio', type: 'feature', description: 'PortAudio audio output') -option('default_audio_output', type: 'combo', choices: ['auto', 'ALSA', 'OpenAL', 'PulseAudio', 'PortAudio'], description: 'Default audio output') +option('directsound', type: 'feature', description: 'DirectSound audio output') +option('default_audio_output', type: 'combo', choices: ['auto', 'ALSA', 'OpenAL', 'PulseAudio', 'PortAudio', 'DirectSound'], description: 'Default audio output') option('ffms2', type: 'feature', description: 'FFMS2 video source') diff --git a/src/meson.build b/src/meson.build index df94b4b6f..183cfb075 100644 --- a/src/meson.build +++ b/src/meson.build @@ -181,6 +181,8 @@ opt_src = [ ['PulseAudio', 'audio_player_pulse.cpp'], ['OpenAL', 'audio_player_openal.cpp'], ['OSS', 'audio_player_oss.cpp'], + ['DirectSound', ['audio_player_dsound.cpp', + 'audio_player_dsound2.cpp']], ['FFMS2', ['audio_provider_ffmpegsource.cpp', 'video_provider_ffmpegsource.cpp',