need pulseaudio >=0.9.15. call pa_threaded_mainloop_set_name only if available.

This commit is contained in:
Ozkan Sezer 2023-07-12 21:39:41 +03:00
parent e8b6edd5a0
commit 29d461b628
4 changed files with 25 additions and 28 deletions

View file

@ -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)

20
configure vendored
View file

@ -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

View file

@ -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,

View file

@ -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);