diff --git a/configure.ac b/configure.ac index 6da71057b..242229f95 100644 --- a/configure.ac +++ b/configure.ac @@ -404,12 +404,19 @@ ENABLE_PLUGIN_WITH_DEP(pulse, PULSE, libpulse >= 0.9.5) -ENABLE_PLUGIN_WITH_DEP(sndio, +test_sndio () { + PKG_CHECK_MODULES(SNDIO, sndio >= 1.9, [ + AC_DEFINE(HAVE_SNDIO_1_9, 1, [Define if sndio version is >= 1.9]) + have_sndio=yes + ], [ + PKG_CHECK_MODULES(SNDIO, sndio, have_sndio=yes, have_sndio=no) + ]) +} + +ENABLE_PLUGIN_WITH_TEST(sndio, Sndio output, auto, - OUTPUT, - SNDIO, - sndio) + OUTPUT) test_cue () { PKG_CHECK_MODULES(CUE, libcue >= 2.0, [ diff --git a/src/config.h.meson b/src/config.h.meson index fe08478d4..d191e7715 100644 --- a/src/config.h.meson +++ b/src/config.h.meson @@ -28,6 +28,7 @@ #mesondefine FILEWRITER_VORBIS #mesondefine HAVE_LIBCUE2 +#mesondefine HAVE_SNDIO_1_9 #mesondefine HAVE_ADPLUG_NEMUOPL_H #mesondefine HAVE_ADPLUG_WEMUOPL_H diff --git a/src/sndio/meson.build b/src/sndio/meson.build index 256378120..2939960ef 100644 --- a/src/sndio/meson.build +++ b/src/sndio/meson.build @@ -2,6 +2,11 @@ sndio_dep = dependency('sndio', required: false) have_sndio = sndio_dep.found() +if sndio_dep.version().version_compare('>= 1.9.0') + conf.set10('HAVE_SNDIO_1_9', true) +endif + + if have_sndio shared_module('sndio-ng', 'sndio.cc', diff --git a/src/sndio/sndio.cc b/src/sndio/sndio.cc index d53000d8f..1fd0f6a54 100644 --- a/src/sndio/sndio.cc +++ b/src/sndio/sndio.cc @@ -344,7 +344,11 @@ void SndioPlugin::flush () { pthread_mutex_lock (& m_mutex); +#if HAVE_SNDIO_1_9 + sio_flush (m_handle); +#else sio_stop (m_handle); +#endif m_frames_buffered = 0; m_last_write_time = timeval ();