Skip to contentSkip to conversation

jack: Allow build with older alsa-lib

PATCH In review Takashi Iwai 1 participant 3 messages Jul 3, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 jack: Allow build with older alsa-lib

The new API snd_pcm_ioplug_avail() doesn't appear prior to alsa-lib 1.1.7. Add an own code for allowing the build with alsa-lib 1.1.6.

It has a very slight overhead than the original snd_pcm_ioplug_avail() but should be OK as a workaround.

---
 jack/pcm_jack.c | 9 +++++++++
 1 file changed, 9 insertions(+)
jack/pcm_jack.c +9 -0
index 98a6f7ebb82e..fbc9dafc594b 100644
@@ -58,6 +58,15 @@ typedef struct {
 
 static int snd_pcm_jack_stop(snd_pcm_ioplug_t *io);
 
+/* snd_pcm_ioplug_avail() was introduced after alsa-lib 1.1.6 */
+#if SND_LIB_VERSION < 0x10107
+static snd_pcm_uframes_t snd_pcm_ioplug_avail(const snd_pcm_ioplug_t *io,
+					      const snd_pcm_uframes_t hw_ptr,
+					      const snd_pcm_uframes_t appl_ptr)
+{
+	return io->buffer_size - snd_pcm_ioplug_hw_avail(io, hw_ptr, appl_ptr);
+}
+#endif
 
 static int pcm_poll_block_check(snd_pcm_ioplug_t *io)
 {
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/2 configure: Require alsa-lib 1.1.6 and newer

JACK plugin requires the recently added API function.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index f49bb6bcd9af..3e2d233aa5a2 100644
@@ -16,7 +16,7 @@ AC_HEADER_STDC
 
 CC_NOUNDEFINED
 
-PKG_CHECK_MODULES(ALSA, alsa >= 1.0.11)
+PKG_CHECK_MODULES(ALSA, alsa >= 1.1.6)
 AC_CHECK_LIB(asound, snd_pcm_ioplug_create,,
 	     AC_ERROR([*** libasound has no external plugin SDK]), -ldl)
 
Signature · 1 line
2.18.0
#2 lore raw
In reply to Takashi Iwai
Quoted 8 lines · Takashi Iwai

The new API snd_pcm_ioplug_avail() doesn't appear prior to alsa-lib 1.1.7. Add an own code for allowing the build with alsa-lib 1.1.6.

It has a very slight overhead than the original snd_pcm_ioplug_avail() but should be OK as a workaround.

Note: these two patches are for alsa-lib.
Forgot to add "alsa-lib" prefix in the subject line, sorry.

Takashi