From 4f077e1f275189d1e70d8ecca89f9cebae514c55 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 9 Mar 2025 20:33:39 +0200 Subject: [PATCH] spa: fix ALSA UMP support detection in meson --- spa/meson.build | 4 ++++ spa/plugins/alsa/alsa-seq.c | 16 ++++++++-------- spa/plugins/alsa/alsa-seq.h | 4 +++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index 9d0009868..9faaae48a 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -46,6 +46,10 @@ if get_option('spa-plugins').allowed() alsa_dep = dependency('alsa', version : '>=1.2.6', required: get_option('alsa')) summary({'ALSA': alsa_dep.found()}, bool_yn: true, section: 'Backend') + if alsa_dep.version().version_compare('>=1.2.10') + cdata.set('HAVE_ALSA_UMP', true) + endif + bluez_dep = dependency('bluez', version : '>= 4.101', required: get_option('bluez5')) bluez_gio_dep = dependency('gio-2.0', required : get_option('bluez5')) bluez_gio_unix_dep = dependency('gio-unix-2.0', required : get_option('bluez5')) diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index 8ca7405d8..fcf6dd09a 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -42,7 +42,7 @@ static int seq_open(struct seq_state *state, struct seq_conn *conn, bool with_qu return 0; } -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP res = snd_seq_set_client_midi_version(conn->hndl, SND_SEQ_CLIENT_UMP_MIDI_2_0); #else res = -EOPNOTSUPP; @@ -223,7 +223,7 @@ static void alsa_seq_on_sys(struct spa_source *source) const snd_seq_addr_t *addr; if (state->ump) { -#if ALSA_UMP +#ifdef HAVE_ALSA_UMP snd_seq_ump_event_t *ump_ev; res = snd_seq_ump_event_input(state->sys.hndl, &ump_ev); @@ -583,7 +583,7 @@ static int process_read(struct seq_state *state) struct seq_port *port; uint64_t ev_time, diff; uint32_t offset; -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP snd_seq_ump_event_t *ump_ev; #endif uint8_t *midi1_ptr; @@ -591,7 +591,7 @@ static int process_read(struct seq_state *state) uint64_t ump_state = 0; if (state->ump) { -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP res = snd_seq_ump_event_input(state->event.hndl, &ump_ev); if (res <= 0) break; @@ -627,7 +627,7 @@ static int process_read(struct seq_state *state) } if (state->ump) { -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP data = (uint32_t*)&ump_ev->ump[0]; size = spa_ump_message_size(snd_ump_msg_hdr_type(ump_ev->ump[0])) * 4; #else @@ -783,7 +783,7 @@ static int process_write(struct seq_state *state) SPA_POD_SEQUENCE_FOREACH(pod, c) { snd_seq_event_t *ev; snd_seq_event_t midi1_ev; -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP snd_seq_ump_event_t ump_ev; #endif size_t body_size; @@ -796,7 +796,7 @@ static int process_write(struct seq_state *state) body_size = SPA_POD_BODY_SIZE(&c->value); if (state->ump) { -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP spa_zero(ump_ev); memcpy(ump_ev.ump, body, SPA_MIN(sizeof(ump_ev.ump), (size_t)body_size)); ev = (snd_seq_event_t *)&ump_ev; @@ -835,7 +835,7 @@ static int process_write(struct seq_state *state) ev->type, out_time, c->offset, body_size, port->addr.client, port->addr.port); if (state->ump) { -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP if ((err = snd_seq_ump_event_output(state->event.hndl, &ump_ev)) < 0) { spa_log_warn(state->log, "failed to output event: %s", snd_strerror(err)); diff --git a/spa/plugins/alsa/alsa-seq.h b/spa/plugins/alsa/alsa-seq.h index 0546459db..274311c70 100644 --- a/spa/plugins/alsa/alsa-seq.h +++ b/spa/plugins/alsa/alsa-seq.h @@ -12,8 +12,10 @@ extern "C" { #include #include +#include "config.h" + #include -#ifdef ALSA_UMP +#ifdef HAVE_ALSA_UMP #include #endif