summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-plug-rate.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-12-04 23:11:20 +0100
committerThierry Bultel <thierry.bultel@iot.bzh>2018-12-19 23:09:21 +0100
commite0f57e523112e1bc73a04e8615d7a21355f0ce0e (patch)
tree19198c38d7433862cee733fde3efca8170228279 /plugins/alsa/alsa-plug-rate.c
parent7df040a3742af8d800852dd39f8e921cd82a4cf2 (diff)
Add support for bluetooth telephonyguppy_6.99.3guppy/6.99.36.99.3
This adds support for bluetooth telephony. A big rework in the softmixer internals has been mandatory, in order to support dynamic streams creation and deletions. Bluetooth telephony relies on the recent evolutions of bluez-alsa, the most important one being the support of HFP over Ofono. The softmixer opens PCM ioplugs provided by bluez-alsa. Bluetooth SCO needs 2 streams, one for listening and the other for talking. These streams are created upon requests sent by the hal-manager. The hal manager subscribes for bluez-alsa events and request the list of availalble transports. For each "attach" transaction verb, the softmixer maintains a list of the all created objects (sources, sinks, zones, ramps, streams, and more) Additionnally, it creates a new verb when the attach succeeds, that verb is typically something like "sco_XX:XX:XX:XX:XX:XX", and the only supported action at the present time is {"action":"remove"}, that performs all the cleanup of the registered objects. Change-Id: I1b119e6c079e60daf771e63c083a1ef33a39f379 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-plug-rate.c')
-rw-r--r--plugins/alsa/alsa-plug-rate.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/plugins/alsa/alsa-plug-rate.c b/plugins/alsa/alsa-plug-rate.c
index 085ad78..b2c43d2 100644
--- a/plugins/alsa/alsa-plug-rate.c
+++ b/plugins/alsa/alsa-plug-rate.c
@@ -23,10 +23,18 @@
ALSA_PLUG_PROTO(rate);
-PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, const char* pcmName, AlsaPcmCtlT *pcmSlave, AlsaPcmHwInfoT *params, int open) {
+PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream, const char* pcmName, AlsaPcmCtlT *pcmSlave, AlsaPcmHwInfoT *params, int open) {
snd_config_t *rateConfig, *slaveConfig, *elemConfig, *pcmConfig;
- AlsaPcmCtlT *pcmPlug = calloc(1, sizeof (AlsaPcmCtlT));
+
+ AFB_ApiDebug(mixer->api,"%s : %s", __func__, pcmName);
+
+ AlsaPcmCtlT *pcmPlug = AlsaPcmCtlNew(mixer, pcmName);
+ if (!pcmPlug) {
+ SOFTMIXER_NOMEM(mixer->api);
+ goto OnErrorExit;
+ }
+
pcmPlug->cid.cardid = pcmName;
int error = 0;
@@ -59,24 +67,28 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, const char* pcmName, AlsaP
error += snd_config_search(snd_config, "pcm", &pcmConfig);
error += snd_config_add(pcmConfig, rateConfig);
if (error) {
- AFB_ApiError(mixer->api, "AlsaCreateRate: fail to add configRATE=%s", pcmPlug->cid.cardid);
+ AFB_ApiError(mixer->api, "%s: fail to add config RATE=%s", __func__, pcmPlug->cid.cardid);
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_ApiError(mixer->api, "AlsaCreateRate: fail to create Rate=%s Slave=%s Error=%s", pcmPlug->cid.cardid, pcmSlave->cid.cardid, snd_strerror(error));
+ AFB_ApiError(mixer->api,
+ "%s: fail to create Rate=%s Slave=%s Error=%s",
+ __func__, pcmPlug->cid.cardid, pcmSlave->cid.cardid, snd_strerror(error));
goto OnErrorExit;
}
// Debug config & pcm
//AlsaDumpCtlConfig(mixer, "plug-rate", pcmConfig, 1);
- //AlsaDumpCtlConfig (mixer, "plug-rate", rateConfig, 1);
- AFB_ApiNotice(mixer->api, "AlsaCreateRate: %s done", pcmPlug->cid.cardid);
+ AlsaDumpCtlConfig (mixer, "plug-rate", rateConfig, 1);
+ AFB_ApiNotice(mixer->api, "%s: %s done", __func__, pcmPlug->cid.cardid);
return pcmPlug;
OnErrorExit:
AlsaDumpCtlConfig(mixer, "plug-rate", rateConfig, 1);
- AFB_ApiNotice(mixer->api, "AlsaCreateRate: OnErrorExit");
+ AFB_ApiNotice(mixer->api, "%s: OnErrorExit", __func__);
return NULL;
}