diff options
-rw-r--r-- | conf.d/cmake/00-default-osconfig.cmake | 2 | ||||
-rw-r--r-- | conf.d/cmake/config.cmake | 5 | ||||
-rw-r--r-- | plugins/alsa/alsa-api-loop.c | 12 | ||||
-rw-r--r-- | plugins/alsa/alsa-api-streams.c | 1 |
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> |