aboutsummaryrefslogtreecommitdiffstats
path: root/mixer-binding/mixer-binding.c
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2018-06-06 11:47:08 +0200
committerfulup <fulup.arfoll@iot.bzh>2018-06-06 11:57:25 +0200
commit1594606d160d61153cf2396befdefdcf24a0b4eb (patch)
tree726645b48d3b0b3bc157ed6b1007bbc10f4e3791 /mixer-binding/mixer-binding.c
parent7aaf36d8e729400f7efc75d7e03e162e1f262293 (diff)
Move smixer API create+attach into controller onload section
Diffstat (limited to 'mixer-binding/mixer-binding.c')
-rw-r--r--mixer-binding/mixer-binding.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/mixer-binding/mixer-binding.c b/mixer-binding/mixer-binding.c
index edfb408..ab61baa 100644
--- a/mixer-binding/mixer-binding.c
+++ b/mixer-binding/mixer-binding.c
@@ -30,7 +30,7 @@ PUBLIC afb_dynapi *AFB_default;
static CtlSectionT ctrlSections[]= {
{.key="resources" , .loadCB= PluginConfig},
{.key="onload" , .loadCB= OnloadConfig},
- {.key="controls", .loadCB= ControlConfig},
+ // {.key="controls", .loadCB= ControlConfig},
{.key=NULL}
};
@@ -62,18 +62,6 @@ STATIC int CtrlLoadStaticVerbs (afb_dynapi *apiHandle, AFB_ApiVerbs *verbs) {
return errcount;
};
-
-STATIC int CtrlInitOneApi (AFB_ApiT apiHandle) {
-
- AFB_default = apiHandle; // hugely hack to make all V2 AFB_DEBUG to work in fileutils
-
- // retrieve section config from api handle
- CtlConfigT *ctrlConfig = (CtlConfigT*) afb_dynapi_get_userdata(apiHandle);
- int err = CtlConfigExec (apiHandle, ctrlConfig);
-
- return err;
-}
-
// next generation dynamic API-V3 mode
#include <signal.h>
@@ -85,24 +73,21 @@ STATIC int CtrlLoadOneApi (void *cbdata, AFB_ApiT apiHandle) {
afb_dynapi_set_userdata(apiHandle, ctrlConfig);
// add static controls verbs
- int err = CtrlLoadStaticVerbs (apiHandle, CtrlApiVerbs);
- if (err) {
+ int error = CtrlLoadStaticVerbs (apiHandle, CtrlApiVerbs);
+ if (error) {
AFB_ApiError(apiHandle, "CtrlLoadSection fail to Registry static V2 verbs");
goto OnErrorExit;
}
// load section for corresponding API
- err= CtlLoadSections(apiHandle, ctrlConfig, ctrlSections);
+ error= CtlLoadSections(apiHandle, ctrlConfig, ctrlSections);
// declare an event event manager for this API;
afb_dynapi_on_event(apiHandle, CtrlDispatchApiEvent);
- // init API function (does not receive user closure ???
- afb_dynapi_on_init(apiHandle, CtrlInitOneApi);
-
// should not seal API as each mixer+stream create a new verb
// afb_dynapi_seal(apiHandle);
- return err;
+ return error;
OnErrorExit:
return 1;
@@ -130,7 +115,6 @@ PUBLIC int afbBindingVdyn(afb_dynapi *apiHandle) {
goto OnErrorExit;
}
-
if (!ctrlConfig->api) {
AFB_ApiError(apiHandle, "CtrlBindingDyn API Missing from metadata in:\n-- %s", configPath);
goto OnErrorExit;
@@ -140,6 +124,10 @@ PUBLIC int afbBindingVdyn(afb_dynapi *apiHandle) {
// 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);
+ // config exec should be done after api init in order to enable onload to use newly defined ctl API.
+ if (!status)
+ status = CtlConfigExec (apiHandle, ctrlConfig);
+
return status;
OnErrorExit: