From 1594606d160d61153cf2396befdefdcf24a0b4eb Mon Sep 17 00:00:00 2001 From: fulup Date: Wed, 6 Jun 2018 11:47:08 +0200 Subject: Move smixer API create+attach into controller onload section --- mixer-binding/mixer-binding.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'mixer-binding') 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 @@ -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: -- cgit 1.2.3-korg