aboutsummaryrefslogtreecommitdiffstats
path: root/mixer-binding/mixer-binding.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-08-31 13:53:47 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2018-08-31 13:53:47 +0200
commit80deafbe1bfb87c3a5e9f547c9491afd210e736a (patch)
tree67f83684cf67268dcb65d8062280f848057a74c2 /mixer-binding/mixer-binding.c
parentded8e37b50982677480869763f3573ff43858505 (diff)
Added bluez sound playback support
This adds sound playback for incoming sound from connected bluetooth devices. In this version, the softmixer relies on a modified bluez-alsa version (https://github.com/iotbzh/bluez-alsa), that provides an ioplug PCM bluezalsa connection proxy. The softmixer api has a new verb to dynamically set the device to listen to: afb-client-demo ws://localhost:1234/api?token=\uuid=123 smixer bluezalsa_dev '{"interface":"hci0", "device":"F6:32:15:2A:80:70", "profile":"a2dp"}' In this way it is possible to switch from a bluezalsa audio source to another without any further configuration. For now, only interface hci0 is supported. This commit also migrates the softmixer binding to API v3 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'mixer-binding/mixer-binding.c')
-rw-r--r--mixer-binding/mixer-binding.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/mixer-binding/mixer-binding.c b/mixer-binding/mixer-binding.c
index 3af9c9b..ed5b5a8 100644
--- a/mixer-binding/mixer-binding.c
+++ b/mixer-binding/mixer-binding.c
@@ -23,8 +23,8 @@
#include "mixer-binding.h"
-// default api to print log when apihandle not avaliable
-PUBLIC afb_dynapi *AFB_default;
+// default api to print log when apihandle not avalaible
+PUBLIC afb_api_t AFB_default;
// Config Section definition (note: controls section index should match handle retrieval in HalConfigExec)
static CtlSectionT ctrlSections[]= {
@@ -52,16 +52,16 @@ STATIC AFB_ApiVerbs CtrlApiVerbs[] = {
{ .verb = NULL} /* marker for end of the array */
};
-STATIC int CtrlLoadStaticVerbs (afb_dynapi *apiHandle, AFB_ApiVerbs *verbs) {
+STATIC int CtrlLoadStaticVerbs (afb_api_t apiHandle, AFB_ApiVerbs *verbs) {
int errcount=0;
for (int idx=0; verbs[idx].verb; idx++) {
- errcount+= afb_dynapi_add_verb(apiHandle,
- CtrlApiVerbs[idx].verb,
- CtrlApiVerbs[idx].info,
- CtrlApiVerbs[idx].callback,
- (void*)&CtrlApiVerbs[idx],
- CtrlApiVerbs[idx].auth, 0);
+ errcount+= afb_api_add_verb(apiHandle,
+ CtrlApiVerbs[idx].verb,
+ CtrlApiVerbs[idx].info,
+ CtrlApiVerbs[idx].callback,
+ (void*)&CtrlApiVerbs[idx],
+ CtrlApiVerbs[idx].auth, 0, 0);
}
return errcount;
@@ -75,7 +75,7 @@ STATIC int CtrlLoadOneApi (void *cbdata, AFB_ApiT apiHandle) {
CtlConfigT *ctrlConfig = (CtlConfigT*) cbdata;
// save closure as api's data context
- afb_dynapi_set_userdata(apiHandle, ctrlConfig);
+ afb_api_set_userdata(apiHandle, ctrlConfig);
// add static controls verbs
int error = CtrlLoadStaticVerbs (apiHandle, CtrlApiVerbs);
@@ -88,7 +88,7 @@ STATIC int CtrlLoadOneApi (void *cbdata, AFB_ApiT apiHandle) {
error= CtlLoadSections(apiHandle, ctrlConfig, ctrlSections);
// declare an event event manager for this API;
- afb_dynapi_on_event(apiHandle, CtrlDispatchApiEvent);
+ afb_api_on_event(apiHandle, CtrlDispatchApiEvent);
// should not seal API as each mixer+stream create a new verb
// afb_dynapi_seal(apiHandle);
@@ -98,7 +98,7 @@ OnErrorExit:
return 1;
}
-PUBLIC int afbBindingEntry(afb_dynapi *apiHandle) {
+PUBLIC int afbBindingEntry(afb_api_t apiHandle) {
AFB_default = apiHandle;
@@ -128,10 +128,12 @@ PUBLIC int afbBindingEntry(afb_dynapi *apiHandle) {
AFB_ApiNotice (apiHandle, "Controller API='%s' info='%s'", ctrlConfig->api, ctrlConfig->info);
// create one API per config file (Pre-V3 return code ToBeChanged)
- int status = afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig);
+ afb_api_t handle = afb_api_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig);
+
+ int status = 0;
// config exec should be done after api init in order to enable onload to use newly defined ctl API.
- if (!status)
+ if (handle)
status = CtlConfigExec (apiHandle, ctrlConfig);
return status;