summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Marec <frederic.marec@iot.bzh>2019-05-22 15:20:47 +0200
committerWalt Miner <walt@linux.com>2019-05-24 13:48:19 +0000
commit40aa428a3dff2c8d731d27d0867ff96e95dec938 (patch)
treecd84a73c6efa0d6eaf3122430e3cc9bbae356296
parent8929f4ec3744b9cc1ff5facdb0ff15ea9dd2aca1 (diff)
4a-softmixer: remove AVIRT dependencieshalibut_7.99.1halibut/7.99.17.99.1
Remove AVIRT dependencies when you build on host Bug-AGL: SPEC-2443 Change-Id: I4bf8f39e843d552337fafcdbebe4c82a2290b24e Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
-rw-r--r--conf.d/cmake/00-default-osconfig.cmake2
-rw-r--r--conf.d/cmake/config.cmake5
-rw-r--r--plugins/alsa/alsa-api-loop.c12
-rw-r--r--plugins/alsa/alsa-api-streams.c1
4 files changed, 15 insertions, 5 deletions
diff --git a/conf.d/cmake/00-default-osconfig.cmake b/conf.d/cmake/00-default-osconfig.cmake
index c089c52..de39a53 100644
--- a/conf.d/cmake/00-default-osconfig.cmake
+++ b/conf.d/cmake/00-default-osconfig.cmake
@@ -1 +1 @@
-list(APPEND PKG_REQUIRED_LIST alsa>=1.1.6)
+list(APPEND PKG_REQUIRED_LIST alsa>=1.1.6) \ No newline at end of file
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
index 2da7bb8..af29b97 100644
--- a/conf.d/cmake/config.cmake
+++ b/conf.d/cmake/config.cmake
@@ -87,7 +87,10 @@ set (PKG_REQUIRED_LIST
# Customize link option
# -----------------------------
#list(APPEND link_libraries -an-option)
-list(APPEND link_libraries afb-helpers avirt)
+list(APPEND link_libraries afb-helpers)
+if(HAVE_AVIRT)
+ list(APPEND link_libraries avirt)
+endif()
# Compilation options definition
# Use CMake generator expressions to specify only for a specific language
diff --git a/plugins/alsa/alsa-api-loop.c b/plugins/alsa/alsa-api-loop.c
index a4595dc..b3b96ed 100644
--- a/plugins/alsa/alsa-api-loop.c
+++ b/plugins/alsa/alsa-api-loop.c
@@ -19,7 +19,11 @@
#define _GNU_SOURCE // needed for vasprintf
#include "alsa-softmixer.h"
+
+#ifdef HAVE_AVIRT
#include <avirt/avirt.h>
+#endif
+
#include <string.h>
#define UID_AVIRT_LOOP "AVIRT-Loopback"
@@ -157,7 +161,7 @@ STATIC AlsaLoopSubdevT *ProcessOneAvirtSubdev(SoftMixerT *mixer, AlsaSndLoopT *l
AFB_API_ERROR(mixer->api, "%s: No zones defined!", __func__);
goto OnErrorExit;
}
-
+#ifdef HAVE_AVIRT
error = snd_avirt_stream_new(uid, zone->ccount,
SND_PCM_STREAM_PLAYBACK, "ap_loopback", false);
if (error < 0) {
@@ -166,7 +170,7 @@ STATIC AlsaLoopSubdevT *ProcessOneAvirtSubdev(SoftMixerT *mixer, AlsaSndLoopT *l
__func__, mixer->uid, uid, error);
return NULL;
}
-
+#endif
AlsaLoopSubdevT *subdev = calloc(1, sizeof (AlsaPcmCtlT));
subdev->uid = NULL;
subdev->index = index;
@@ -331,6 +335,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
goto fail_snd_card_ctl;
}
} else { // loop->avirt == true
+#ifdef HAVE_AVIRT
AFB_API_NOTICE(mixer->api, "nbStreams: %d max.streams: %d", mixer->nbStreams, mixer->max.streams);
if (mixer->nbStreams >= mixer->max.streams)
@@ -373,6 +378,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
__func__, mixer->uid, uid, loop->uid, loop->sndcard->cid.devpath, loop->sndcard->cid.cardid);
goto fail_snd_card;
}
+#endif
}
AFB_API_NOTICE(mixer->api, "%s, uid %s DONE", __func__, uid);
@@ -415,8 +421,10 @@ static void loopDestroy(SoftMixerT * mixer, void* arg) {
mixer->nbLoops--;
cds_list_del(&loop->list);
+#ifdef HAVE_AVIRT
if (loop->avirt)
snd_avirt_card_unconfigure();
+#endif
free(loop);
AFB_API_DEBUG(mixer->api, "DONE !");
diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c
index 21e36eb..326efa4 100644
--- a/plugins/alsa/alsa-api-streams.c
+++ b/plugins/alsa/alsa-api-streams.c
@@ -19,7 +19,6 @@
#define _GNU_SOURCE // needed for vasprintf
#include "alsa-softmixer.h"
-#include <avirt/avirt.h>
#include <string.h>
#include <stdbool.h>