diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 0b2a88661..97b2e47d9 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -166,7 +166,7 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckPulseAudio) if(SDL_PULSEAUDIO) - pkg_check_modules(PKG_PULSEAUDIO libpulse-simple) + pkg_check_modules(PKG_PULSEAUDIO libpulse-simple>=0.9.15) if(PKG_PULSEAUDIO_FOUND) set(HAVE_PULSEAUDIO TRUE) file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c) diff --git a/configure b/configure index b107f6a95..026c79cee 100755 --- a/configure +++ b/configure @@ -22083,19 +22083,19 @@ fi if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpulse-simple >= 0.9" >&5 -printf %s "checking for libpulse-simple >= 0.9... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpulse-simple >= 0.9.15" >&5 +printf %s "checking for libpulse-simple >= 0.9.15... " >&6; } if test -n "$PULSEAUDIO_CFLAGS"; then pkg_cv_PULSEAUDIO_CFLAGS="$PULSEAUDIO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9.15\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9.15") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-simple >= 0.9" 2>/dev/null` + pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-simple >= 0.9.15" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -22107,12 +22107,12 @@ if test -n "$PULSEAUDIO_LIBS"; then pkg_cv_PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9.15\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9.15") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-simple >= 0.9" 2>/dev/null` + pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-simple >= 0.9.15" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -22133,9 +22133,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpulse-simple >= 0.9" 2>&1` + PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpulse-simple >= 0.9.15" 2>&1` else - PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpulse-simple >= 0.9" 2>&1` + PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpulse-simple >= 0.9.15" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PULSEAUDIO_PKG_ERRORS" >&5 diff --git a/configure.ac b/configure.ac index d3d0a07f0..b6a1d5e58 100644 --- a/configure.ac +++ b/configure.ac @@ -1122,7 +1122,7 @@ CheckPulseAudio() [AS_HELP_STRING([--enable-pulseaudio], [use PulseAudio [default=yes]])], , enable_pulseaudio=yes) if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then - PKG_CHECK_MODULES([PULSEAUDIO], [libpulse-simple >= 0.9], audio_pulseaudio=yes, audio_pulseaudio=no) + PKG_CHECK_MODULES([PULSEAUDIO], [libpulse-simple >= 0.9.15], audio_pulseaudio=yes, audio_pulseaudio=no) if test x$audio_pulseaudio = xyes; then AC_ARG_ENABLE(pulseaudio-shared, diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 19bc8a10f..b2f5d5b00 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -56,20 +56,6 @@ static char *default_sink_name = NULL; static char *default_source_name = NULL; - -#if (PA_API_VERSION < 12) -/** Return non-zero if the passed state is one of the connected states */ -static SDL_INLINE int PA_CONTEXT_IS_GOOD(pa_context_state_t x) -{ - return x == PA_CONTEXT_CONNECTING || x == PA_CONTEXT_AUTHORIZING || x == PA_CONTEXT_SETTING_NAME || x == PA_CONTEXT_READY; -} -/** Return non-zero if the passed state is one of the connected states */ -static SDL_INLINE int PA_STREAM_IS_GOOD(pa_stream_state_t x) -{ - return x == PA_STREAM_CREATING || x == PA_STREAM_READY; -} -#endif /* pulseaudio <= 0.9.10 */ - static const char *(*PULSEAUDIO_pa_get_library_version)(void); static pa_channel_map *(*PULSEAUDIO_pa_channel_map_init_auto)( pa_channel_map *, unsigned, pa_channel_map_def_t); @@ -199,7 +185,6 @@ static int load_pulseaudio_syms(void) { SDL_PULSEAUDIO_SYM(pa_get_library_version); SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_new); - SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_set_name); SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_get_api); SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_start); SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_stop); @@ -242,6 +227,16 @@ static int load_pulseaudio_syms(void) SDL_PULSEAUDIO_SYM(pa_stream_set_write_callback); SDL_PULSEAUDIO_SYM(pa_stream_set_read_callback); SDL_PULSEAUDIO_SYM(pa_context_get_server_info); + + /* optional */ +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC + load_pulseaudio_sym("pa_threaded_mainloop_set_name", (void **)(char *)&PULSEAUDIO_pa_threaded_mainloop_set_name); +#elif (PA_PROTOCOL_VERSION >= 29) + PULSEAUDIO_pa_threaded_mainloop_set_name = pa_threaded_mainloop_set_name; +#else + PULSEAUDIO_pa_threaded_mainloop_set_name = NULL; +#endif + return 0; } @@ -322,7 +317,9 @@ static int ConnectToPulseServer(void) return SDL_SetError("pa_threaded_mainloop_new() failed"); } - PULSEAUDIO_pa_threaded_mainloop_set_name(pulseaudio_threaded_mainloop, "PulseMainloop"); + if (PULSEAUDIO_pa_threaded_mainloop_set_name) { + PULSEAUDIO_pa_threaded_mainloop_set_name(pulseaudio_threaded_mainloop, "PulseMainloop"); + } if (PULSEAUDIO_pa_threaded_mainloop_start(pulseaudio_threaded_mainloop) < 0) { PULSEAUDIO_pa_threaded_mainloop_free(pulseaudio_threaded_mainloop);