File 0004-kodi-workaround-pipewire-bug.patch of Package kodi

diff -rup a/tools/Linux/kodi.sh.in b/tools/Linux/kodi.sh.in
--- a/tools/Linux/kodi.sh.in	2024-04-06 04:29:22.000000000 +0200
+++ b/tools/Linux/kodi.sh.in	2024-04-22 17:58:07.556342563 +0200
@@ -171,6 +171,7 @@ if command_exists gdb; then
   fi
 fi
 
+ENV_ARGS=
 if [ -n "${KODI_AE_SINK}" ]; then
 
   echo "KODI_AE_SINK env variable is deprecated and will be removed in the future."
@@ -189,6 +190,14 @@ if [ -n "${KODI_AE_SINK}" ]; then
   elif [ "${KODI_AE_SINK}" = "ALSA+PULSE" ]; then
     ENV_ARGS="--audio-backend=alsa+pulseaudio"
   fi
+else
+  # Work around a possibly broken installation of pipewire on openSUSE Leap
+  # see 'https://bugzilla.opensuse.org/show_bug.cgi?id=1222636'
+  if [ -x ${prefix}/bin/pulseaudio ] &&
+     [ -x ${prefix}/bin/pipewire ] &&
+     [ ! -x ${prefix}/bin/pipewire-pulse ]; then
+    ENV_ARGS="--audio-backend=pulseaudio"
+  fi
 fi
 
 if [ -n "${KODI_GL_INTERFACE}" ]; then
@@ -197,11 +206,11 @@ if [ -n "${KODI_GL_INTERFACE}" ]; then
   echo "Use the --gl-interface command line switch instead."
 
   if [ "${KODI_GL_INTERFACE}" = "GLX" ]; then
-    ENV_ARGS="--gl-interface=glx"
+    ENV_ARGS="${ENV_ARGS} --gl-interface=glx"
   elif [ "${KODI_GL_INTERFACE}" = "EGL" ]; then
-    ENV_ARGS="--gl-interface=egl"
+    ENV_ARGS="${ENV_ARGS} --gl-interface=egl"
   elif [ "${KODI_GL_INTERFACE}" = "EGL_PB" ]; then
-    ENV_ARGS="--gl-interface=egl-pb"
+    ENV_ARGS="${ENV_ARGS} --gl-interface=egl-pb"
   fi
 fi