aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/alsa/alsa-api-streams.c13
-rw-r--r--plugins/alsa/alsa-api-zones.c7
-rw-r--r--plugins/alsa/alsa-plug-dmix.c12
-rw-r--r--plugins/alsa/alsa-plug-rate.c12
-rw-r--r--plugins/alsa/alsa-plug-route.c13
-rw-r--r--plugins/alsa/alsa-plug-vol.c10
-rw-r--r--plugins/alsa/alsa-softmixer.h10
-rw-r--r--plugins/alsa/alsa-utils-bypath.c3
8 files changed, 50 insertions, 30 deletions
diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c
index 92e00c0..f577b69 100644
--- a/plugins/alsa/alsa-api-streams.c
+++ b/plugins/alsa/alsa-api-streams.c
@@ -687,19 +687,6 @@ static void streamDestroy(SoftMixerT * mixer, void * arg) {
AlsaPcmCopyStop(mixer, stream->copy);
freemem:
- if (stream->softvolConfig) {
- AFB_API_DEBUG(mixer->api, "%s... %s delete softvol config", __func__, stream->uid);
- snd_config_delete(stream->softvolConfig);
- snd_config_update();
- stream->softvolConfig = NULL;
- }
-
- if (stream->rateConfig) {
- AFB_API_DEBUG(mixer->api, "%s... %s delete rate config", __func__, stream->uid);
- snd_config_delete(stream->rateConfig);
- snd_config_update();
- stream->rateConfig = NULL;
- }
free((char*)stream->uid);
free((char*)stream->playback);
diff --git a/plugins/alsa/alsa-api-zones.c b/plugins/alsa/alsa-api-zones.c
index fcd29d7..8a2db1f 100644
--- a/plugins/alsa/alsa-api-zones.c
+++ b/plugins/alsa/alsa-api-zones.c
@@ -200,13 +200,6 @@ static void zoneDestroy(SoftMixerT* mixer, void * arg) {
AFB_API_DEBUG(mixer->api, "%s... %s (%d sinks, %d sources)", __func__, zone->uid, zone->nbSinks, zone->nbSources);
- if (zone->routeConfig) {
- AFB_API_DEBUG(mixer->api, "%s... %s delete route config", __func__, zone->uid);
- snd_config_delete(zone->routeConfig);
- snd_config_update();
- zone->routeConfig = NULL;
- }
-
AlsaPcmChannelT * channel, *tmp;
cds_list_for_each_entry_safe(channel, tmp, &zone->sinks.list, list) {
diff --git a/plugins/alsa/alsa-plug-dmix.c b/plugins/alsa/alsa-plug-dmix.c
index 8dd9507..b625865 100644
--- a/plugins/alsa/alsa-plug-dmix.c
+++ b/plugins/alsa/alsa-plug-dmix.c
@@ -24,6 +24,13 @@ static int uniqueIpcIndex = 1024;
ALSA_PLUG_PROTO(dmix);
+static void dmixConfigClean(SoftMixerT *mixer, void * arg) {
+ snd_config_t * dmixConfig = arg;
+ AFB_API_DEBUG(mixer->api, "%s... ", __func__);
+ snd_config_delete(dmixConfig);
+ snd_config_update();
+}
+
PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaSndPcmT *pcmSlave, int open) {
@@ -92,7 +99,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
if (error) goto OnErrorExit;
}
- /* It is critical to set the right number of channels ... know.
+ /* It is critical to set the right number of channels ... now.
* Trying to set another value later leads to silent failure
* */
@@ -121,6 +128,9 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
goto OnErrorExit;
}
+ pcmPlug->private_data = dmixConfig;
+ pcmPlug->private_data_clean = dmixConfigClean;
+
// Debug config & pcm
AlsaDumpCtlConfig(mixer, "plug-dmix", dmixConfig, 1);
AFB_API_NOTICE(mixer->api, "%s: %s done", __func__, pcmPlug->cid.cardid);
diff --git a/plugins/alsa/alsa-plug-rate.c b/plugins/alsa/alsa-plug-rate.c
index ef7c335..00ad3d4 100644
--- a/plugins/alsa/alsa-plug-rate.c
+++ b/plugins/alsa/alsa-plug-rate.c
@@ -23,6 +23,13 @@
ALSA_PLUG_PROTO(rate);
+static void rateConfigClean(SoftMixerT *mixer, void * arg) {
+ snd_config_t * rateConfig = arg;
+ AFB_API_DEBUG(mixer->api, "%s... rate config", __func__);
+ snd_config_delete(rateConfig);
+ snd_config_update();
+}
+
PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream, const char* pcmName, AlsaPcmCtlT *pcmSlave, AlsaPcmHwInfoT *params, int open) {
snd_config_t *rateConfig, *slaveConfig, *elemConfig, *pcmConfig;
@@ -71,8 +78,6 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream,
goto OnErrorExit;
}
- stream->rateConfig = rateConfig;
-
if (open) error = _snd_pcm_rate_open(&pcmPlug->handle, pcmPlug->cid.cardid, snd_config, rateConfig, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
if (error) {
AFB_API_ERROR(mixer->api,
@@ -81,6 +86,9 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream,
goto OnErrorExit;
}
+ pcmPlug->private_data = rateConfig;
+ pcmPlug->private_data_clean = rateConfigClean;
+
// Debug config & pcm
//AlsaDumpCtlConfig(mixer, "plug-rate", pcmConfig, 1);
AlsaDumpCtlConfig (mixer, "plug-rate", rateConfig, 1);
diff --git a/plugins/alsa/alsa-plug-route.c b/plugins/alsa/alsa-plug-route.c
index 8b49f99..72dee68 100644
--- a/plugins/alsa/alsa-plug-route.c
+++ b/plugins/alsa/alsa-plug-route.c
@@ -23,6 +23,14 @@
ALSA_PLUG_PROTO(route);
+static void routeConfigClean(SoftMixerT *mixer, void * arg) {
+ snd_config_t * routeConfig = arg;
+ AFB_API_DEBUG(mixer->api, "%s... route config", __func__);
+ snd_config_delete(routeConfig);
+ snd_config_update();
+}
+
+
typedef struct {
const char *uid;
const char *cardid;
@@ -81,7 +89,7 @@ OnErrorExit:
}
PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int open) {
- snd_config_t *routeConfig, *elemConfig, *slaveConfig, *tableConfig, *pcmConfig;
+ snd_config_t *routeConfig = NULL, *elemConfig, *slaveConfig, *tableConfig, *pcmConfig;
int error = 0;
ChannelCardPortT slave, channelCardPort;
AlsaPcmCtlT *pcmRoute = NULL;
@@ -279,7 +287,8 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
goto fail;
}
- zone->routeConfig = routeConfig;
+ pcmRoute->private_data = routeConfig;
+ pcmRoute->private_data_clean = routeConfigClean;
// Debug config & pcm
AFB_API_NOTICE(mixer->api, "%s: zone(%s) DONE", __func__, zone->uid);
diff --git a/plugins/alsa/alsa-plug-vol.c b/plugins/alsa/alsa-plug-vol.c
index 1e7496f..486c095 100644
--- a/plugins/alsa/alsa-plug-vol.c
+++ b/plugins/alsa/alsa-plug-vol.c
@@ -22,8 +22,13 @@
ALSA_PLUG_PROTO(softvol); // stream uses softvol plugin
-PUBLIC void AlsaDeleteSoftvol(SoftMixerT *mixer, AlsaPcmCtlT * ctl) {
+
+static void softVolConfigClean(SoftMixerT *mixer, void * arg) {
+ snd_config_t * softvolConfig = arg;
+ AFB_API_DEBUG(mixer->api, "%s... softvol config", __func__);
+ snd_config_delete(softvolConfig);
+ snd_config_update();
}
PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *stream, char* slaveid, AlsaSndCtlT *sndcard, char* ctlName, int max, int open) {
@@ -95,7 +100,8 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
goto OnErrorExit;
}
- stream->softvolConfig = streamConfig;
+ pcmVol->private_data = streamConfig;
+ pcmVol->private_data_clean = softVolConfigClean;
// Debug config & pcm
//AlsaDumpCtlConfig (mixer, "plug-config", pcmConfig, 1);
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h
index 376635a..9710dd3 100644
--- a/plugins/alsa/alsa-softmixer.h
+++ b/plugins/alsa/alsa-softmixer.h
@@ -128,6 +128,9 @@ typedef struct {
bool closeAtDeletion; // intermediate pcms in the pcm chain must not be closed, else it make libasound abort()
bool isPcmPlug;
+
+ void * private_data;
+ void (*private_data_clean) (struct SoftMixerT_ *, void *);
unsigned int quirks;
} AlsaPcmCtlT;
@@ -224,14 +227,17 @@ typedef struct {
int ccount;
AlsaPcmHwInfoT *params;
struct cds_list_head list;
- snd_config_t * routeConfig;
+
bool isPcmPlug;
unsigned int quirks;
} AlsaSndZoneT;
+
/* This is a list of known sound card (hardware or driver) specific bugs */
+
/* - do not trust the result of snd_pcm_poll_descriptors_revents */
#define QUIRK_BOGUS_POLL_REVENTS_DEMANGLING (1<<0)
+
typedef struct {
const char *uid;
const char *verb;
@@ -286,8 +292,6 @@ typedef struct AlsaStreamAudioT_ {
struct cds_list_head list; /* link to the global list*/
AlsaPcmCtlT * softvol;
- snd_config_t * softvolConfig;
- snd_config_t * rateConfig;
void * verbApiHandle;
bool optional;
bool noHwDetected;
diff --git a/plugins/alsa/alsa-utils-bypath.c b/plugins/alsa/alsa-utils-bypath.c
index a1b5826..853cf95 100644
--- a/plugins/alsa/alsa-utils-bypath.c
+++ b/plugins/alsa/alsa-utils-bypath.c
@@ -93,6 +93,9 @@ PUBLIC void AlsaPcmCtlDelete(SoftMixerT* mixer, void * arg) {
AFB_API_DEBUG(mixer->api, "%s of %s (plug: %d)", __func__, pcmCtl->name, pcmCtl->isPcmPlug);
+ if (pcmCtl->private_data_clean)
+ pcmCtl->private_data_clean(mixer, pcmCtl->private_data);
+
if (!pcmCtl->closeAtDeletion)
goto done;