aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-01-23 16:46:45 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2019-01-24 11:39:58 +0100
commitf8332a219b3d7160f4c92c45b1e6a02584e68880 (patch)
tree36b65c43fb60ae0ac22b09c832677be2f5fada1e
parent17ad00443eecdb2ed7b92da01c7be6f316e04b64 (diff)
Submodule migration to separated librariessandbox/claneys/submigration
- Replace controller binder functions definition with the binder ones. and remove the last used submodules to use the separated libraries. - Add liburcu as a project dependency in addition to the others ones. Bug-AGL: SPEC-2139 Change-Id: If46eed24018e28e58d1e62397f4355d2aa46a58e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--.gitmodules6
m---------app-afb-helpers-submodule0
m---------app-controller-submodule0
-rw-r--r--conf.d/cmake/config.cmake3
-rw-r--r--mixer-binding/CMakeLists.txt8
-rw-r--r--mixer-binding/mixer-binding.c24
-rw-r--r--plugins/alsa/CMakeLists.txt5
-rw-r--r--plugins/alsa/alsa-api-loop.c34
-rw-r--r--plugins/alsa/alsa-api-mixer.c88
-rw-r--r--plugins/alsa/alsa-api-pcm.c86
-rw-r--r--plugins/alsa/alsa-api-ramp.c16
-rw-r--r--plugins/alsa/alsa-api-sink.c26
-rw-r--r--plugins/alsa/alsa-api-source.c16
-rw-r--r--plugins/alsa/alsa-api-streams.c132
-rw-r--r--plugins/alsa/alsa-api-zones.c42
-rw-r--r--plugins/alsa/alsa-core-ctl.c110
-rw-r--r--plugins/alsa/alsa-core-pcm.c140
-rw-r--r--plugins/alsa/alsa-effect-ramp.c12
-rw-r--r--plugins/alsa/alsa-plug-dmix.c10
-rw-r--r--plugins/alsa/alsa-plug-rate.c10
-rw-r--r--plugins/alsa/alsa-plug-route.c38
-rw-r--r--plugins/alsa/alsa-plug-vol.c10
-rw-r--r--plugins/alsa/alsa-softmixer.h22
-rw-r--r--plugins/alsa/alsa-transaction.c14
-rw-r--r--plugins/alsa/alsa-transaction.h4
-rw-r--r--plugins/alsa/alsa-utils-bypath.c28
-rw-r--r--plugins/alsa/alsa-utils-dump.c36
27 files changed, 453 insertions, 467 deletions
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 4b17e8f..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "app-afb-helpers-submodule"]
- path = app-afb-helpers-submodule
- url = https://gerrit.automotivelinux.org/gerrit/apps/app-afb-helpers-submodule
-[submodule "app-controller-submodule"]
- path = app-controller-submodule
- url = https://gerrit.automotivelinux.org/gerrit/apps/app-controller-submodule
diff --git a/app-afb-helpers-submodule b/app-afb-helpers-submodule
deleted file mode 160000
-Subproject f0ce5b665dd33b285d723720c16ac0542cde4e6
diff --git a/app-controller-submodule b/app-controller-submodule
deleted file mode 160000
-Subproject 70e1d98f1118c4785dde75cb64af9272fce1167
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
index c3a72df..8093548 100644
--- a/conf.d/cmake/config.cmake
+++ b/conf.d/cmake/config.cmake
@@ -75,6 +75,9 @@ set (PKG_REQUIRED_LIST
libmicrohttpd>=0.9.55
uuid
lua
+ liburcu
+ afb-helpers
+ ctl-utilities
)
# Prefix path where will be installed the files
diff --git a/mixer-binding/CMakeLists.txt b/mixer-binding/CMakeLists.txt
index 9e79a21..c15c0b6 100644
--- a/mixer-binding/CMakeLists.txt
+++ b/mixer-binding/CMakeLists.txt
@@ -29,12 +29,6 @@ PROJECT_TARGET_ADD(softmixer-binding)
OUTPUT_NAME ${TARGET_NAME}
)
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
- afb-helpers
- ctl-utilities
- ${link_libraries}
- )
-
# Define target includes for this target client
TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
@@ -46,4 +40,4 @@ PROJECT_TARGET_ADD(softmixer-binding)
)
# make sure config is copied before starting
- add_dependencies(${TARGET_NAME} softmixer-config softmixer-lua softmixer-html5) \ No newline at end of file
+ add_dependencies(${TARGET_NAME} softmixer-config softmixer-lua softmixer-html5)
diff --git a/mixer-binding/mixer-binding.c b/mixer-binding/mixer-binding.c
index ed5b5a8..64a7f05 100644
--- a/mixer-binding/mixer-binding.c
+++ b/mixer-binding/mixer-binding.c
@@ -35,24 +35,24 @@ static CtlSectionT ctrlSections[]= {
{.key=NULL}
};
-STATIC void ctrlapi_ping (AFB_ReqT request) {
+STATIC void ctrlapi_ping (afb_req_t request) {
static int count=0;
count++;
- AFB_ReqNotice (request, "Controller:ping count=%d", count);
- AFB_ReqSuccess(request,json_object_new_int(count), NULL);
+ AFB_REQ_NOTICE (request, "Controller:ping count=%d", count);
+ afb_req_success(request,json_object_new_int(count), NULL);
return;
}
// Every HAL export the same API & Interface Mapping from SndCard to AudioLogic is done through alsaHalSndCardT
-STATIC AFB_ApiVerbs CtrlApiVerbs[] = {
+STATIC afb_verb_t CtrlApiVerbs[] = {
/* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */
{ .verb = "ping", .callback = ctrlapi_ping , .info = "ping test for API"},
{ .verb = NULL} /* marker for end of the array */
};
-STATIC int CtrlLoadStaticVerbs (afb_api_t apiHandle, AFB_ApiVerbs *verbs) {
+STATIC int CtrlLoadStaticVerbs (afb_api_t apiHandle, afb_verb_t *verbs) {
int errcount=0;
for (int idx=0; verbs[idx].verb; idx++) {
@@ -71,7 +71,7 @@ STATIC int CtrlLoadStaticVerbs (afb_api_t apiHandle, AFB_ApiVerbs *verbs) {
#include <signal.h>
-STATIC int CtrlLoadOneApi (void *cbdata, AFB_ApiT apiHandle) {
+STATIC int CtrlLoadOneApi (void *cbdata, afb_api_t apiHandle) {
CtlConfigT *ctrlConfig = (CtlConfigT*) cbdata;
// save closure as api's data context
@@ -80,7 +80,7 @@ STATIC int CtrlLoadOneApi (void *cbdata, AFB_ApiT apiHandle) {
// add static controls verbs
int error = CtrlLoadStaticVerbs (apiHandle, CtrlApiVerbs);
if (error) {
- AFB_ApiError(apiHandle, "CtrlLoadSection fail to Registry static V2 verbs");
+ AFB_API_ERROR(apiHandle, "CtrlLoadSection fail to Registry static V2 verbs");
goto OnErrorExit;
}
@@ -102,30 +102,30 @@ PUBLIC int afbBindingEntry(afb_api_t apiHandle) {
AFB_default = apiHandle;
- AFB_ApiNotice (apiHandle, "Controller in afbBindingEntry");
+ AFB_API_NOTICE (apiHandle, "Controller in afbBindingEntry");
const char *dirList= getenv("CONTROL_CONFIG_PATH");
if (!dirList) dirList=CONTROL_CONFIG_PATH;
const char *configPath = CtlConfigSearch(apiHandle, dirList, "smixer");
if (!configPath) {
- AFB_ApiError(apiHandle, "CtlPreInit: No smixer-%s-* config found in %s ", GetBinderName(), dirList);
+ AFB_API_ERROR(apiHandle, "CtlPreInit: No smixer-%s-* config found in %s ", GetBinderName(), dirList);
goto OnErrorExit;
}
// load config file and create API
CtlConfigT *ctrlConfig = CtlLoadMetaData (apiHandle, configPath);
if (!ctrlConfig) {
- AFB_ApiError(apiHandle, "CtrlBindingDyn No valid control config file in:\n-- %s", configPath);
+ AFB_API_ERROR(apiHandle, "CtrlBindingDyn No valid control config file in:\n-- %s", configPath);
goto OnErrorExit;
}
if (!ctrlConfig->api) {
- AFB_ApiError(apiHandle, "CtrlBindingDyn API Missing from metadata in:\n-- %s", configPath);
+ AFB_API_ERROR(apiHandle, "CtrlBindingDyn API Missing from metadata in:\n-- %s", configPath);
goto OnErrorExit;
}
- AFB_ApiNotice (apiHandle, "Controller API='%s' info='%s'", ctrlConfig->api, ctrlConfig->info);
+ AFB_API_NOTICE (apiHandle, "Controller API='%s' info='%s'", ctrlConfig->api, ctrlConfig->info);
// create one API per config file (Pre-V3 return code ToBeChanged)
afb_api_t handle = afb_api_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig);
diff --git a/plugins/alsa/CMakeLists.txt b/plugins/alsa/CMakeLists.txt
index 2e93177..2a2e855 100644
--- a/plugins/alsa/CMakeLists.txt
+++ b/plugins/alsa/CMakeLists.txt
@@ -32,11 +32,6 @@ PROJECT_TARGET_ADD(alsa-softmixer)
OUTPUT_NAME ${TARGET_NAME}
)
- # Library dependencies (include updates automatically)
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
- ${link_libraries}
- )
-
target_include_directories(${TARGET_NAME}
PRIVATE "${CMAKE_SOURCE_DIR}/app-controller-submodule/ctl-lib"
PRIVATE "${CMAKE_SOURCE_DIR}/mixer-binding")
diff --git a/plugins/alsa/alsa-api-loop.c b/plugins/alsa/alsa-api-loop.c
index ffab6bc..a123bb3 100644
--- a/plugins/alsa/alsa-api-loop.c
+++ b/plugins/alsa/alsa-api-loop.c
@@ -58,7 +58,7 @@ fail:
STATIC AlsaLoopSubdevT *ProcessOneSubdev(SoftMixerT *mixer, AlsaSndLoopT *loop, json_object *subdevJ) {
- AFB_ApiDebug(mixer->api, "%s : %s", __func__, json_object_get_string(subdevJ));
+ AFB_API_DEBUG(mixer->api, "%s : %s", __func__, json_object_get_string(subdevJ));
AlsaLoopSubdevT *subdev = calloc(1, sizeof (AlsaLoopSubdevT));
if (subdev == NULL) {
@@ -72,7 +72,7 @@ STATIC AlsaLoopSubdevT *ProcessOneSubdev(SoftMixerT *mixer, AlsaSndLoopT *loop,
, "numid", &subdev->numid
);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: loop=%s missing (uid|subdev|numid) error=%s json=%s",
__func__, loop->uid, wrap_json_get_error_string(error), json_object_get_string(subdevJ));
goto fail_subdev;
@@ -108,7 +108,7 @@ STATIC AlsaLoopSubdevT *ProcessOneSubdev(SoftMixerT *mixer, AlsaSndLoopT *loop,
AlsaMixerTransactionObjectForget(mixer->transaction, pcmCtl);
AlsaPcmCtlDelete(mixer, pcmCtl);
- AFB_ApiDebug(mixer->api, "%s DONE", __func__);
+ AFB_API_DEBUG(mixer->api, "%s DONE", __func__);
return subdev;
@@ -131,7 +131,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
json_object *subdevsJ = NULL, *devicesJ = NULL;
int error;
- AFB_ApiNotice(mixer->api, "%s, uid %s", __func__, uid);
+ AFB_API_NOTICE(mixer->api, "%s, uid %s", __func__, uid);
AlsaSndLoopT *loop = calloc(1, sizeof (AlsaSndLoopT));
if (loop == NULL) {
@@ -160,7 +160,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
, "subdevs", &subdevsJ
);
if (error || !loop->uid || !subdevsJ || (!loop->sndcard->cid.devpath && !loop->sndcard->cid.cardid)) {
- AFB_ApiNotice(mixer->api, "%s mixer=%s hal=%s missing 'uid|path|cardid|devices|subdevs' error=%s args=%s",
+ AFB_API_NOTICE(mixer->api, "%s mixer=%s hal=%s missing 'uid|path|cardid|devices|subdevs' error=%s args=%s",
__func__, mixer->uid, uid, wrap_json_get_error_string(error),json_object_get_string(argsJ));
goto fail_snd_card;
}
@@ -168,7 +168,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
// try to open sound card control interface
loop->sndcard->ctl = AlsaByPathOpenCtl(mixer, loop->uid, loop->sndcard);
if (!loop->sndcard->ctl) {
- AFB_ApiError(mixer->api, "%s mixer=%s hal=%s Fail open sndcard loop=%s devpath=%s cardid=%s (please check 'modprobe snd_aloop')",
+ AFB_API_ERROR(mixer->api, "%s mixer=%s hal=%s Fail open sndcard loop=%s devpath=%s cardid=%s (please check 'modprobe snd_aloop')",
__func__, mixer->uid, uid, loop->uid, loop->sndcard->cid.devpath, loop->sndcard->cid.cardid);
goto fail_snd_card;
}
@@ -180,7 +180,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
} else {
error = wrap_json_unpack(devicesJ, "{si,si !}", "capture", &loop->capture, "playback", &loop->playback);
if (error) {
- AFB_ApiNotice(mixer->api, "%s mixer=%s hal=%s Loop=%s missing 'capture|playback' error=%s devices=%s",
+ AFB_API_NOTICE(mixer->api, "%s mixer=%s hal=%s Loop=%s missing 'capture|playback' error=%s devices=%s",
__func__, mixer->uid, uid, loop->uid, wrap_json_get_error_string(error),json_object_get_string(devicesJ));
goto fail_snd_card_ctl;
}
@@ -210,17 +210,17 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
break;
}
default:
- AFB_ApiError(mixer->api, "%s mixer=%s hal=%s Loop=%s invalid subdevs= %s",
+ AFB_API_ERROR(mixer->api, "%s mixer=%s hal=%s Loop=%s invalid subdevs= %s",
__func__, mixer->uid, uid, loop->uid, json_object_get_string(subdevsJ));
goto fail_snd_card_ctl;
}
- AFB_ApiNotice(mixer->api, "%s, uid %s DONE", __func__, uid);
+ AFB_API_NOTICE(mixer->api, "%s, uid %s DONE", __func__, uid);
return loop;
fail_loop_subdev: {
- AFB_ApiDebug(mixer->api, "%s cleanup", __func__);
+ AFB_API_DEBUG(mixer->api, "%s cleanup", __func__);
AlsaLoopSubdevT * subdev, *tmp;
cds_list_for_each_entry_safe(subdev, tmp, &loop->subdevs.list, list) {
cds_list_del(&subdev->list);
@@ -240,7 +240,7 @@ fail:
static void loopDestroy(SoftMixerT * mixer, void* arg) {
AlsaSndLoopT * loop = (AlsaSndLoopT*) arg;
- AFB_ApiDebug(mixer->api, "%s... %s", __func__, loop->uid);
+ AFB_API_DEBUG(mixer->api, "%s... %s", __func__, loop->uid);
AlsaLoopSubdevT * subdev, *tmp;
cds_list_for_each_entry_safe(subdev, tmp, &loop->subdevs.list, list) {
@@ -254,7 +254,7 @@ static void loopDestroy(SoftMixerT * mixer, void* arg) {
mixer->nbLoops--;
cds_list_del(&loop->list);
free(loop);
- AFB_ApiDebug(mixer->api, "DONE !");
+ AFB_API_DEBUG(mixer->api, "DONE !");
}
@@ -276,7 +276,7 @@ fail:
return newLoop;
}
-PUBLIC int ApiLoopAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid, json_object * argsJ) {
+PUBLIC int ApiLoopAttach(SoftMixerT *mixer, afb_req_t request, const char * uid, json_object * argsJ) {
AlsaSndLoopT * newLoop = NULL;
@@ -324,18 +324,18 @@ fail:
static void subdevDisplay(SoftMixerT *mixer, AlsaLoopSubdevT * subdev) {
- AFB_ApiInfo(mixer->api, "\t\tsubdev id %d, uid %s", subdev->numid, subdev->uid);
+ AFB_API_INFO(mixer->api, "\t\tsubdev id %d, uid %s", subdev->numid, subdev->uid);
}
PUBLIC void loopsDisplay(SoftMixerT *mixer) {
AlsaSndLoopT * loop;
- AFB_ApiInfo(mixer->api, "Mixer %s LOOPS:", mixer->uid);
+ AFB_API_INFO(mixer->api, "Mixer %s LOOPS:", mixer->uid);
cds_list_for_each_entry(loop, &mixer->loops.list, list) {
- AFB_ApiInfo(mixer->api, "\tLOOP %s", loop->uid);
+ AFB_API_INFO(mixer->api, "\tLOOP %s", loop->uid);
AlsaLoopSubdevT * subdev;
cds_list_for_each_entry(subdev, &loop->subdevs.list, list) {
subdevDisplay(mixer, subdev);
}
}
- AFB_ApiInfo(mixer->api, "--------------");
+ AFB_API_INFO(mixer->api, "--------------");
}
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c
index 6d80b55..e892b2f 100644
--- a/plugins/alsa/alsa-api-mixer.c
+++ b/plugins/alsa/alsa-api-mixer.c
@@ -34,7 +34,7 @@ static void MixerExit() {
cds_list_for_each_entry_safe(mixer, tmp, &mixerList, list) {
// remove this mixer from the global mixer list
cds_list_del(&mixer->list);
- AFB_ApiInfo(mixer->api, "Terminating mixer %s", mixer->uid);
+ AFB_API_INFO(mixer->api, "Terminating mixer %s", mixer->uid);
AlsaMixerTransaction * transaction, * tmp_trans;
cds_list_for_each_entry_safe(transaction, tmp_trans, &mixer->transactionList, transaction_node) {
@@ -49,7 +49,7 @@ static void MixerExit() {
CTLP_ONLOAD(plugin, callbacks){
- AFB_ApiInfo(plugin->api, "MIXER INIT");
+ AFB_API_INFO(plugin->api, "MIXER INIT");
CDS_INIT_LIST_HEAD(&mixerList);
atexit(MixerExit);
@@ -57,8 +57,8 @@ CTLP_ONLOAD(plugin, callbacks){
}
-static void MixerRemoveVerb(AFB_ReqT request) {
- AFB_ReqFailF(request, "internal-error", "Function not implemented");
+static void MixerRemoveVerb(afb_req_t request) {
+ afb_req_fail_f(request, "internal-error", "Function not implemented");
return;
}
@@ -116,7 +116,7 @@ STATIC json_object * MixerInfoStreams(SoftMixerT *mixer, json_object *streamsJ,
case json_type_object:
error = wrap_json_unpack(streamsJ, "{ss}", "uid", &key);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: missing 'uid' request streamJ=%s error=%s position=%d",
__func__, json_object_get_string(streamsJ), wrap_json_get_error_string(error), wrap_json_get_error_position(error));
goto OnErrorExit;
@@ -136,7 +136,7 @@ STATIC json_object * MixerInfoStreams(SoftMixerT *mixer, json_object *streamsJ,
valueJ = MixerInfoStreams(mixer, streamJ, verbose);
if (!valueJ) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: failed to find stream=%s",
__func__, json_object_get_string(streamJ));
goto OnErrorExit;
@@ -146,7 +146,7 @@ STATIC json_object * MixerInfoStreams(SoftMixerT *mixer, json_object *streamsJ,
break;
default:
- AFB_ApiError(mixer->api, "%s: unsupported json type streamsJ=%s", __func__, json_object_get_string(streamsJ));
+ AFB_API_ERROR(mixer->api, "%s: unsupported json type streamsJ=%s", __func__, json_object_get_string(streamsJ));
goto OnErrorExit;
}
@@ -204,7 +204,7 @@ STATIC json_object *MixerInfoRamps(SoftMixerT *mixer, json_object *rampsJ, int v
case json_type_object:
error = wrap_json_unpack(rampsJ, "{ss}", "uid", &key);
if (error) {
- AFB_ApiError(mixer->api, "%s: missing 'uid' request rampJ=%s error=%s position=%d",
+ AFB_API_ERROR(mixer->api, "%s: missing 'uid' request rampJ=%s error=%s position=%d",
__func__, json_object_get_string(rampsJ), wrap_json_get_error_string(error), wrap_json_get_error_position(error));
goto OnErrorExit;
}
@@ -222,7 +222,7 @@ STATIC json_object *MixerInfoRamps(SoftMixerT *mixer, json_object *rampsJ, int v
valueJ = MixerInfoRamps(mixer, rampJ, verbose);
if (!valueJ) {
- AFB_ApiError(mixer->api, "%s: fail to find ramp=%s", __func__, json_object_get_string(rampsJ));
+ AFB_API_ERROR(mixer->api, "%s: fail to find ramp=%s", __func__, json_object_get_string(rampsJ));
goto OnErrorExit;
}
json_object_array_add(responseJ, valueJ);
@@ -230,7 +230,7 @@ STATIC json_object *MixerInfoRamps(SoftMixerT *mixer, json_object *rampsJ, int v
break;
default:
- AFB_ApiError(mixer->api, "%s: unsupported json type rampsJ=%s", __func__, json_object_get_string(rampsJ));
+ AFB_API_ERROR(mixer->api, "%s: unsupported json type rampsJ=%s", __func__, json_object_get_string(rampsJ));
goto OnErrorExit;
}
@@ -323,7 +323,7 @@ STATIC json_object *MixerInfoZones(SoftMixerT *mixer, json_object *zonesJ, int v
case json_type_object:
error = wrap_json_unpack(zonesJ, "{ss}", "uid", &key);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: missing 'uid' request zoneJ=%s error=%s position=%d",
__func__ ,json_object_get_string(zonesJ), wrap_json_get_error_string(error), wrap_json_get_error_position(error));
goto OnErrorExit;
@@ -342,7 +342,7 @@ STATIC json_object *MixerInfoZones(SoftMixerT *mixer, json_object *zonesJ, int v
valueJ = MixerInfoZones(mixer, zoneJ, verbose);
if (!valueJ) {
- AFB_ApiError(mixer->api, "%s: fail to find zone=%s", __func__, json_object_get_string(zonesJ));
+ AFB_API_ERROR(mixer->api, "%s: fail to find zone=%s", __func__, json_object_get_string(zonesJ));
goto OnErrorExit;
}
json_object_array_add(responseJ, valueJ);
@@ -350,11 +350,11 @@ STATIC json_object *MixerInfoZones(SoftMixerT *mixer, json_object *zonesJ, int v
break;
default:
- AFB_ApiError(mixer->api, "%s: unsupported json type zonesJ=%s", __func__, json_object_get_string(zonesJ));
+ AFB_API_ERROR(mixer->api, "%s: unsupported json type zonesJ=%s", __func__, json_object_get_string(zonesJ));
goto OnErrorExit;
}
- AFB_ApiNotice(mixer->api, "%s: response=%s", __func__, json_object_get_string(responseJ));
+ AFB_API_NOTICE(mixer->api, "%s: response=%s", __func__, json_object_get_string(responseJ));
return (responseJ);
OnErrorExit:
@@ -408,7 +408,7 @@ STATIC json_object *MixerInfoPcms(SoftMixerT *mixer, json_object *pcmsJ, snd_pcm
pcms = &mixer->sources;
break;
default:
- AFB_ApiError(mixer->api, "%s: invalid Direction should be SND_PCM_STREAM_PLAYBACK|SND_PCM_STREAM_capture", __func__);
+ AFB_API_ERROR(mixer->api, "%s: invalid Direction should be SND_PCM_STREAM_PLAYBACK|SND_PCM_STREAM_capture", __func__);
goto OnErrorExit;
}
@@ -437,7 +437,7 @@ STATIC json_object *MixerInfoPcms(SoftMixerT *mixer, json_object *pcmsJ, snd_pcm
case json_type_object:
error = wrap_json_unpack(pcmsJ, "{ss}", "uid", &key);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: missing 'uid' request pcmJ=%s error=%s position=%d",
__func__, json_object_get_string(pcmsJ), wrap_json_get_error_string(error), wrap_json_get_error_position(error));
goto OnErrorExit;
@@ -457,7 +457,7 @@ STATIC json_object *MixerInfoPcms(SoftMixerT *mixer, json_object *pcmsJ, snd_pcm
valueJ = MixerInfoPcms(mixer, pcmJ, direction, verbose);
if (!valueJ) {
- AFB_ApiError(mixer->api, "%s: fail to find %s=%s",
+ AFB_API_ERROR(mixer->api, "%s: fail to find %s=%s",
__func__, direction==SND_PCM_STREAM_PLAYBACK?"playback":"capture", json_object_get_string(pcmJ));
goto OnErrorExit;
}
@@ -466,7 +466,7 @@ STATIC json_object *MixerInfoPcms(SoftMixerT *mixer, json_object *pcmsJ, snd_pcm
break;
default:
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: unsupported json type pcmsJ=%s",
__func__, json_object_get_string(pcmsJ));
goto OnErrorExit;
@@ -478,7 +478,7 @@ OnErrorExit:
return NULL;
}
-STATIC void MixerInfoAction(AFB_ReqT request, json_object * argsJ) {
+STATIC void MixerInfoAction(afb_req_t request, json_object * argsJ) {
SoftMixerT *mixer = (SoftMixerT*) afb_req_get_vcbdata(request);
int error, verbose = 0;
@@ -493,7 +493,7 @@ STATIC void MixerInfoAction(AFB_ReqT request, json_object * argsJ) {
, "zones", &zonesJ
);
if (error) {
- AFB_ReqFailF(request, "invalid-syntax", "list missing 'verbose|streams|ramps|captures|playbacks|zones' argsJ=%s", json_object_get_string(argsJ));
+ afb_req_fail_f(request, "invalid-syntax", "list missing 'verbose|streams|ramps|captures|playbacks|zones' argsJ=%s", json_object_get_string(argsJ));
return;
}
@@ -502,7 +502,7 @@ STATIC void MixerInfoAction(AFB_ReqT request, json_object * argsJ) {
if (streamsJ) {
json_object *resultJ = MixerInfoStreams(mixer, streamsJ, verbose);
if (!resultJ) {
- AFB_ReqFailF(request, "not-found", "fail to find streams (should be a boolean, a string, or an array of them) argsJ=%s", json_object_get_string(streamsJ));
+ afb_req_fail_f(request, "not-found", "fail to find streams (should be a boolean, a string, or an array of them) argsJ=%s", json_object_get_string(streamsJ));
return;
}
json_object_object_add(responseJ, "streams", resultJ);
@@ -528,16 +528,16 @@ STATIC void MixerInfoAction(AFB_ReqT request, json_object * argsJ) {
json_object_object_add(responseJ, "captures", resultJ);
}
- AFB_ReqSuccess(request, responseJ, NULL);
+ afb_req_success(request, responseJ, NULL);
return;
}
-STATIC void MixerInfoVerb(AFB_ReqT request) {
+STATIC void MixerInfoVerb(afb_req_t request) {
json_object *argsJ = afb_req_json(request);
MixerInfoAction(request, argsJ);
}
-STATIC void MixerAttachVerb(AFB_ReqT request) {
+STATIC void MixerAttachVerb(afb_req_t request) {
SoftMixerT *mixer = (SoftMixerT*) afb_req_get_vcbdata(request);
const char *uid = NULL, *prefix = NULL;
json_object *playbacksJ = NULL, *capturesJ = NULL, *zonesJ = NULL, *streamsJ = NULL, *rampsJ = NULL, *loopsJ = NULL;
@@ -546,7 +546,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
int error;
AlsaMixerTransaction * transaction = NULL;
- AFB_ApiInfo(mixer->api, "%s: %s", __func__, json_object_get_string(argsJ));
+ AFB_API_INFO(mixer->api, "%s: %s", __func__, json_object_get_string(argsJ));
error = wrap_json_unpack(argsJ, "{ss,s?s,s?s,s?o,s?o,s?o,s?o,s?o,s?o !}"
, "uid", &uid
@@ -560,7 +560,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
, "streams", &streamsJ
);
if (error) {
- AFB_ReqFailF(request,
+ afb_req_fail_f(request,
"invalid-syntax",
"%s mixer=%s missing 'uid|ramps|playbacks|captures|zones|streams' error=%s args=%s",
__func__, mixer->uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
@@ -575,14 +575,14 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
mixer->transaction = transaction;
- AFB_ApiInfo(mixer->api, "%s set LOOPS", __func__);
+ AFB_API_INFO(mixer->api, "%s set LOOPS", __func__);
if (loopsJ) {
error = ApiLoopAttach(mixer, request, uid, loopsJ);
if (error) goto fail;
}
- AFB_ApiInfo(mixer->api, "%s set PLAYBACKS", __func__);
+ AFB_API_INFO(mixer->api, "%s set PLAYBACKS", __func__);
if (playbacksJ) {
error = ApiSinkAttach(mixer, request, uid, playbacksJ);
@@ -592,12 +592,12 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
json_object_object_add(responseJ, "playbacks", resultJ);
}
- AFB_ApiInfo(mixer->api, "%s set CAPTURES", __func__);
+ AFB_API_INFO(mixer->api, "%s set CAPTURES", __func__);
if (capturesJ) {
error = ApiSourceAttach(mixer, request, uid, capturesJ);
if (error) {
- AFB_ApiError(mixer->api,"%s: source attach failed", __func__);
+ AFB_API_ERROR(mixer->api,"%s: source attach failed", __func__);
goto fail_sink;
}
@@ -605,7 +605,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
json_object_object_add(responseJ, "captures", resultJ);
}
- AFB_ApiInfo(mixer->api, "%s set ZONES", __func__);
+ AFB_API_INFO(mixer->api, "%s set ZONES", __func__);
if (zonesJ) {
error = ApiZoneAttach(mixer, request, uid, zonesJ);
@@ -616,7 +616,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
json_object_object_add(responseJ, "zone", resultJ);
}
- AFB_ApiInfo(mixer->api, "%s set RAMPS", __func__);
+ AFB_API_INFO(mixer->api, "%s set RAMPS", __func__);
if (rampsJ) {
error = ApiRampAttach(mixer, request, uid, rampsJ);
@@ -627,7 +627,7 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
json_object_object_add(responseJ, "ramps", resultJ);
}
- AFB_ApiInfo(mixer->api,"%s set STREAMS", __func__);
+ AFB_API_INFO(mixer->api,"%s set STREAMS", __func__);
if (streamsJ) {
error = ApiStreamAttach(mixer, request, uid, prefix, streamsJ);
@@ -640,15 +640,15 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
error = afb_api_add_verb(mixer->api, uid, "Post Attach API", AlsaMixerTransactionVerbCB, transaction, NULL, 0, 0);
if (error) {
- AFB_ApiError(mixer->api, "%s mixer=%s verb=%s fail to register post attach Verb ",
+ AFB_API_ERROR(mixer->api, "%s mixer=%s verb=%s fail to register post attach Verb ",
__func__, mixer->uid, uid);
goto fail_stream;
}
- AFB_ApiNotice(mixer->api, "%s responseJ=%s", __func__, json_object_get_string(responseJ));
- AFB_ReqSuccess(request, responseJ, NULL);
+ AFB_API_NOTICE(mixer->api, "%s responseJ=%s", __func__, json_object_get_string(responseJ));
+ afb_req_success(request, responseJ, NULL);
- AFB_ApiInfo(mixer->api,"%s DONE", __func__);
+ AFB_API_INFO(mixer->api,"%s DONE", __func__);
return;
fail_stream:
@@ -668,13 +668,13 @@ fail:
if (mixer->transaction)
free(mixer->transaction);
- AFB_ApiError(mixer->api,"%s FAILED", __func__);
+ AFB_API_ERROR(mixer->api,"%s FAILED", __func__);
return;
}
// Every HAL export the same API & Interface Mapping from SndCard to AudioLogic is done through alsaHalSndCardT
-STATIC AFB_ApiVerbs CtrlApiVerbs[] = {
+STATIC afb_verb_t CtrlApiVerbs[] = {
/* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */
{ .verb = "attach", .callback = MixerAttachVerb, .info = "attach resources to mixer"},
{ .verb = "remove", .callback = MixerRemoveVerb, .info = "remove existing mixer streams, zones, ..."},
@@ -682,7 +682,7 @@ STATIC AFB_ApiVerbs CtrlApiVerbs[] = {
{ .verb = NULL} /* marker for end of the array */
};
-STATIC int LoadStaticVerbs(SoftMixerT *mixer, AFB_ApiVerbs * verbs) {
+STATIC int LoadStaticVerbs(SoftMixerT *mixer, afb_verb_t * verbs) {
int errcount = 0;
for (int idx = 0; verbs[idx].verb; idx++) {
@@ -711,7 +711,7 @@ CTLP_CAPI(MixerAttach, source, argsJ, responseJ) {
, "streams", &streamsJ
);
if (error) {
- AFB_ApiError(mixer->api, "%s: invalid-syntax mixer=%s error=%s args=%s",
+ AFB_API_ERROR(mixer->api, "%s: invalid-syntax mixer=%s error=%s args=%s",
__func__, mixer->uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
goto OnErrorExit;
}
@@ -787,7 +787,7 @@ CTLP_CAPI(MixerCreate, source, argsJ, responseJ) {
mixer->max.ramps = SMIXER_DEFLT_RAMPS;
if (json_object_get_type(argsJ) != json_type_object) {
- AFB_ApiError(source->api, "%s: invalid object type= %s", __func__, json_object_get_string(argsJ));
+ AFB_API_ERROR(source->api, "%s: invalid object type= %s", __func__, json_object_get_string(argsJ));
goto fail;
}
@@ -802,7 +802,7 @@ CTLP_CAPI(MixerCreate, source, argsJ, responseJ) {
, "max_ramp", &mixer->max.ramps
);
if (error) {
- AFB_ApiNotice(source->api,
+ AFB_API_NOTICE(source->api,
"%s missing 'uid|max_loop|max_sink|max_source|max_zone|max_stream|max_ramp' error=%s mixer=%s",
__func__, wrap_json_get_error_string(error), json_object_get_string(argsJ));
goto fail_mixer;
@@ -837,7 +837,7 @@ CTLP_CAPI(MixerCreate, source, argsJ, responseJ) {
CDS_INIT_LIST_HEAD(&mixer->ramps.list);
CDS_INIT_LIST_HEAD(&mixer->transactionList);
- mixer->sdLoop = AFB_GetEventLoop(source->api);
+ mixer->sdLoop = afb_api_get_event_loop(source->api);
mixer->api = source->api;
afb_api_set_userdata(source->api, mixer);
diff --git a/plugins/alsa/alsa-api-pcm.c b/plugins/alsa/alsa-api-pcm.c
index ce74982..7fa97e1 100644
--- a/plugins/alsa/alsa-api-pcm.c
+++ b/plugins/alsa/alsa-api-pcm.c
@@ -59,7 +59,7 @@ STATIC AlsaPcmChannelT * ProcessOneChannel(SoftMixerT *mixer, const char *uid, j
}
int error = wrap_json_unpack(argsJ, "{ss,si !}", "uid", &channel->uid, "port", &channel->port);
if (error) {
- AFB_ApiError(mixer->api, "%s: sndcard=%s channel: missing (uid||port) error=%s json=%s",
+ AFB_API_ERROR(mixer->api, "%s: sndcard=%s channel: missing (uid||port) error=%s json=%s",
__func__, uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
goto fail_channel;
}
@@ -92,7 +92,7 @@ STATIC int PcmAttachOneCtl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, json_object
, "value", &value
);
if (error || (!numid && !name)) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: cardid=%s channel: missing (numid|name|value) error=%s json=%s",
__func__, sndcard->cid.name, wrap_json_get_error_string(error), json_object_get_string(argsJ));
goto fail;
@@ -101,7 +101,7 @@ STATIC int PcmAttachOneCtl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, json_object
if (numid > 0) {
elemId = AlsaCtlGetNumidElemId(mixer, sndcard, numid);
if (!elemId) {
- AFB_ApiError(mixer->api, "%s sndard=%s fail to find control numid=%d",
+ AFB_API_ERROR(mixer->api, "%s sndard=%s fail to find control numid=%d",
__func__, sndcard->cid.cardid, numid);
goto fail;
}
@@ -109,7 +109,7 @@ STATIC int PcmAttachOneCtl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, json_object
} else {
elemId = AlsaCtlGetNameElemId(mixer, sndcard, name);
if (!elemId) {
- AFB_ApiError(mixer->api, "%s sndard=%s fail to find control name=%s",
+ AFB_API_ERROR(mixer->api, "%s sndard=%s fail to find control name=%s",
__func__, sndcard->cid.cardid, name);
goto fail;
}
@@ -125,13 +125,13 @@ STATIC int PcmAttachOneCtl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, json_object
control->numid = snd_ctl_elem_info_get_numid(elemInfo);
if (snd_ctl_elem_info(sndcard->ctl, elemInfo) < 0) {
- AFB_ApiError(mixer->api, "%s: sndard=%s numid=%d name='%s' not loadable",
+ AFB_API_ERROR(mixer->api, "%s: sndard=%s numid=%d name='%s' not loadable",
__func__, sndcard->cid.cardid, control->numid, control->name);
goto fail_control_name;
}
if (!snd_ctl_elem_info_is_writable(elemInfo)) {
- AFB_ApiError(mixer->api, "%s: sndard=%s numid=%d name='%s' not writable",
+ AFB_API_ERROR(mixer->api, "%s: sndard=%s numid=%d name='%s' not writable",
__func__, sndcard->cid.cardid, control->numid, control->name);
goto fail_control_name;
}
@@ -154,13 +154,13 @@ STATIC int PcmAttachOneCtl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, json_object
break;
default:
- AFB_ApiError(mixer->api, "%s: sndard=%s numid=%d name='%s' invalid/unsupported type=%d",
+ AFB_API_ERROR(mixer->api, "%s: sndard=%s numid=%d name='%s' invalid/unsupported type=%d",
__func__, sndcard->cid.cardid, control->numid, control->name, snd_ctl_elem_info_get_type(elemInfo));
goto fail_control_name;
}
if (error) {
- AFB_ApiError(mixer->api, "%s: sndard=%s numid=%d name='%s' not writable",
+ AFB_API_ERROR(mixer->api, "%s: sndard=%s numid=%d name='%s' not writable",
__func__, sndcard->cid.cardid, control->numid, control->name);
goto fail_control_name;
}
@@ -186,7 +186,7 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
elemId = AlsaCtlGetNumidElemId(mixer, sndcard, control->numid);
if (!elemId) {
- AFB_ApiError(mixer->api, "%s sndard=%s fail to find control numid=%d", __func__, sndcard->cid.cardid, control->numid);
+ AFB_API_ERROR(mixer->api, "%s sndard=%s fail to find control numid=%d", __func__, sndcard->cid.cardid, control->numid);
goto OnErrorExit;
}
@@ -194,18 +194,18 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
snd_ctl_elem_info_set_id(elemInfo, elemId);
if (snd_ctl_elem_info(sndcard->ctl, elemInfo) < 0) {
- AFB_ApiError(mixer->api, "%s: sndard=%s numid=%d name='%s' not loadable", __func__, sndcard->cid.cardid, control->numid, control->name);
+ AFB_API_ERROR(mixer->api, "%s: sndard=%s numid=%d name='%s' not loadable", __func__, sndcard->cid.cardid, control->numid, control->name);
goto OnErrorExit;
}
if (!snd_ctl_elem_info_is_writable(elemInfo)) {
- AFB_ApiError(mixer->api, "%s: sndard=%s numid=%d name='%s' not writable", __func__, sndcard->cid.cardid, control->numid, control->name);
+ AFB_API_ERROR(mixer->api, "%s: sndard=%s numid=%d name='%s' not writable", __func__, sndcard->cid.cardid, control->numid, control->name);
goto OnErrorExit;
}
error = CtlElemIdGetLong(mixer, sndcard, elemId, &curval);
if (error) {
- AFB_ApiError(mixer->api, "%s sndcard=%s fail to read control numid=%d", __func__, sndcard->cid.cardid, control->numid);
+ AFB_API_ERROR(mixer->api, "%s sndcard=%s fail to read control numid=%d", __func__, sndcard->cid.cardid, control->numid);
goto OnErrorExit;
}
@@ -231,18 +231,18 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
error = CtlElemIdSetLong(mixer, sndcard, elemId, CONVERT_VOLUME(value, control->min, control->max));
if (error) {
- AFB_ApiError(mixer->api, "PcmSetControl sndard=%s fail to write control numid=%d value=%d", sndcard->cid.cardid, control->numid, value);
+ AFB_API_ERROR(mixer->api, "PcmSetControl sndard=%s fail to write control numid=%d value=%d", sndcard->cid.cardid, control->numid, value);
goto OnErrorExit;
}
break;
default:
- AFB_ApiError(mixer->api, "PcmSetControl: sndard=%s numid=%d name='%s' invalid/unsupported type=%d", sndcard->cid.cardid, control->numid, control->name, snd_ctl_elem_info_get_type(elemInfo));
+ AFB_API_ERROR(mixer->api, "PcmSetControl: sndard=%s numid=%d name='%s' invalid/unsupported type=%d", sndcard->cid.cardid, control->numid, control->name, snd_ctl_elem_info_get_type(elemInfo));
goto OnErrorExit;
}
if (error) {
- AFB_ApiError(mixer->api, "PcmSetControl: sndard=%s numid=%d name='%s' not writable", sndcard->cid.cardid, control->numid, control->name);
+ AFB_API_ERROR(mixer->api, "PcmSetControl: sndard=%s numid=%d name='%s' not writable", sndcard->cid.cardid, control->numid, control->name);
goto OnErrorExit;
}
@@ -256,7 +256,7 @@ OnErrorExit:
return -1;
}
-STATIC void ApiPcmVerbCB(AFB_ReqT request) {
+STATIC void ApiPcmVerbCB(afb_req_t request) {
apiVerbHandleT *handle = (apiVerbHandleT*) afb_req_get_vcbdata(request);
int error, verbose = 0, doInfo = 0, doToggle = 0, doMute = -1;
json_object *volumeJ = NULL;
@@ -275,7 +275,7 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
, "volume", &volumeJ
);
if (error) {
- AFB_ReqFailF(request, "syntax-error", "Missing 'mute|volume|toggle|quiet' args=%s error=%s", json_object_get_string(argsJ), wrap_json_get_error_string(error));
+ afb_req_fail_f(request, "syntax-error", "Missing 'mute|volume|toggle|quiet' args=%s error=%s", json_object_get_string(argsJ), wrap_json_get_error_string(error));
goto OnErrorExit;
}
@@ -286,7 +286,7 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
error += AlsaCtlNumidSetLong(mixer, sndcard, handle->pcm->mute.numid, mute);
if (error) {
- AFB_ReqFailF(request, "invalid-numid", "Fail to set pause numid=%d", handle->pcm->mute.numid);
+ afb_req_fail_f(request, "invalid-numid", "Fail to set pause numid=%d", handle->pcm->mute.numid);
goto OnErrorExit;
}
@@ -301,7 +301,7 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
error += AlsaCtlNumidGetLong(mixer, handle->pcm->sndcard, handle->pcm->mute.numid, &mute);
error += AlsaCtlNumidSetLong(mixer, handle->pcm->sndcard, handle->pcm->mute.numid, !mute);
if (error) {
- AFB_ReqFailF(request, "invalid-numid", "Fail to toogle pause numid=%d", handle->pcm->mute.numid);
+ afb_req_fail_f(request, "invalid-numid", "Fail to toogle pause numid=%d", handle->pcm->mute.numid);
goto OnErrorExit;
}
@@ -333,7 +333,7 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
error = sscanf(&volString[0], "%d", &newvol);
volType = RVOL_ABS;
if (error != 1) {
- AFB_ReqFailF(request, "not-integer", "relative volume should start by '+|-' value=%s", json_object_get_string(volumeJ));
+ afb_req_fail_f(request, "not-integer", "relative volume should start by '+|-' value=%s", json_object_get_string(volumeJ));
goto OnErrorExit;
}
}
@@ -347,14 +347,14 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
newvol=0;
break;
default:
- AFB_ReqFailF(request, "not-integer", "volume should be string or integer value=%s", json_object_get_string(volumeJ));
+ afb_req_fail_f(request, "not-integer", "volume should be string or integer value=%s", json_object_get_string(volumeJ));
goto OnErrorExit;
}
error = PcmSetControl(mixer, handle->pcm->sndcard, &handle->pcm->volume, volType, &newvol, &oldvol);
if (error) {
- AFB_ReqFailF(request, "invalid-ctl", "Fail to set volume hal=%s card=%s numid=%d name=%s value=%d"
+ afb_req_fail_f(request, "invalid-ctl", "Fail to set volume hal=%s card=%s numid=%d name=%s value=%d"
, handle->uid, handle->pcm->sndcard->cid.cardid, handle->pcm->volume.numid, handle->pcm->volume.name, newvol);
goto OnErrorExit;
}
@@ -365,7 +365,7 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
}
}
- AFB_ReqSuccess(request, responseJ, handle->uid);
+ afb_req_success(request, responseJ, handle->uid);
return;
OnErrorExit:
@@ -384,7 +384,7 @@ PUBLIC void ApiPcmDelParams(SoftMixerT* mixer, AlsaPcmHwInfoT* params) {
}
PUBLIC void ApiPcmParamsShow(SoftMixerT * mixer, const char *msg, const AlsaPcmHwInfoT * params) {
- AFB_ApiInfo(mixer->api, "%s PARAMS: rate=%d, format=%d, formatString=%s",
+ AFB_API_INFO(mixer->api, "%s PARAMS: rate=%d, format=%d, formatString=%s",
msg, params->rate, params->format, params->formatString);
}
@@ -410,7 +410,7 @@ PUBLIC AlsaPcmHwInfoT * ApiPcmSetParams(SoftMixerT *mixer, const char *uid, json
"format", &format,
"access", &access);
if (error) {
- AFB_ApiError(mixer->api, "%s: sndcard=%s invalid params=%s",
+ AFB_API_ERROR(mixer->api, "%s: sndcard=%s invalid params=%s",
__func__, uid, json_object_get_string(paramsJ));
goto fail_params;
}
@@ -443,11 +443,11 @@ PUBLIC AlsaPcmHwInfoT * ApiPcmSetParams(SoftMixerT *mixer, const char *uid, json
FORMAT_CHECK(FLOAT_LE);
FORMAT_CHECK(FLOAT_BE);
- AFB_ApiError(mixer->api, "%s: %s(params) unsupported format 'S16_LE|S32_L|...' format=%s", __func__, uid, format);
+ AFB_API_ERROR(mixer->api, "%s: %s(params) unsupported format 'S16_LE|S32_L|...' format=%s", __func__, uid, format);
goto fail_params;
check_access:
- AFB_ApiNotice(mixer->api, "%s: %s format set to SND_PCM_FORMAT_%s", __func__, uid, params->formatString);
+ AFB_API_NOTICE(mixer->api, "%s: %s format set to SND_PCM_FORMAT_%s", __func__, uid, params->formatString);
#define ACCESS_CHECK(arg) if (!strcmp(access,#arg)) { params->access = SND_PCM_ACCESS_##arg; goto success;}
@@ -462,13 +462,13 @@ check_access:
ACCESS_CHECK(RW_INTERLEAVED);
ACCESS_CHECK(RW_NONINTERLEAVED);
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s:%s(params) unsupported access 'RW_INTERLEAVED|MMAP_INTERLEAVED|MMAP_COMPLEX' access=%s",
__func__,uid, access);
goto fail_params;
success:
- AFB_ApiNotice(mixer->api, "%s:%s access set to %s", __func__, uid, access);
+ AFB_API_NOTICE(mixer->api, "%s:%s access set to %s", __func__, uid, access);
return params;
fail_params:
@@ -479,7 +479,7 @@ fail:
static void pcmChannelsDestroy(SoftMixerT * mixer, AlsaSndPcmT * pcm) {
- AFB_ApiDebug(mixer->api, "\t%s: pcm %s (%d channels)", __func__, pcm->uid, pcm->nbChannels);
+ AFB_API_DEBUG(mixer->api, "\t%s: pcm %s (%d channels)", __func__, pcm->uid, pcm->nbChannels);
AlsaPcmChannelT * channel, *tmp;
cds_list_for_each_entry_safe(channel, tmp, &pcm->channels.list, list) {
@@ -487,12 +487,12 @@ static void pcmChannelsDestroy(SoftMixerT * mixer, AlsaSndPcmT * pcm) {
free((char *)channel->uid);
free(channel);
}
- AFB_ApiDebug(mixer->api, "\t%s: pcm %s DONE", __func__, pcm->uid);
+ AFB_API_DEBUG(mixer->api, "\t%s: pcm %s DONE", __func__, pcm->uid);
}
PUBLIC void ApiPcmDelete(SoftMixerT * mixer, AlsaSndPcmT * pcm) {
- AFB_ApiDebug(mixer->api, "%s: pcm %s", __func__, pcm->uid);
+ AFB_API_DEBUG(mixer->api, "%s: pcm %s", __func__, pcm->uid);
free(pcm->apiVerbHandle);
AlsaSndCtlT * card = pcm->sndcard;
@@ -511,14 +511,14 @@ PUBLIC void ApiPcmDelete(SoftMixerT * mixer, AlsaSndPcmT * pcm) {
(strcmp(pcm->verb, SOFTMIXER_VERB_NONE)!=0)) {
int error = afb_api_del_verb(mixer->api, pcm->verb, (void**)NULL);
if (error) {
- AFB_ApiError(mixer->api, "Failed to remove verb %s", pcm->verb);
+ AFB_API_ERROR(mixer->api, "Failed to remove verb %s", pcm->verb);
}
free((char*)pcm->verb);
}
free((char*)pcm->uid);
free(pcm);
- AFB_ApiDebug(mixer->api, "%s: done", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: done", __func__);
}
PUBLIC AlsaSndPcmT * ApiPcmNew(SoftMixerT* mixer) {
@@ -566,7 +566,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
, "params", &paramsJ
);
if (error) {
- AFB_ApiError(mixer->api, "%s: hal=%s missing 'uid|path|cardid|device|sink|source|params' error=%s args=%s",
+ AFB_API_ERROR(mixer->api, "%s: hal=%s missing 'uid|path|cardid|device|sink|source|params' error=%s args=%s",
__func__, uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
goto fail_pcm_sndcard;
}
@@ -579,14 +579,14 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
// try to open sound card control interface
pcm->sndcard->ctl = AlsaByPathOpenCtl(mixer, pcm->uid, pcm->sndcard);
if (!pcm->sndcard->ctl) {
- AFB_ApiError(mixer->api, "%s: hal=%s Fail to open sndcard uid=%s devpath=%s cardid=%s",
+ AFB_API_ERROR(mixer->api, "%s: hal=%s Fail to open sndcard uid=%s devpath=%s cardid=%s",
__func__, uid, pcm->uid, pcm->sndcard->cid.devpath, pcm->sndcard->cid.cardid);
goto fail_pcm_sndcard;
}
if (direction == SND_PCM_STREAM_PLAYBACK) {
if (!sinkJ) {
- AFB_ApiError(mixer->api, "%s: hal=%s SND_PCM_STREAM_PLAYBACK require sinks args=%s",
+ AFB_API_ERROR(mixer->api, "%s: hal=%s SND_PCM_STREAM_PLAYBACK require sinks args=%s",
__func__, uid, json_object_get_string(argsJ));
goto fail_pcm_sndcard_ctl;
}
@@ -595,7 +595,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
if (direction == SND_PCM_STREAM_CAPTURE) {
if (!sourceJ) {
- AFB_ApiError(mixer->api, "%s: hal=%s SND_PCM_STREAM_CAPTURE require sources args=%s",
+ AFB_API_ERROR(mixer->api, "%s: hal=%s SND_PCM_STREAM_CAPTURE require sources args=%s",
__func__, uid, json_object_get_string(argsJ));
goto fail_pcm_sndcard_ctl;
}
@@ -608,7 +608,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
, "controls", &controlsJ
);
if (error) {
- AFB_ApiNotice(mixer->api, "%s: hal=%s pcms missing channels|[controls] error=%s (%s)",
+ AFB_API_NOTICE(mixer->api, "%s: hal=%s pcms missing channels|[controls] error=%s (%s)",
__func__, uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
goto fail_pcm_sndcard_ctl;
}
@@ -643,7 +643,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
break;
}
default:
- AFB_ApiError(mixer->api, "%s:%s invalid pcm=%s", pcm->uid, __func__, json_object_get_string(channelsJ));
+ AFB_API_ERROR(mixer->api, "%s:%s invalid pcm=%s", pcm->uid, __func__, json_object_get_string(channelsJ));
goto fail_pcm_sndcard_ctl;
}
}
@@ -651,7 +651,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
// check sndcard accepts params
pcm->sndcard->params = ApiPcmSetParams(mixer, pcm->uid, paramsJ);
if (!pcm->sndcard->params) {
- AFB_ApiError(mixer->api, "%s: hal=%s Fail to set params sndcard uid=%s params=%s",
+ AFB_API_ERROR(mixer->api, "%s: hal=%s Fail to set params sndcard uid=%s params=%s",
__func__, uid, pcm->uid, json_object_get_string(paramsJ));
goto fail_pcm_sndcard_ctl;
}
@@ -665,7 +665,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
, "mute", &muteJ
);
if (error) {
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s: source missing [volume]|[mute] error=%s control=%s",
__func__, wrap_json_get_error_string(error), json_object_get_string(controlsJ));
goto fail_pcm_channels;
@@ -718,7 +718,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
error = afb_api_add_verb(mixer->api, apiVerb, apiInfo, ApiPcmVerbCB, handle, NULL, 0, 0);
if (error) {
- AFB_ApiError(mixer->api, "%s mixer=%s verb=%s fail to Register Master control ",
+ AFB_API_ERROR(mixer->api, "%s mixer=%s verb=%s fail to Register Master control ",
__func__, mixer->uid, apiVerb);
goto fail_handle;
}
diff --git a/plugins/alsa/alsa-api-ramp.c b/plugins/alsa/alsa-api-ramp.c
index 060c917..53c3fe3 100644
--- a/plugins/alsa/alsa-api-ramp.c
+++ b/plugins/alsa/alsa-api-ramp.c
@@ -52,7 +52,7 @@ STATIC AlsaVolRampT *AttachOneRamp(SoftMixerT *mixer, const char *uid, json_obje
, "down", &ramp->stepDown
);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s mixer=%s hal=%s error=%s json=%s",
__func__, mixer->uid, uid, wrap_json_get_error_string(error), json_object_get_string(rampJ));
goto fail_ramp;
@@ -76,7 +76,7 @@ fail:
static void rampDestroy(SoftMixerT * mixer, void * arg) {
AlsaVolRampT * ramp = (AlsaVolRampT*) arg;
- AFB_ApiDebug(mixer->api, "%s... %s not implemented", __func__, ramp->uid);
+ AFB_API_DEBUG(mixer->api, "%s... %s not implemented", __func__, ramp->uid);
}
static AlsaVolRampT * rampCreate(SoftMixerT * mixer, const char * uid, json_object *argsJ) {
@@ -91,10 +91,10 @@ fail:
return newRamp;
}
-PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid, json_object *argsJ) {
+PUBLIC int ApiRampAttach(SoftMixerT *mixer, afb_req_t request, const char * uid, json_object *argsJ) {
if (mixer->nbRamps >= mixer->max.ramps) {
- AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max ramp=%d", mixer->uid, uid, mixer->max.ramps);
+ afb_req_fail_f(request, "too-small", "mixer=%s hal=%s max ramp=%d", mixer->uid, uid, mixer->max.ramps);
goto fail;
}
@@ -106,7 +106,7 @@ PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
case json_type_object:
newRamp = rampCreate(mixer, uid, argsJ);
if (!newRamp) {
- AFB_ReqFailF(request, "bad-ramp", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "bad-ramp", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(argsJ));
goto fail;
}
break;
@@ -114,7 +114,7 @@ PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
case json_type_array:
count = json_object_array_length(argsJ);
if (count > (mixer->max.ramps - mixer->nbRamps)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max ramp=%d", mixer->uid, uid, mixer->max.ramps);
+ afb_req_fail_f(request, "too-small", "mixer=%s hal=%s max ramp=%d", mixer->uid, uid, mixer->max.ramps);
goto fail;
}
@@ -122,13 +122,13 @@ PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
json_object *streamAudioJ = json_object_array_get_idx(argsJ, idx);
newRamp = rampCreate(mixer, uid, streamAudioJ);
if (!newRamp) {
- AFB_ReqFailF(request, "bad-ramp", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "bad-ramp", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(argsJ));
goto fail;
}
}
break;
default:
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s hal=%s ramps invalid argsJ= %s", mixer->uid, uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "invalid-syntax", "mixer=%s hal=%s ramps invalid argsJ= %s", mixer->uid, uid, json_object_get_string(argsJ));
goto fail;
}
return 0;
diff --git a/plugins/alsa/alsa-api-sink.c b/plugins/alsa/alsa-api-sink.c
index a1137c5..e00f9d1 100644
--- a/plugins/alsa/alsa-api-sink.c
+++ b/plugins/alsa/alsa-api-sink.c
@@ -26,11 +26,11 @@ PUBLIC AlsaPcmHwInfoT *ApiSinkGetParamsByZone(SoftMixerT *mixer, const char *tar
AlsaSndZoneT *zone = ApiZoneGetByUid(mixer, target);
if (!zone) {
- AFB_ApiError(mixer->api, "%s: Unable to find zone %s", __func__, target);
+ AFB_API_ERROR(mixer->api, "%s: Unable to find zone %s", __func__, target);
goto fail;
}
if (zone->nbSinks == 0) {
- AFB_ApiError(mixer->api, "%s: Zone %s has no sinks", __func__, target);
+ AFB_API_ERROR(mixer->api, "%s: Zone %s has no sinks", __func__, target);
goto fail;
}
@@ -38,7 +38,7 @@ PUBLIC AlsaPcmHwInfoT *ApiSinkGetParamsByZone(SoftMixerT *mixer, const char *tar
AlsaPcmChannelT * pcmChannel = cds_list_first_entry(&zone->sinks.list, AlsaPcmChannelT , list);
const char *channel = pcmChannel->uid;
- AFB_ApiDebug(mixer->api, "%s: first channel uid is %s, zone has %d sinks", __func__, channel, zone->nbSinks);
+ AFB_API_DEBUG(mixer->api, "%s: first channel uid is %s, zone has %d sinks", __func__, channel, zone->nbSinks);
AlsaSndPcmT * sink = NULL;
@@ -46,7 +46,7 @@ PUBLIC AlsaPcmHwInfoT *ApiSinkGetParamsByZone(SoftMixerT *mixer, const char *tar
AlsaPcmChannelT * pcmChannel;
cds_list_for_each_entry(pcmChannel, &sink->channels.list, list) {
if (pcmChannel->uid && !strcasecmp(channel, pcmChannel->uid)) {
- AFB_ApiDebug(mixer->api, "%s: found %s, return", __func__, pcmChannel->uid);
+ AFB_API_DEBUG(mixer->api, "%s: found %s, return", __func__, pcmChannel->uid);
return sink->sndcard->params;
}
}
@@ -69,14 +69,14 @@ PUBLIC AlsaSndPcmT *ApiSinkGetByUid(SoftMixerT *mixer, const char *target) {
static void sinkDestroy(SoftMixerT* mixer, void * arg) {
AlsaSndPcmT * sink = (AlsaSndPcmT*) arg;
- AFB_ApiDebug(mixer->api, "%s... %s", __func__, sink->uid);
+ AFB_API_DEBUG(mixer->api, "%s... %s", __func__, sink->uid);
cds_list_del(&sink->list);
mixer->nbSinks--;
ApiPcmDelete(mixer, sink);
}
-AlsaSndPcmT * sinkCreate(SoftMixerT * mixer, AFB_ReqT request, const char * uid, json_object * argsJ) {
+AlsaSndPcmT * sinkCreate(SoftMixerT * mixer, afb_req_t request, const char * uid, json_object * argsJ) {
AlsaPcmCtlT* dmixConfig = NULL;
char *dmixUid = NULL;
AlsaSndPcmT * newSink = ApiPcmAttachOne(mixer, uid, SND_PCM_STREAM_PLAYBACK, argsJ);
@@ -92,7 +92,7 @@ AlsaSndPcmT * sinkCreate(SoftMixerT * mixer, AFB_ReqT request, const char * uid,
}
dmixConfig = AlsaCreateDmix(mixer, dmixUid, newSink, 0);
if (!dmixConfig) {
- AFB_ReqFailF(request, "internal-error", "mixer=%s sink=%s fail to create DMIX config", mixer->uid, newSink->uid);
+ afb_req_fail_f(request, "internal-error", "mixer=%s sink=%s fail to create DMIX config", mixer->uid, newSink->uid);
goto fail_dmix;
}
}
@@ -111,10 +111,10 @@ fail_dmix:
}
-PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid, json_object * argsJ) {
+PUBLIC int ApiSinkAttach(SoftMixerT *mixer, afb_req_t request, const char * uid, json_object * argsJ) {
if (mixer->nbSinks >= mixer->max.sinks) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max sink=%d", mixer->uid, mixer->max.sinks);
+ afb_req_fail_f(request, "too-small", "mixer=%s max sink=%d", mixer->uid, mixer->max.sinks);
goto fail;
}
@@ -124,7 +124,7 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
case json_type_object: {
AlsaSndPcmT * newSink = sinkCreate(mixer, request, uid, argsJ);
if (!newSink) {
- AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "bad-pcm", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(argsJ));
goto fail;
}
break;
@@ -132,7 +132,7 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
case json_type_array: {
count = json_object_array_length(argsJ);
if (count > (mixer->max.sinks - mixer->nbSinks)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max sink=%d", mixer->uid, mixer->max.sinks);
+ afb_req_fail_f(request, "too-small", "mixer=%s max sink=%d", mixer->uid, mixer->max.sinks);
goto fail;
}
@@ -140,14 +140,14 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
json_object *sinkJ = json_object_array_get_idx(argsJ, idx);
AlsaSndPcmT * newSink = sinkCreate(mixer, request, uid, sinkJ);
if (!newSink) {
- AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(sinkJ));
+ afb_req_fail_f(request, "bad-pcm", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(sinkJ));
goto fail;
}
}
break;
}
default:
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s sinks invalid argsJ= %s", mixer->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "invalid-syntax", "mixer=%s sinks invalid argsJ= %s", mixer->uid, json_object_get_string(argsJ));
goto fail;
}
diff --git a/plugins/alsa/alsa-api-source.c b/plugins/alsa/alsa-api-source.c
index d227eab..02f009b 100644
--- a/plugins/alsa/alsa-api-source.c
+++ b/plugins/alsa/alsa-api-source.c
@@ -36,13 +36,13 @@ PUBLIC AlsaSndCtlT *ApiSourceFindSubdev(SoftMixerT *mixer, const char *target) {
static void sourceDestroy(SoftMixerT* mixer, void * arg) {
AlsaSndPcmT * source = (AlsaSndPcmT*) arg;
- AFB_ApiDebug(mixer->api, "%s... %s", __func__, source->uid);
+ AFB_API_DEBUG(mixer->api, "%s... %s", __func__, source->uid);
cds_list_del(&source->list);
mixer->nbSources--;
ApiPcmDelete(mixer, source);
- AFB_ApiDebug(mixer->api, "%s... DONE", __func__);
+ AFB_API_DEBUG(mixer->api, "%s... DONE", __func__);
}
static AlsaSndPcmT * sourceCreate(SoftMixerT* mixer, const char * uid, json_object * argsJ) {
@@ -60,10 +60,10 @@ fail:
return newSource;
}
-PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid, json_object * argsJ) {
+PUBLIC int ApiSourceAttach(SoftMixerT *mixer, afb_req_t request, const char * uid, json_object * argsJ) {
if (mixer->nbSources >= mixer->max.sources) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max source=%d", mixer->uid, mixer->max.sources);
+ afb_req_fail_f(request, "too-small", "mixer=%s max source=%d", mixer->uid, mixer->max.sources);
goto fail;
}
@@ -75,7 +75,7 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
case json_type_object:
newSource = sourceCreate(mixer, uid, argsJ);
if (!newSource) {
- AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "bad-pcm", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(argsJ));
goto fail;
}
@@ -84,7 +84,7 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
case json_type_array:
count = json_object_array_length(argsJ);
if (count > (mixer->max.sources - mixer->nbSources)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max source=%d", mixer->uid, mixer->max.sources);
+ afb_req_fail_f(request, "too-small", "mixer=%s max source=%d", mixer->uid, mixer->max.sources);
goto fail;
}
@@ -92,14 +92,14 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
json_object *sourceJ = json_object_array_get_idx(argsJ, idx);
newSource = sourceCreate(mixer, uid, sourceJ);
if (!newSource) {
- AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(sourceJ));
+ afb_req_fail_f(request, "bad-pcm", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(sourceJ));
goto fail;
}
}
break;
default:
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s sources invalid argsJ= %s", mixer->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "invalid-syntax", "mixer=%s sources invalid argsJ= %s", mixer->uid, json_object_get_string(argsJ));
goto fail;
}
diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c
index 6b743e2..c1fb749 100644
--- a/plugins/alsa/alsa-api-streams.c
+++ b/plugins/alsa/alsa-api-streams.c
@@ -40,7 +40,7 @@ typedef struct {
snd_pcm_t *pcm;
} apiHandleT;
-STATIC void StreamApiVerbCB(AFB_ReqT request) {
+STATIC void StreamApiVerbCB(afb_req_t request) {
apiHandleT *handle = (apiHandleT*) afb_req_get_vcbdata(request);
int error, verbose = 0, doClose = 0, doToggle = 0, doMute = -1, doInfo = 0;
long mute, volume, prevvol;
@@ -61,14 +61,14 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
);
if (error) {
- AFB_ReqFailF(request, "syntax-error", "Missing 'close|mute|volume|verbose' args=%s", json_object_get_string(argsJ));
+ afb_req_fail_f(request, "syntax-error", "Missing 'close|mute|volume|verbose' args=%s", json_object_get_string(argsJ));
goto OnErrorExit;
}
if (verbose) responseJ = json_object_new_object();
if (doClose) {
- AFB_ReqFailF(request, "internal-error", "(Fulup) Close action still to be done mixer=%s stream=%s", mixer->uid, handle->stream->uid);
+ afb_req_fail_f(request, "internal-error", "(Fulup) Close action still to be done mixer=%s stream=%s", mixer->uid, handle->stream->uid);
goto OnErrorExit;
}
@@ -76,7 +76,7 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
error += AlsaCtlNumidGetLong(mixer, sndcard, handle->stream->mute, &mute);
error += AlsaCtlNumidSetLong(mixer, sndcard, handle->stream->mute, !mute);
if (error) {
- AFB_ReqFailF(request, "invalid-numid", "Fail to set/get pause numid=%d", handle->stream->mute);
+ afb_req_fail_f(request, "invalid-numid", "Fail to set/get pause numid=%d", handle->stream->mute);
goto OnErrorExit;
}
@@ -88,7 +88,7 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
if (doMute != -1) {
error = AlsaCtlNumidSetLong(mixer, handle->sndcard, handle->stream->mute, doMute);
if (error) {
- AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volume numid=%d value=%d", handle->stream->volume, !doMute);
+ afb_req_fail_f(request, "StreamApiVerbCB", "Fail to set stream volume numid=%d value=%d", handle->stream->volume, !doMute);
goto OnErrorExit;
}
@@ -104,7 +104,7 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
error = AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->volume, &prevvol);
if (error) {
- AFB_ReqFailF(request, "invalid-numid", "Fail to get volume numid=%d value=%ld", handle->stream->volume, volume);
+ afb_req_fail_f(request, "invalid-numid", "Fail to get volume numid=%d value=%ld", handle->stream->volume, volume);
goto OnErrorExit;
}
@@ -124,7 +124,7 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
default:
error = sscanf(&volString[0], "%ld", &voltoset);
if (error != 1) {
- AFB_ReqFailF(request, "not-integer", "relative volume should start by '+|-' value=%s", json_object_get_string(volumeJ));
+ afb_req_fail_f(request, "not-integer", "relative volume should start by '+|-' value=%s", json_object_get_string(volumeJ));
goto OnErrorExit;
}
}
@@ -133,20 +133,20 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
voltoset = json_object_get_int(volumeJ);
break;
default:
- AFB_ReqFailF(request, "not-integer", "volume should be string or integer value=%s", json_object_get_string(volumeJ));
+ afb_req_fail_f(request, "not-integer", "volume should be string or integer value=%s", json_object_get_string(volumeJ));
goto OnErrorExit;
}
error = AlsaCtlNumidSetLong(mixer, handle->sndcard, handle->stream->volume, voltoset);
if (error) {
- AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volume numid=%d value=%ld", handle->stream->volume, voltoset);
+ afb_req_fail_f(request, "StreamApiVerbCB", "Fail to set stream volume numid=%d value=%ld", handle->stream->volume, voltoset);
goto OnErrorExit;
}
error = AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->volume, &newvol);
if (error) {
- AFB_ReqFailF(request, "invalid-numid", "Fail to get volume numid=%d value=%ld", handle->stream->volume, volume);
+ afb_req_fail_f(request, "invalid-numid", "Fail to get volume numid=%d value=%ld", handle->stream->volume, volume);
goto OnErrorExit;
}
@@ -164,7 +164,7 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
error += AlsaVolRampApply(mixer, handle->sndcard, handle->stream, rampJ);
if (error) {
- AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volram numid=%d value=%s", handle->stream->volume, json_object_get_string(rampJ));
+ afb_req_fail_f(request, "StreamApiVerbCB", "Fail to set stream volram numid=%d value=%s", handle->stream->volume, json_object_get_string(rampJ));
goto OnErrorExit;
}
}
@@ -175,13 +175,13 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
error += AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->volume, &volume);
error += AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->mute, &mute);
if (error) {
- AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to get stream numids volume=%ld mute=%ld", volume, mute);
+ afb_req_fail_f(request, "StreamApiVerbCB", "Fail to get stream numids volume=%ld mute=%ld", volume, mute);
goto OnErrorExit;
}
wrap_json_pack(&responseJ, "{si,sb}", "volume", volume, "mute", !mute);
}
- AFB_ReqSuccess(request, responseJ, NULL);
+ afb_req_success(request, responseJ, NULL);
return;
OnErrorExit:
@@ -199,18 +199,18 @@ static void paramsOverride(SoftMixerT *mixer, AlsaStreamAudioT * destStream, con
dest->channels = src->channels;
if (dest->format != src->format) {
- AFB_ApiNotice(mixer->api, "Stream %s overrides format to %d", destStream->uid, src->format);
+ AFB_API_NOTICE(mixer->api, "Stream %s overrides format to %d", destStream->uid, src->format);
dest->format = src->format;
strncpy(dest->formatString, src->formatString, SND_FORMAT_STRING_LEN );
}
if (dest->access != src->access) {
- AFB_ApiNotice(mixer->api, "Stream %s overrides access to %d", destStream->uid, src->access);
+ AFB_API_NOTICE(mixer->api, "Stream %s overrides access to %d", destStream->uid, src->access);
dest->access = src->access;
}
if (dest->rate != src->rate) {
- AFB_ApiNotice(mixer->api, "Stream %s overrides rate to %d", destStream->uid, src->rate);
+ AFB_API_NOTICE(mixer->api, "Stream %s overrides rate to %d", destStream->uid, src->rate);
dest->rate = src->rate;
}
@@ -232,7 +232,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
int pauseNumid = 0;
int volNumid = 0;
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"NEW STREAM stream %s %s, source %s, sink %s, mute %d",
uid, stream->uid, stream->source, stream->sink, stream->mute);
@@ -247,13 +247,13 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
captureDev->pcmplug_params = NULL;
captureCard = loop->sndcard;
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"%s: found loopdev %d,%d",
__func__, loop->capture, loopDev->index);
} else {
// if capture UID is not present in loop search on known sources
- AFB_ApiDebug(mixer->api,"%s: %s not found in loop, look in sources", __func__, uid);
+ AFB_API_DEBUG(mixer->api,"%s: %s not found in loop, look in sources", __func__, uid);
AlsaSndCtlT *sourceDev = ApiSourceFindSubdev(mixer, stream->source);
if (sourceDev) {
@@ -264,10 +264,10 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
captureDev->subdev = sourceDev->cid.subdev;
captureDev->pcmplug_params = sourceDev->cid.pcmplug_params;
captureCard = sourceDev;
- AFB_ApiDebug(mixer->api, "%s found capture for %s (plug %s, card %s)",
+ AFB_API_DEBUG(mixer->api, "%s found capture for %s (plug %s, card %s)",
__func__, uid, captureDev->pcmplug_params, sourceDev->cid.cardid);
} else {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s not found in loops/sources",
__func__, mixer->uid, stream->uid);
goto OnErrorExit;
@@ -277,7 +277,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
// check PCM is valid and get its full name
AlsaPcmCtlT *capturePcm = AlsaByPathOpenPcmCtl(mixer, captureDev, SND_PCM_STREAM_CAPTURE);
if (!capturePcm) {
- AFB_ApiError(mixer->api,"%s: Unable to open the capture PCM !", __func__);
+ AFB_API_ERROR(mixer->api,"%s: Unable to open the capture PCM !", __func__);
goto OnErrorExit;
}
@@ -286,11 +286,11 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
capturePcm->closeAtDeletion = true;
capturePcm->mute = stream->mute;
- AFB_ApiDebug(mixer->api,"%s: Capture PCM opened !", __func__);
+ AFB_API_DEBUG(mixer->api,"%s: Capture PCM opened !", __func__);
// Registry capturePcm PCM for active/pause event
if (loopDev && loopDev->numid) {
- AFB_ApiDebug(mixer->api, "%s: REGISTER active/pause", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: REGISTER active/pause", __func__);
error = AlsaCtlRegister(mixer, captureCard, capturePcm, FONTEND_NUMID_RUN, loopDev->numid);
if (error)
goto OnErrorExit;
@@ -300,7 +300,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
// if zones exist then retrieve zone pcmid and channel count
zone = ApiZoneGetByUid(mixer, stream->sink);
if (!zone) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s fail to find sink zone='%s'",
__func__, mixer->uid, stream->uid, stream->sink);
goto OnErrorExit;
@@ -315,7 +315,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
} else if (stream->playback) {
AlsaSndPcmT *playback = ApiSinkGetByUid(mixer, stream->playback);
if (!playback) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s fail to find sink playback='%s'",
__func__, mixer->uid, stream->uid, stream->sink);
goto OnErrorExit;
@@ -335,7 +335,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
}
}
- AFB_ApiError(mixer->api, "%s: Allocate a fake ZONE", __func__);
+ AFB_API_ERROR(mixer->api, "%s: Allocate a fake ZONE", __func__);
// create a fake zone for rate converter selection
zone=alloca(sizeof(AlsaSndZoneT));
@@ -354,20 +354,20 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api,"%s: create mute control...", __func__);
+ AFB_API_DEBUG(mixer->api,"%s: create mute control...", __func__);
pauseNumid = AlsaCtlCreateControl(mixer, captureCard, runName, 1, 0, 1, 1, stream->mute);
if (pauseNumid <= 0) {
- AFB_ApiError(mixer->api, "%s: Failed to create pause control", __func__);
+ AFB_API_ERROR(mixer->api, "%s: Failed to create pause control", __func__);
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api,"%s: register mute control...", __func__);
+ AFB_API_DEBUG(mixer->api,"%s: register mute control...", __func__);
// Registry stop/play as a pause/resume control
error = AlsaCtlRegister(mixer, captureCard, capturePcm, FONTEND_NUMID_PAUSE, pauseNumid);
if (error) {
- AFB_ApiError(mixer->api, "%s: Failed to register pause control", __func__);
+ AFB_API_ERROR(mixer->api, "%s: Failed to register pause control", __func__);
goto OnErrorExit;
}
@@ -376,16 +376,16 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api,"%s: create softvol", __func__);
+ AFB_API_DEBUG(mixer->api,"%s: create softvol", __func__);
// create stream and delay pcm opening until vol control is created
streamPcm = AlsaCreateSoftvol(mixer, stream, volSlaveId, captureCard, volName, VOL_CONTROL_MAX, 0);
if (!streamPcm) {
- AFB_ApiError(mixer->api, "%s failed to create soft volume PCM", __func__);
+ AFB_API_ERROR(mixer->api, "%s failed to create soft volume PCM", __func__);
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api,"%s: create softvol control", __func__);
+ AFB_API_DEBUG(mixer->api,"%s: create softvol control", __func__);
ApiPcmParamsShow(mixer, "Stream ", stream->params);
ApiPcmParamsShow(mixer, "Zone", zone->params);
@@ -400,13 +400,13 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
VOL_CONTROL_STEP,
stream->volume);
if (volNumid <= 0) {
- AFB_ApiError(mixer->api, "%s failed add volume control on capture card", __func__);
+ AFB_API_ERROR(mixer->api, "%s failed add volume control on capture card", __func__);
goto OnErrorExit;
}
if ((zone->params->rate != stream->params->rate) ||
(zone->params->format != stream->params->format)) {
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s: Instanciate a RATE CONVERTER (stream [rate %d,%s(%d),%d channels], zone [rate %d,%s(%d), %d channels])",
__func__,
stream->params->rate,
@@ -425,23 +425,23 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
}
streamPcm = AlsaCreateRate(mixer, stream, rateName, streamPcm, zone->params, 0);
if (!streamPcm) {
- AFB_ApiError(mixer->api, "%s: fail to create rate converter", __func__);
+ AFB_API_ERROR(mixer->api, "%s: fail to create rate converter", __func__);
goto OnErrorExit;
}
playbackName = rateName;
} else {
- AFB_ApiNotice(mixer->api, "%s: no need for a converter", __func__);
+ AFB_API_NOTICE(mixer->api, "%s: no need for a converter", __func__);
playbackName = (char*) streamPcm->cid.cardid;
}
streamPcm->isPcmPlug = zone->isPcmPlug;
- AFB_ApiDebug(mixer->api, "%s: Opening PCM PLAYBACK name %s", __func__, playbackName);
+ AFB_API_DEBUG(mixer->api, "%s: Opening PCM PLAYBACK name %s", __func__, playbackName);
// everything is now ready to open playback pcm in BLOCKING mode this time
error = snd_pcm_open(&streamPcm->handle, playbackName, SND_PCM_STREAM_PLAYBACK, 0 /* will block*/ );
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s fail to open playback PCM=%s; error=%s",
__func__, mixer->uid, stream->uid, streamPcm->cid.cardid, snd_strerror(error));
goto OnErrorExit;
@@ -452,13 +452,13 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
// start stream pcm copy (at this both capturePcm & sink pcm should be open, we use output params to configure both in+outPCM)
error = AlsaPcmCopyStart(mixer, stream, capturePcm, streamPcm, stream->params);
if (error) {
- AFB_ApiError(mixer->api, "%s: Failed to launch copy", __func__);
+ AFB_API_ERROR(mixer->api, "%s: Failed to launch copy", __func__);
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "%s: register VOL ctrl", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: register VOL ctrl", __func__);
error = AlsaCtlRegister(mixer, captureCard, capturePcm, FONTEND_NUMID_IGNORE, volNumid);
if (error) {
- AFB_ApiError(mixer->api, "%s: register control on capture", __func__);
+ AFB_API_ERROR(mixer->api, "%s: register control on capture", __func__);
goto OnErrorExit;
}
@@ -471,7 +471,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
// toggle pause/resume (should be done after pcm_start)
if ((error = snd_pcm_pause(capturePcm->handle, !value)) < 0) {
- AFB_ApiWarning(mixer->api, "CreateOneStream: mixer=%s [capturePcm=%s] fail to pause error=%s", mixer->uid, captureDev->cardid, snd_strerror(error));
+ AFB_API_WARNING(mixer->api, "CreateOneStream: mixer=%s [capturePcm=%s] fail to pause error=%s", mixer->uid, captureDev->cardid, snd_strerror(error));
}
}
@@ -509,7 +509,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
error = afb_api_add_verb(mixer->api, stream->verb, stream->info, StreamApiVerbCB, apiHandle, NULL, 0, 0);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s mixer=%s fail to Register API verb stream=%s",
__func__, mixer->uid, stream->uid);
goto OnErrorExit;
@@ -519,7 +519,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
//AlsaDumpElemConfig (source, "\n\nAlsa_Config\n------------\n", "pcm");
//AlsaDumpPcmInfo(source, "\n\nPcm_config\n-----------\n", streamPcm->handle);
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s: mixer=%s stream=%s CREATED",
__func__, mixer->uid, stream->uid);
@@ -563,25 +563,25 @@ STATIC AlsaStreamAudioT * AttachOneStream(SoftMixerT *mixer, const char *uid, co
);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: hal=%s missing 'uid|[info]|zone|source||[volume]|[mute]|[params]' error=%s stream=%s",
__func__, uid, wrap_json_get_error_string(error), json_object_get_string(streamJ));
goto OnErrorExit;
}
if (!stream->sink && !stream->playback) {
- AFB_ApiError(mixer->api, "%s: A stream must have a zone or a playback", __func__);
+ AFB_API_ERROR(mixer->api, "%s: A stream must have a zone or a playback", __func__);
goto OnErrorExit;
}
if (stream->sink && stream->playback) {
- AFB_ApiError(mixer->api, "%s: both a playback and a zone cannot be defined at the same time", __func__);
+ AFB_API_ERROR(mixer->api, "%s: both a playback and a zone cannot be defined at the same time", __func__);
goto OnErrorExit;
}
stream->params = ApiPcmSetParams(mixer, stream->uid, paramsJ);
if (!stream->params) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: hal=%s stream=%s invalid params=%s",
__func__, uid, stream->uid, json_object_get_string(paramsJ));
goto OnErrorExit;
@@ -642,38 +642,38 @@ STATIC AlsaStreamAudioT * AttachOneStream(SoftMixerT *mixer, const char *uid, co
// implement stream PCM with corresponding thread and controls
error = CreateOneStream(mixer, uid, stream);
if (error) {
- AFB_ApiError(mixer->api, "%s: failed to create stream", __func__);
+ AFB_API_ERROR(mixer->api, "%s: failed to create stream", __func__);
goto OnErrorExit;
}
return stream;
OnErrorExit:
free(stream);
- AFB_ApiError(mixer->api, "%s fail", __func__);
+ AFB_API_ERROR(mixer->api, "%s fail", __func__);
return NULL;
}
static void streamDestroy(SoftMixerT * mixer, void * arg) {
AlsaStreamAudioT * stream = (AlsaStreamAudioT*) arg;
int error = 0;
- AFB_ApiDebug(mixer->api, "%s... %s", __func__, stream->uid);
+ AFB_API_DEBUG(mixer->api, "%s... %s", __func__, stream->uid);
error = afb_api_del_verb(mixer->api, stream->uid, (void**)stream->verbApiHandle);
if (error) {
- AFB_ApiDebug(mixer->api, "%s: failed to remove verb %s", __func__, stream->uid);
+ AFB_API_DEBUG(mixer->api, "%s: failed to remove verb %s", __func__, stream->uid);
}
AlsaPcmCopyStop(mixer, stream->copy);
if (stream->softvolConfig) {
- AFB_ApiDebug(mixer->api, "%s... %s delete softvol config", __func__, stream->uid);
+ 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_ApiDebug(mixer->api, "%s... %s delete rate config", __func__, stream->uid);
+ AFB_API_DEBUG(mixer->api, "%s... %s delete rate config", __func__, stream->uid);
snd_config_delete(stream->rateConfig);
snd_config_update();
stream->rateConfig = NULL;
@@ -693,7 +693,7 @@ static void streamDestroy(SoftMixerT * mixer, void * arg) {
free(stream);
// uid is no available anymore at this position
- AFB_ApiDebug(mixer->api, "%s... DONE !", __func__);
+ AFB_API_DEBUG(mixer->api, "%s... DONE !", __func__);
}
static AlsaStreamAudioT * streamCreate(SoftMixerT * mixer, const char * uid, const char * prefix, json_object * argsJ) {
@@ -709,19 +709,19 @@ fail:
return newStream;
}
-PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid, const char *prefix, json_object * argsJ) {
+PUBLIC int ApiStreamAttach(SoftMixerT *mixer, afb_req_t request, const char * uid, const char *prefix, json_object * argsJ) {
- AFB_ApiDebug(mixer->api, "%s: %s prefix %s", __func__, uid, prefix);
+ AFB_API_DEBUG(mixer->api, "%s: %s prefix %s", __func__, uid, prefix);
AlsaStreamAudioT * newStream = NULL;
if (mixer->nbLoops == 0) {
- AFB_ApiError(mixer->api, "%s: mixer=%s No Loop found [should Registry snd_loop first]", __func__, mixer->uid);
+ AFB_API_ERROR(mixer->api, "%s: mixer=%s No Loop found [should Registry snd_loop first]", __func__, mixer->uid);
goto fail;
}
if (mixer->nbStreams >= mixer->max.streams) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max stream=%d", mixer->uid, mixer->max.streams);
+ afb_req_fail_f(request, "too-small", "mixer=%s max stream=%d", mixer->uid, mixer->max.streams);
goto fail;
}
@@ -731,7 +731,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
case json_type_object:
newStream = streamCreate(mixer, uid, prefix, argsJ);
if (!newStream) {
- AFB_ReqFailF(request, "bad-stream", "mixer=%s invalid stream= %s", mixer->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "bad-stream", "mixer=%s invalid stream= %s", mixer->uid, json_object_get_string(argsJ));
goto fail;
}
@@ -741,7 +741,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
count = json_object_array_length(argsJ);
if (count > (mixer->max.streams - mixer->nbStreams)) {
- AFB_ReqFailF(request,
+ afb_req_fail_f(request,
"too-small",
"mixer=%s max stream=%d", mixer->uid, mixer->max.streams);
goto fail;
@@ -751,7 +751,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
json_object *streamJ = json_object_array_get_idx(argsJ, idx);
newStream = streamCreate(mixer, uid, prefix, streamJ);
if (!newStream) {
- AFB_ReqFailF(request,
+ afb_req_fail_f(request,
"bad-stream",
"%s: mixer=%s invalid stream= %s",
__func__, mixer->uid, json_object_get_string(streamJ));
@@ -760,7 +760,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
}
break;
default:
- AFB_ReqFailF(request,
+ afb_req_fail_f(request,
"invalid-syntax",
"mixer=%s streams invalid argsJ= %s", mixer->uid, json_object_get_string(argsJ));
goto fail;
@@ -769,6 +769,6 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
return 0;
fail:
- AFB_ApiError(mixer->api, "%s FAILED\n", __func__);
+ AFB_API_ERROR(mixer->api, "%s FAILED\n", __func__);
return -1;
}
diff --git a/plugins/alsa/alsa-api-zones.c b/plugins/alsa/alsa-api-zones.c
index bf3bece..522058d 100644
--- a/plugins/alsa/alsa-api-zones.c
+++ b/plugins/alsa/alsa-api-zones.c
@@ -28,7 +28,7 @@ PUBLIC AlsaSndZoneT *ApiZoneGetByUid(SoftMixerT *mixer, const char *target) {
AlsaSndZoneT * zone = NULL;
if (mixer->nbZones == 0) {
- AFB_ApiError(mixer->api, "%s mixer=%s does not have any zone", __func__, mixer->uid);
+ AFB_API_ERROR(mixer->api, "%s mixer=%s does not have any zone", __func__, mixer->uid);
goto fail;
}
@@ -39,7 +39,7 @@ PUBLIC AlsaSndZoneT *ApiZoneGetByUid(SoftMixerT *mixer, const char *target) {
}
}
fail:
- AFB_ApiError(mixer->api, "%s mixer=%s fail to find zone=%s", __func__, mixer->uid, target);
+ AFB_API_ERROR(mixer->api, "%s mixer=%s fail to find zone=%s", __func__, mixer->uid, target);
return NULL;
}
@@ -69,7 +69,7 @@ STATIC AlsaPcmChannelT* ProcessOneChannel(SoftMixerT *mixer, const char* uid, js
goto fail_channel;
}
- AFB_ApiDebug(mixer->api, "%s: uid %s, channel uid %s, port %d, volume %f",
+ AFB_API_DEBUG(mixer->api, "%s: uid %s, channel uid %s, port %d, volume %f",
__func__, uid, channel->uid, channel->port, channel->volume);
return channel;
@@ -77,13 +77,13 @@ STATIC AlsaPcmChannelT* ProcessOneChannel(SoftMixerT *mixer, const char* uid, js
fail_channel:
free(channel);
fail:
- AFB_ApiError(mixer->api, "%s: zone=%s channel: missing (target|channel) json=%s", __func__, uid, json_object_get_string(channelJ));
+ AFB_API_ERROR(mixer->api, "%s: zone=%s channel: missing (target|channel) json=%s", __func__, uid, json_object_get_string(channelJ));
return NULL;
}
STATIC AlsaSndZoneT *AttachOneZone(SoftMixerT *mixer, const char *uid, json_object *zoneJ) {
- AFB_ApiDebug(mixer->api, "%s uid %s", __func__, uid);
+ AFB_API_DEBUG(mixer->api, "%s uid %s", __func__, uid);
json_object *sinkJ = NULL, *sourceJ = NULL;
size_t count;
@@ -105,7 +105,7 @@ STATIC AlsaSndZoneT *AttachOneZone(SoftMixerT *mixer, const char *uid, json_obje
, "source", &sourceJ
);
if (error || (!sinkJ && sourceJ)) {
- AFB_ApiNotice(mixer->api, "%s missing 'uid|sink|source' error=%s zone=%s", __func__, wrap_json_get_error_string(error), json_object_get_string(zoneJ));
+ AFB_API_NOTICE(mixer->api, "%s missing 'uid|sink|source' error=%s zone=%s", __func__, wrap_json_get_error_string(error), json_object_get_string(zoneJ));
goto fail_zone;
}
@@ -147,7 +147,7 @@ STATIC AlsaSndZoneT *AttachOneZone(SoftMixerT *mixer, const char *uid, json_obje
}
break;
default:
- AFB_ApiError(mixer->api, "%s: Mixer=%s Hal=%s zone=%s invalid mapping=%s", __func__, mixer->uid, uid, zone->uid, json_object_get_string(sinkJ));
+ AFB_API_ERROR(mixer->api, "%s: Mixer=%s Hal=%s zone=%s invalid mapping=%s", __func__, mixer->uid, uid, zone->uid, json_object_get_string(sinkJ));
goto fail;
}
@@ -177,13 +177,13 @@ STATIC AlsaSndZoneT *AttachOneZone(SoftMixerT *mixer, const char *uid, json_obje
}
break;
default:
- AFB_ApiError(mixer->api, "%s: Mixer=%s Hal=%s zone=%s mapping=%s",
+ AFB_API_ERROR(mixer->api, "%s: Mixer=%s Hal=%s zone=%s mapping=%s",
__func__, mixer->uid, uid, zone->uid, json_object_get_string(sourceJ));
goto fail;
}
}
- AFB_ApiDebug(mixer->api, "%s uid %s DONE", __func__, uid);
+ AFB_API_DEBUG(mixer->api, "%s uid %s DONE", __func__, uid);
return zone;
fail_uid:
@@ -197,10 +197,10 @@ fail:
static void zoneDestroy(SoftMixerT* mixer, void * arg) {
AlsaSndZoneT * zone = (AlsaSndZoneT*) arg;
- AFB_ApiDebug(mixer->api, "%s... %s (%d sinks, %d sources)", __func__, zone->uid, zone->nbSinks, zone->nbSources);
+ AFB_API_DEBUG(mixer->api, "%s... %s (%d sinks, %d sources)", __func__, zone->uid, zone->nbSinks, zone->nbSources);
if (zone->routeConfig) {
- AFB_ApiDebug(mixer->api, "%s... %s delete route config", __func__, zone->uid);
+ AFB_API_DEBUG(mixer->api, "%s... %s delete route config", __func__, zone->uid);
snd_config_delete(zone->routeConfig);
snd_config_update();
zone->routeConfig = NULL;
@@ -218,7 +218,7 @@ static void zoneDestroy(SoftMixerT* mixer, void * arg) {
free((char*) zone->uid);
free(zone);
- AFB_ApiDebug(mixer->api, "%s... DONE !", __func__);
+ AFB_API_DEBUG(mixer->api, "%s... DONE !", __func__);
}
PUBLIC AlsaSndZoneT * zoneCreate(SoftMixerT* mixer, const char * uid, json_object * argsJ) {
@@ -234,7 +234,7 @@ PUBLIC AlsaSndZoneT * zoneCreate(SoftMixerT* mixer, const char * uid, json_objec
AlsaPcmCtlT *routeConfig = AlsaCreateRoute(mixer, zone, 0);
if (!routeConfig) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: Mixer=%s Hal=%s zone=%s Fail to attach PCM Route",
__func__, mixer->uid, uid, zone->uid);
goto fail;
@@ -246,12 +246,12 @@ fail:
return zone;
}
-PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid, json_object * argsJ) {
+PUBLIC int ApiZoneAttach(SoftMixerT *mixer, afb_req_t request, const char * uid, json_object * argsJ) {
- AFB_ApiDebug(mixer->api, "%s uid %s", __func__, uid);
+ AFB_API_DEBUG(mixer->api, "%s uid %s", __func__, uid);
if (mixer->nbZones >= mixer->max.zones) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max zone=%d", mixer->uid, mixer->max.zones);
+ afb_req_fail_f(request, "too-small", "mixer=%s max zone=%d", mixer->uid, mixer->max.zones);
goto OnErrorExit;
}
@@ -261,7 +261,7 @@ PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
case json_type_object: {
AlsaSndZoneT * newZone = zoneCreate(mixer, uid, argsJ);
if (!newZone) {
- AFB_ReqFailF(request, "bad-zone", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "bad-zone", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
break;
@@ -269,7 +269,7 @@ PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
case json_type_array:
count = json_object_array_length(argsJ);
if (count > (mixer->max.zones - mixer->nbZones)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max zone=%d", mixer->uid, mixer->max.zones);
+ afb_req_fail_f(request, "too-small", "mixer=%s max zone=%d", mixer->uid, mixer->max.zones);
goto OnErrorExit;
}
@@ -277,17 +277,17 @@ PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid,
json_object *zoneJ = json_object_array_get_idx(argsJ, idx);
AlsaSndZoneT * newZone = zoneCreate(mixer, uid, zoneJ);
if (!newZone) {
- AFB_ReqFailF(request, "bad-zone", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(zoneJ));
+ afb_req_fail_f(request, "bad-zone", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(zoneJ));
goto OnErrorExit;
}
}
break;
default:
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s zones invalid argsJ= %s", mixer->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "invalid-syntax", "mixer=%s zones invalid argsJ= %s", mixer->uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "%s uid %s DONE", __func__, uid);
+ AFB_API_DEBUG(mixer->api, "%s uid %s DONE", __func__, uid);
return 0;
OnErrorExit:
diff --git a/plugins/alsa/alsa-core-ctl.c b/plugins/alsa/alsa-core-ctl.c
index e747090..8263238 100644
--- a/plugins/alsa/alsa-core-ctl.c
+++ b/plugins/alsa/alsa-core-ctl.c
@@ -47,14 +47,14 @@ PUBLIC snd_ctl_elem_id_t *AlsaCtlGetNumidElemId(SoftMixerT *mixer, AlsaSndCtlT *
snd_ctl_elem_list_alloca(&ctlList);
if ((error = snd_ctl_elem_list(sndcard->ctl, ctlList)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s [%s] fail retrieve controls",
__func__, ALSA_CTL_UID(sndcard->ctl, string));
goto fail;
}
if ((error = snd_ctl_elem_list_alloc_space(ctlList, snd_ctl_elem_list_get_count(ctlList))) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s [%s] fail retrieve count",
__func__, ALSA_CTL_UID(sndcard->ctl, string));
goto fail;
@@ -62,7 +62,7 @@ PUBLIC snd_ctl_elem_id_t *AlsaCtlGetNumidElemId(SoftMixerT *mixer, AlsaSndCtlT *
// Fulup: do not understand why snd_ctl_elem_list should be call twice to get a valid ctlCount
if ((error = snd_ctl_elem_list(sndcard->ctl, ctlList)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s [%s] fail retrieve controls",
__func__, ALSA_CTL_UID(sndcard->ctl, string));
goto fail_space;
@@ -80,7 +80,7 @@ PUBLIC snd_ctl_elem_id_t *AlsaCtlGetNumidElemId(SoftMixerT *mixer, AlsaSndCtlT *
}
if (index == ctlCount) {
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s [%s] fail get numid=%i count",
__func__, ALSA_CTL_UID(sndcard->ctl, string), numid);
goto fail_space;
@@ -106,14 +106,14 @@ PUBLIC snd_ctl_elem_id_t *AlsaCtlGetNameElemId(SoftMixerT *mixer, AlsaSndCtlT *s
snd_ctl_elem_list_alloca(&ctlList);
if ((error = snd_ctl_elem_list(sndcard->ctl, ctlList)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid='%s' cardname='%s' fail retrieve controls",
__func__, sndcard->cid.cardid, sndcard->cid.name);
goto fail;
}
if ((error = snd_ctl_elem_list_alloc_space(ctlList, snd_ctl_elem_list_get_count(ctlList))) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid='%s' cardname='%s' fail retrieve count",
__func__, sndcard->cid.cardid, sndcard->cid.name);
goto fail;
@@ -121,7 +121,7 @@ PUBLIC snd_ctl_elem_id_t *AlsaCtlGetNameElemId(SoftMixerT *mixer, AlsaSndCtlT *s
// Fulup: do not understand why snd_ctl_elem_list should be call twice to get a valid ctlCount
if ((error = snd_ctl_elem_list(sndcard->ctl, ctlList)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid='%s' cardname='%s' fail retrieve controls",
__func__, sndcard->cid.cardid, sndcard->cid.name);
goto fail_space;
@@ -139,7 +139,7 @@ PUBLIC snd_ctl_elem_id_t *AlsaCtlGetNameElemId(SoftMixerT *mixer, AlsaSndCtlT *s
}
if (index == ctlCount) {
- AFB_ApiNotice(mixer->api, "AlsaCtlGetNameElemId cardid='%s' cardname='%s' ctl not found name=%s", sndcard->cid.cardid, sndcard->cid.name, ctlName);
+ AFB_API_NOTICE(mixer->api, "AlsaCtlGetNameElemId cardid='%s' cardname='%s' ctl not found name=%s", sndcard->cid.cardid, sndcard->cid.name, ctlName);
goto fail_space;
}
@@ -163,7 +163,7 @@ STATIC void CtlElemIdDisplay(SoftMixerT *mixer, snd_ctl_elem_info_t *elemInfo, s
if (!elemData) {
- AFB_ApiWarning(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=unreadable", numid, name);
+ AFB_API_WARNING(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=unreadable", numid, name);
} else
for (int idx = 0; idx < count; idx++) {
long valueL;
@@ -171,27 +171,27 @@ STATIC void CtlElemIdDisplay(SoftMixerT *mixer, snd_ctl_elem_info_t *elemInfo, s
switch (elemType) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
valueL = snd_ctl_elem_value_get_boolean(elemData, idx);
- AFB_ApiWarning(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
+ AFB_API_WARNING(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
break;
case SND_CTL_ELEM_TYPE_INTEGER:
valueL = snd_ctl_elem_value_get_integer(elemData, idx);
- AFB_ApiWarning(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
+ AFB_API_WARNING(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
break;
case SND_CTL_ELEM_TYPE_INTEGER64:
valueL = snd_ctl_elem_value_get_integer64(elemData, idx);
- AFB_ApiWarning(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
+ AFB_API_WARNING(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
break;
case SND_CTL_ELEM_TYPE_ENUMERATED:
valueL = snd_ctl_elem_value_get_enumerated(elemData, idx);
- AFB_ApiWarning(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
+ AFB_API_WARNING(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
break;
case SND_CTL_ELEM_TYPE_BYTES:
valueL = snd_ctl_elem_value_get_byte(elemData, idx);
- AFB_ApiWarning(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
+ AFB_API_WARNING(mixer->api, "CtlElemIdDisplay: numid=%d name=%s value=%ld", numid, name, valueL);
break;
case SND_CTL_ELEM_TYPE_IEC958:
default:
- AFB_ApiWarning(mixer->api, "CtlElemIdDisplay: numid=%d name=%s Unsupported type=%d", numid, name, elemType);
+ AFB_API_WARNING(mixer->api, "CtlElemIdDisplay: numid=%d name=%s Unsupported type=%d", numid, name, elemType);
break;
}
}
@@ -273,7 +273,7 @@ PUBLIC int CtlElemIdSetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, snd_ctl_ele
OnErrorExit:
numid = snd_ctl_elem_info_get_numid(elemInfo);
name = snd_ctl_elem_info_get_name(elemInfo);
- AFB_ApiError(mixer->api, "%s: numid=%d name=%s not writable", __func__, numid, name);
+ AFB_API_ERROR(mixer->api, "%s: numid=%d name=%s not writable", __func__, numid, name);
return -1;
}
@@ -283,7 +283,7 @@ PUBLIC snd_ctl_card_info_t *AlsaCtlGetCardInfo(SoftMixerT *mixer, const char *ca
int error;
snd_ctl_t *ctl;
- AFB_ApiNotice(mixer->api, "Looking for card '%s'", cardid);
+ AFB_API_NOTICE(mixer->api, "Looking for card '%s'", cardid);
/* "bluealsa" is the name of the control external plugin
* (https://www.alsa-project.org/alsa-doc/alsa-lib/ctl_external_plugins.html)
@@ -297,7 +297,7 @@ PUBLIC snd_ctl_card_info_t *AlsaCtlGetCardInfo(SoftMixerT *mixer, const char *ca
}
}
- AFB_ApiNotice(mixer->api, "Opening card control '%s'", cardid);
+ AFB_API_NOTICE(mixer->api, "Opening card control '%s'", cardid);
if ((error = snd_ctl_open(&ctl, cardid, SND_CTL_READONLY)) < 0) {
cardid = "Not Defined";
@@ -311,7 +311,7 @@ PUBLIC snd_ctl_card_info_t *AlsaCtlGetCardInfo(SoftMixerT *mixer, const char *ca
}
if ((error = snd_ctl_card_info(ctl, cardInfo)) < 0) {
- AFB_ApiError(mixer->api, "%s fail to find sndcard by id= %s", __func__, cardid);
+ AFB_API_ERROR(mixer->api, "%s fail to find sndcard by id= %s", __func__, cardid);
goto fail_card_info;
}
@@ -323,7 +323,7 @@ fail_card_info:
fail_ctl:
snd_ctl_close(ctl);
fail:
- AFB_ApiError(mixer->api, "%s: fail to find sndcard by id= %s", __func__, cardid);
+ AFB_API_ERROR(mixer->api, "%s: fail to find sndcard by id= %s", __func__, cardid);
return NULL;
}
@@ -331,7 +331,7 @@ PUBLIC int AlsaCtlNumidSetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, int numi
snd_ctl_elem_id_t *elemId = AlsaCtlGetNumidElemId(mixer, sndcard, numid);
if (!elemId) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to find numid=%d",
__func__, sndcard->cid.cardid, sndcard->cid.longname, numid);
goto fail;
@@ -339,7 +339,7 @@ PUBLIC int AlsaCtlNumidSetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, int numi
int error = CtlElemIdSetLong(mixer, sndcard, elemId, value);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to set numid=%d value=%ld",
__func__, sndcard->cid.cardid, sndcard->cid.longname, numid, value);
goto fail_elemId;
@@ -358,7 +358,7 @@ PUBLIC int AlsaCtlNumidGetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, int numi
snd_ctl_elem_id_t *elemId = AlsaCtlGetNumidElemId(mixer, sndcard, numid);
if (!elemId) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to find numid=%d",
__func__, sndcard->cid.cardid, sndcard->cid.longname, numid);
goto fail;
@@ -366,7 +366,7 @@ PUBLIC int AlsaCtlNumidGetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, int numi
int error = CtlElemIdGetLong(mixer, sndcard, elemId, value);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to get numid=%d value",
__func__, sndcard->cid.cardid, sndcard->cid.longname, numid);
goto fail_elemId;
@@ -385,7 +385,7 @@ PUBLIC int AlsaCtlNameSetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, const cha
snd_ctl_elem_id_t *elemId = AlsaCtlGetNameElemId(mixer, sndcard, ctlName);
if (!elemId) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to find crlName=%s",
__func__, sndcard->cid.cardid, sndcard->cid.longname, ctlName);
goto fail;
@@ -393,7 +393,7 @@ PUBLIC int AlsaCtlNameSetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, const cha
int error = CtlElemIdSetLong(mixer, sndcard, elemId, value);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to set crlName=%s value=%ld",
__func__, sndcard->cid.cardid, sndcard->cid.longname, ctlName, value);
goto fail_elemId;
@@ -412,7 +412,7 @@ PUBLIC int AlsaCtlNameGetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, const cha
snd_ctl_elem_id_t *elemId = AlsaCtlGetNameElemId(mixer, sndcard, ctlName);
if (!elemId) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to find crlName=%s",
__func__, sndcard->cid.cardid, sndcard->cid.longname, ctlName);
goto fail;
@@ -420,7 +420,7 @@ PUBLIC int AlsaCtlNameGetLong(SoftMixerT *mixer, AlsaSndCtlT *sndcard, const cha
int error = CtlElemIdGetLong(mixer, sndcard, elemId, value);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to get crlName=%s value",
__func__, sndcard->cid.cardid, sndcard->cid.longname, ctlName);
goto fail_elemId;
@@ -467,7 +467,7 @@ STATIC int AlsaCtlMakeControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, const cha
break;
default:
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s cardid=%s cardname=%s fail to create %s(control)",
__func__, mixer->uid, sndcard->cid.cardid, sndcard->cid.longname, ctlName);
goto OnErrorExit;
@@ -492,7 +492,7 @@ PUBLIC int AlsaCtlCreateControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, char* c
// create or get numid control when already exist
numid = AlsaCtlMakeControl(mixer, sndcard, ctlName, ctlCount, ctlMin, ctlMax, ctlStep);
if (numid <= 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to create ctlName=%s",
__func__, sndcard->cid.cardid, sndcard->cid.longname, ctlName);
goto fail;
@@ -503,13 +503,13 @@ PUBLIC int AlsaCtlCreateControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, char* c
int error = CtlElemIdSetLong(mixer, sndcard, elemId, value);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid=%s cardname=%s fail to set ctlName=%s Numid=%d",
__func__, sndcard->cid.cardid, sndcard->cid.longname, ctlName, numid);
goto fail;
}
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s cardid=%s cardname=%s ctl create name=%s numid=%d value=%ld",
__func__, sndcard->cid.cardid, sndcard->cid.longname, ctlName, numid, value);
@@ -528,15 +528,15 @@ STATIC int CtlSubscribeEventCB(sd_event_source* src, int fd, uint32_t revents, v
snd_ctl_elem_id_t *elemId;
long value;
- AFB_ApiDebug(mixer->api, "%s event on card %s", __func__, sndcard->cid.cardid);
+ AFB_API_DEBUG(mixer->api, "%s event on card %s", __func__, sndcard->cid.cardid);
if ((revents & EPOLLHUP) != 0) {
- AFB_ApiNotice(mixer->api, "%s hanghup [card:%s disconnected]", __func__, sHandle->uid);
+ AFB_API_NOTICE(mixer->api, "%s hanghup [card:%s disconnected]", __func__, sHandle->uid);
goto OnSuccessExit;
}
if ((revents & EPOLLIN) == 0) {
- AFB_ApiNotice(mixer->api, "%s: no events", __func__);
+ AFB_API_NOTICE(mixer->api, "%s: no events", __func__);
goto OnSuccessExit;
}
@@ -546,13 +546,13 @@ STATIC int CtlSubscribeEventCB(sd_event_source* src, int fd, uint32_t revents, v
error = snd_ctl_read(sndcard->ctl, eventId);
if (error < 0) {
- AFB_ApiDebug(mixer->api, "%s: failed to read control", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: failed to read control", __func__);
goto OnErrorExit;
}
// we only process sndctrl element
if (snd_ctl_event_get_type(eventId) != SND_CTL_EVENT_ELEM) {
- AFB_ApiDebug(mixer->api, "%s: bad event type", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: bad event type", __func__);
goto OnSuccessExit;
}
@@ -566,7 +566,7 @@ STATIC int CtlSubscribeEventCB(sd_event_source* src, int fd, uint32_t revents, v
snd_ctl_event_elem_get_id(eventId, elemId);
error = CtlElemIdGetLong(mixer, sHandle->sndcard, elemId, &value);
if (error) {
- AFB_ApiDebug(mixer->api, "%s: failed to get elem id", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: failed to get elem id", __func__);
goto OnErrorExit;
}
@@ -575,12 +575,12 @@ STATIC int CtlSubscribeEventCB(sd_event_source* src, int fd, uint32_t revents, v
snd_ctl_elem_info_alloca(&elemInfo);
snd_ctl_elem_info_set_id(elemInfo, elemId);
if (snd_ctl_elem_info(sndcard->ctl, elemInfo) < 0) {
- AFB_ApiDebug(mixer->api, "%s: failed to get elem info", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: failed to get elem info", __func__);
goto OnErrorExit;
}
int numid = snd_ctl_elem_info_get_numid(elemInfo);
- AFB_ApiDebug(mixer->api, "%s: event on elem id %d", __func__, numid);
+ AFB_API_DEBUG(mixer->api, "%s: event on elem id %d", __func__, numid);
const char *name= snd_ctl_elem_info_get_name(elemInfo);
@@ -598,25 +598,25 @@ STATIC int CtlSubscribeEventCB(sd_event_source* src, int fd, uint32_t revents, v
case FONTEND_NUMID_RUN:
AlsaPcmCopyMuteSignal(mixer, registry->pcm, !value);
ret = snd_pcm_pause(pcm, (int) (!value));
- AFB_ApiNotice(mixer->api, "%s:%s numid=%d name=%s active=%ld ret %d",
+ AFB_API_NOTICE(mixer->api, "%s:%s numid=%d name=%s active=%ld ret %d",
__func__, sHandle->uid, numid, name, value, ret);
if (ret < 0) {
- AFB_ApiNotice(mixer->api, "%s error: %s", __func__, snd_strerror(ret));
+ AFB_API_NOTICE(mixer->api, "%s error: %s", __func__, snd_strerror(ret));
}
break;
case FONTEND_NUMID_PAUSE:
AlsaPcmCopyMuteSignal(mixer, registry->pcm, value);
ret = snd_pcm_pause(registry->pcm->handle, (int) value);
- AFB_ApiNotice(mixer->api, "%s:%s numid=%d name=%s pause=%ld ret %d",
+ AFB_API_NOTICE(mixer->api, "%s:%s numid=%d name=%s pause=%ld ret %d",
__func__, sHandle->uid, numid, name, value, ret);
if (ret < 0) {
- AFB_ApiNotice(mixer->api, "%s error %s", __func__, snd_strerror(ret));
+ AFB_API_NOTICE(mixer->api, "%s error %s", __func__, snd_strerror(ret));
}
break;
case FONTEND_NUMID_IGNORE:
default:
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"%s:%s numid=%d name=%s ignored=%ld",
__func__, sHandle->uid, numid, name, value);
}
@@ -624,14 +624,14 @@ STATIC int CtlSubscribeEventCB(sd_event_source* src, int fd, uint32_t revents, v
}
}
if (!found) {
- AFB_ApiNotice(mixer->api, "%s:%s numid=%d is unknown", __func__, sHandle->uid, numid);
+ AFB_API_NOTICE(mixer->api, "%s:%s numid=%d is unknown", __func__, sHandle->uid, numid);
}
OnSuccessExit:
return 0;
OnErrorExit:
- AFB_ApiDebug(mixer->api, "%s: ignored unsupported event", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: ignored unsupported event", __func__);
return 0;
}
@@ -639,7 +639,7 @@ OnErrorExit:
PUBLIC int AlsaCtlUnSubscribe(SoftMixerT *mixer, AlsaSndCtlT *sndcard) {
SubscribeHandleT * handle = sndcard->eventSubscribeHandle;
- AFB_ApiDebug(mixer->api,"%s for card %s", __func__, sndcard->cid.cardid);
+ AFB_API_DEBUG(mixer->api,"%s for card %s", __func__, sndcard->cid.cardid);
sd_event_source_unref(handle->evtsrc);
free(handle);
@@ -664,7 +664,7 @@ PUBLIC int AlsaCtlSubscribe(SoftMixerT *mixer, const char *uid, AlsaSndCtlT *snd
// subscribe for sndctl events attached to cardid
if ((error = snd_ctl_subscribe_events(handle->sndcard->ctl, 1)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: fail sndcard=%s to subscribe events",
__func__, ALSA_CTL_UID(handle->sndcard->ctl, string));
goto OnErrorExit;
@@ -673,7 +673,7 @@ PUBLIC int AlsaCtlSubscribe(SoftMixerT *mixer, const char *uid, AlsaSndCtlT *snd
// get pollfd attach to this sound board
int count = snd_ctl_poll_descriptors(handle->sndcard->ctl, &pfds, 1);
if (count != 1) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: fail sndcard=%s get poll descriptors",
__func__, ALSA_CTL_UID(handle->sndcard->ctl, string));
goto OnErrorExit;
@@ -681,7 +681,7 @@ PUBLIC int AlsaCtlSubscribe(SoftMixerT *mixer, const char *uid, AlsaSndCtlT *snd
// Registry sound event to binder main loop
if ((error = sd_event_add_io(mixer->sdLoop, &handle->evtsrc, pfds.fd, EPOLLIN, CtlSubscribeEventCB, handle)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: Fail sndcard=%s adding mainloop",
__func__, ALSA_CTL_UID(handle->sndcard->ctl, string));
goto OnErrorExit;
@@ -697,7 +697,7 @@ PUBLIC void AlsaCtlUnregister(SoftMixerT* mixer, void * arg) {
RegistryEntryPcmT * registryEntry = (RegistryEntryPcmT*) arg;
- AFB_ApiDebug(mixer->api,"%s: card %s : Unregistering control ID %d (%ld in registry).",
+ AFB_API_DEBUG(mixer->api,"%s: card %s : Unregistering control ID %d (%ld in registry).",
__func__, registryEntry->sndcard->cid.cardid, registryEntry->numid, registryEntry->sndcard->nbRegistry);
AlsaSndCtlT * sndcard = registryEntry->sndcard;
@@ -708,16 +708,16 @@ PUBLIC void AlsaCtlUnregister(SoftMixerT* mixer, void * arg) {
AlsaCtlUnSubscribe(mixer, sndcard);
free(registryEntry);
- AFB_ApiDebug(mixer->api,"%s: DONE", __func__);
+ AFB_API_DEBUG(mixer->api,"%s: DONE", __func__);
}
PUBLIC int AlsaCtlRegister(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaPcmCtlT *pcmdev, RegistryNumidT type, int numid) {
- AFB_ApiDebug(mixer->api,"%s: registering control ID %d to %s", __func__, numid, sndcard->cid.cardid);
+ AFB_API_DEBUG(mixer->api,"%s: registering control ID %d to %s", __func__, numid, sndcard->cid.cardid);
if (sndcard->nbRegistry >= SMIXER_SUBDS_CTLS ) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s cardid='%s' cardname='%s' too many registered controls max=%ld",
__func__, sndcard->cid.cardid, sndcard->cid.longname, sndcard->nbRegistry);
goto fail;
diff --git a/plugins/alsa/alsa-core-pcm.c b/plugins/alsa/alsa-core-pcm.c
index a45d463..3ef6012 100644
--- a/plugins/alsa/alsa-core-pcm.c
+++ b/plugins/alsa/alsa-core-pcm.c
@@ -98,7 +98,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
const char * modeS = mode==SND_PCM_STREAM_PLAYBACK?"PLAYBACK":"CAPTURE";
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"%s: mixer info %s uid %s, pcm %s, mode %s",
__func__, mixer->info, mixer->uid, card, modeS);
@@ -106,11 +106,11 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_alloca(&pxmHwParams);
error = snd_pcm_hw_params_any(pcm->handle, pxmHwParams);
if (error < 0) {
- AFB_ApiError(mixer->api, "%s: Failed to get parameters: %s", __func__, snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Failed to get parameters: %s", __func__, snd_strerror(error));
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "(%s): PARAMS before:", card);
+ AFB_API_DEBUG(mixer->api, "(%s): PARAMS before:", card);
AlsaDumpPcmParams(mixer, pxmHwParams);
if (!opts->access)
@@ -119,7 +119,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_get_access(pxmHwParams, &access);
error = snd_pcm_hw_params_set_access(pcm->handle, pxmHwParams, opts->access);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s) set_access failed (ignore this error): mixer=%s access=%d Fail current=%d mode error=%s",
__func__, card, mixer->uid, opts->access, access, snd_strerror(error));
//Fulup goto OnErrorExit;
@@ -128,7 +128,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (opts->format != SND_PCM_FORMAT_UNKNOWN) {
snd_pcm_hw_params_get_format(pxmHwParams, &format);
if ((error = snd_pcm_hw_params_set_format(pcm->handle, pxmHwParams, opts->format)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s) mixer=%s Set_Format=%s (%d) FAILED current=%d error=%s",
__func__, card, mixer->uid, opts->formatString, opts->format, format, snd_strerror(error));
AlsaDumpFormats(mixer, pcm->handle);
@@ -138,12 +138,12 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (opts->rate > 0 ) {
- AFB_ApiDebug(mixer->api,"%s (%s): set rate to %d", __func__, card, opts->rate);
+ AFB_API_DEBUG(mixer->api,"%s (%s): set rate to %d", __func__, card, opts->rate);
unsigned int pcmRate = opts->rate;
/* Attempt to set the rate. Failing on a capture dev is acceptable */
error = snd_pcm_hw_params_set_rate_near(pcm->handle, pxmHwParams, &opts->rate, 0);
if ( mode == SND_PCM_STREAM_PLAYBACK && error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s FailSet_Rate=%d error=%s",
__func__, card, mixer->uid, opts->rate, snd_strerror(error));
goto OnErrorExit;
@@ -151,7 +151,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// check we got requested rate
if (mode == SND_PCM_STREAM_PLAYBACK && opts->rate != pcmRate) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Set_Rate Fail ask=%dHz get=%dHz",
__func__, card, mixer->uid, pcmRate, opts->rate);
goto OnErrorExit;
@@ -160,7 +160,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (opts->channels) {
if ((error = snd_pcm_hw_params_set_channels(pcm->handle, pxmHwParams, opts->channels)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Set_Channels=%d Fail error=%s",
__func__, card, mixer->uid, opts->channels, snd_strerror(error));
goto OnErrorExit;
@@ -179,7 +179,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
error = snd_pcm_hw_params_get_buffer_time_max(pxmHwParams, &buffer_time, 0);
- AFB_ApiDebug(mixer->api, "(%s) HW_BUFFER_TIME MAX is %d", card, buffer_time);
+ AFB_API_DEBUG(mixer->api, "(%s) HW_BUFFER_TIME MAX is %d", card, buffer_time);
if (buffer_time > 500000)
buffer_time = 500000;
@@ -192,31 +192,31 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
}
if (period_time > 0) {
- AFB_ApiDebug(mixer->api, "(%s) SET PERIOD TIME to %d", card, period_time);
+ AFB_API_DEBUG(mixer->api, "(%s) SET PERIOD TIME to %d", card, period_time);
error = snd_pcm_hw_params_set_period_time_near(pcm->handle, pxmHwParams, &period_time, 0);
}
else {
- AFB_ApiDebug(mixer->api, "(%s) SET PERIOD SIZE...", card);
+ AFB_API_DEBUG(mixer->api, "(%s) SET PERIOD SIZE...", card);
error = snd_pcm_hw_params_set_period_size_near(pcm->handle, pxmHwParams, &period_frames, 0);
}
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to set period in hwparams error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
}
if (buffer_time > 0) {
- AFB_ApiDebug(mixer->api, "(%s) SET BUFFER TIME to %d", card, buffer_time);
+ AFB_API_DEBUG(mixer->api, "(%s) SET BUFFER TIME to %d", card, buffer_time);
error = snd_pcm_hw_params_set_buffer_time_near(pcm->handle, pxmHwParams, &buffer_time, 0);
} else {
- AFB_ApiDebug(mixer->api, "(%s) SET BUFFER SIZE to %ld...", card, buffer_frames);
+ AFB_API_DEBUG(mixer->api, "(%s) SET BUFFER SIZE to %ld...", card, buffer_frames);
error = snd_pcm_hw_params_set_buffer_size_near(pcm->handle, pxmHwParams, &buffer_frames);
}
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to set buffer in hwparams error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
@@ -224,13 +224,13 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// store selected values
if ((error = snd_pcm_hw_params(pcm->handle, pxmHwParams)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to apply hwparams error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "(%s) PARAMS after:", card);
+ AFB_API_DEBUG(mixer->api, "(%s) PARAMS after:", card);
AlsaDumpPcmParams(mixer, pxmHwParams);
// check we effective hw params after optional format change
@@ -238,11 +238,11 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_get_format(pxmHwParams, &opts->format);
snd_pcm_hw_params_get_rate(pxmHwParams, &opts->rate, 0);
- AFB_ApiDebug(mixer->api, "(%s) rate is %d", card, opts->rate);
+ AFB_API_DEBUG(mixer->api, "(%s) rate is %d", card, opts->rate);
opts->sampleSize = AlsaPeriodSize(opts->format);
if (opts->sampleSize == 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail unsupported format format=%d",
__func__, card, mixer->uid, opts->format);
goto OnErrorExit;
@@ -253,7 +253,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_get_period_size(pxmHwParams, &chunk_size, 0);
snd_pcm_hw_params_get_buffer_size(pxmHwParams, &buffer_size);
if (chunk_size == buffer_size) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"(%s) Can't use period equal to buffer size (%lu == %lu)",
card, chunk_size, buffer_size);
goto OnErrorExit;
@@ -276,7 +276,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// when the call to poll returns. Assume this is the same for playback (not checked that)
if ((error = snd_pcm_sw_params_set_avail_min(pcm->handle, pxmSwParams, n)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail set_buffersize error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
@@ -299,16 +299,16 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (start_threshold > n/2)
start_threshold = n/2;
- AFB_ApiDebug(mixer->api, "(%s) CALCULATED START THRESHOLD: %ld", card, start_threshold);
+ AFB_API_DEBUG(mixer->api, "(%s) CALCULATED START THRESHOLD: %ld", card, start_threshold);
if (mode == SND_PCM_STREAM_PLAYBACK) {
start_threshold = 1;
}
- AFB_ApiDebug(mixer->api, "(%s) %s: Set start threshold to %ld", card, modeS, start_threshold);
+ AFB_API_DEBUG(mixer->api, "(%s) %s: Set start threshold to %ld", card, modeS, start_threshold);
error = snd_pcm_sw_params_set_start_threshold(pcm->handle, pxmSwParams, start_threshold);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s failed set start_threshold, error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
@@ -316,13 +316,13 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// push software params into PCM
if ((error = snd_pcm_sw_params(pcm->handle, pxmSwParams)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to push SW params error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
};
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s (%s): mixer=%s Done channels=%d rate=%d format=%d access=%d ... DONE !",
__func__, card, mixer->uid, opts->channels, opts->rate, opts->format, opts->access);
return 0;
@@ -346,7 +346,7 @@ STATIC int AlsaPcmReadCB( AlsaPcmCopyHandleT * pcmCopyHandle) {
if (availIn <= 0) {
if (availIn == -EPIPE) {
int ret = xrun(pcmIn, (int)availIn);
- AFB_ApiDebug(pcmCopyHandle->api, "XXX read EPIPE (recov=%d) {%s}!", ret, ALSA_PCM_UID(pcmIn, string));
+ AFB_API_DEBUG(pcmCopyHandle->api, "XXX read EPIPE (recov=%d) {%s}!", ret, ALSA_PCM_UID(pcmIn, string));
// For some (undocumented...) reason, a start is mandatory.
snd_pcm_start(pcmIn);
@@ -383,10 +383,10 @@ STATIC int AlsaPcmReadCB( AlsaPcmCopyHandleT * pcmCopyHandle) {
if (nbRead < 0) {
if (nbRead== -EPIPE) {
err = xrun(pcmIn, (int)nbRead);
- AFB_ApiDebug(pcmCopyHandle->api, "read EPIPE (%d), recov %d", ++pcmCopyHandle->read_err_count, err);
+ AFB_API_DEBUG(pcmCopyHandle->api, "read EPIPE (%d), recov %d", ++pcmCopyHandle->read_err_count, err);
goto ExitOnSuccess;
} else if (nbRead== -ESTRPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "read ESTRPIPE");
+ AFB_API_DEBUG(pcmCopyHandle->api, "read ESTRPIPE");
if ((err = suspend(pcmIn, (int)nbRead)) < 0)
goto ExitOnSuccess;
nbRead = 0;
@@ -448,7 +448,7 @@ static void readSuspend(AlsaPcmCopyHandleT * pcmCopyHandle) {
pcmCopyHandle->saveFd = pcmCopyHandle->pollFds[1].fd;
pcmCopyHandle->pollFds[1].fd = -1;
- AFB_ApiNotice(pcmCopyHandle->api, "capture muted");
+ AFB_API_NOTICE(pcmCopyHandle->api, "capture muted");
}
static void readResume(AlsaPcmCopyHandleT * pcmCopyHandle) {
@@ -457,7 +457,7 @@ static void readResume(AlsaPcmCopyHandleT * pcmCopyHandle) {
pcmCopyHandle->pollFds[1].fd = pcmCopyHandle->saveFd;
snd_pcm_prepare(pcmCopyHandle->pcmIn->handle);
snd_pcm_start(pcmCopyHandle->pcmIn->handle);
- AFB_ApiNotice(pcmCopyHandle->api, "capture unmuted");
+ AFB_API_NOTICE(pcmCopyHandle->api, "capture unmuted");
}
@@ -468,7 +468,7 @@ static void *readThreadEntry(void *handle) {
pcmCopyHandle->tid = (int) syscall(SYS_gettid);
int ix;
- AFB_ApiNotice(pcmCopyHandle->api,
+ AFB_API_NOTICE(pcmCopyHandle->api,
"%s :%s/%d Started, muted=%d",
__func__, pcmCopyHandle->info, pcmCopyHandle->tid, pcmCopyHandle->pcmIn->mute);
@@ -492,13 +492,13 @@ static void *readThreadEntry(void *handle) {
int err = poll(pcmCopyHandle->pollFds, pcmCopyHandle->nbPcmFds, LOOP_TIMEOUT_MSEC);
if (err < 0) {
- AFB_ApiError(pcmCopyHandle->api, "%s: poll err %s", __func__, strerror(errno));
+ AFB_API_ERROR(pcmCopyHandle->api, "%s: poll err %s", __func__, strerror(errno));
continue;
}
if (err == 0) {
/* timeout */
-// AFB_ApiDebug(pcmCopyHandle->api, "%s(%s) alive, mute %d", __func__, pcmCopyHandle->pcmIn->cid.cardid, muted );
+// AFB_API_DEBUG(pcmCopyHandle->api, "%s(%s) alive, mute %d", __func__, pcmCopyHandle->pcmIn->cid.cardid, muted );
continue;
}
@@ -524,12 +524,12 @@ static void *readThreadEntry(void *handle) {
};
break;
case PCM_COPY_END:
- AFB_ApiDebug(pcmCopyHandle->api, "%s ending -> EXIT", __func__);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s ending -> EXIT", __func__);
goto done;
break;
case PCM_COPY_LAST:
default:
- AFB_ApiError(pcmCopyHandle->api, "%s: Unexpected event 0x%x", __func__, event.eventType);
+ AFB_API_ERROR(pcmCopyHandle->api, "%s: Unexpected event 0x%x", __func__, event.eventType);
break;
}
continue;
@@ -545,7 +545,7 @@ static void *readThreadEntry(void *handle) {
}
if (revents & POLLHUP) {
- AFB_ApiNotice(pcmCopyHandle->api, "Frame POLLHUP");
+ AFB_API_NOTICE(pcmCopyHandle->api, "Frame POLLHUP");
continue;
}
@@ -589,7 +589,7 @@ static void *writeThreadEntry(void *handle) {
while (true) {
if (pcmCopyHandle->ending) {
- AFB_ApiDebug(pcmCopyHandle->api, "%s: ending -> EXIT", __func__);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s: ending -> EXIT", __func__);
goto done;
}
@@ -598,12 +598,12 @@ static void *writeThreadEntry(void *handle) {
if (availOut < 0) {
if (availOut == -EPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "%s: write update EPIPE", cardid);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s: write update EPIPE", cardid);
xrun(pcmOut, (int)availOut);
continue;
}
if (availOut == -ESTRPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "%s: write update ESTRPIPE", cardid);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s: write update ESTRPIPE", cardid);
suspend(pcmOut, (int)availOut);
continue;
}
@@ -633,15 +633,15 @@ static void *writeThreadEntry(void *handle) {
if (nbWritten <= 0) {
if (nbWritten == -EPIPE) {
int err = xrun(pcmOut, (int)nbWritten);
- AFB_ApiDebug(pcmCopyHandle->api, "XXX %s write EPIPE (%d), recov %d",
+ AFB_API_DEBUG(pcmCopyHandle->api, "XXX %s write EPIPE (%d), recov %d",
pcmCopyHandle->pcmOut->cid.cardid, ++pcmCopyHandle->write_err_count , err);
continue;
} else if (nbWritten == -ESTRPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "XXX write ESTRPIPE");
+ AFB_API_DEBUG(pcmCopyHandle->api, "XXX write ESTRPIPE");
break;
}
- AFB_ApiDebug(pcmCopyHandle->api, "Unhandled error %s", strerror(errno));
+ AFB_API_DEBUG(pcmCopyHandle->api, "Unhandled error %s", strerror(errno));
break;
}
@@ -684,17 +684,17 @@ static int AlsaPcmCopyEnd(SoftMixerT *mixer, AlsaPcmCopyHandleT * handle) {
PUBLIC int AlsaPcmCopyStop(SoftMixerT *mixer, AlsaPcmCopyHandleT * handle) {
- AFB_ApiDebug(mixer->api, "%s: Stopping copy threads of %s", __func__, handle->stream->uid);
+ AFB_API_DEBUG(mixer->api, "%s: Stopping copy threads of %s", __func__, handle->stream->uid);
AlsaPcmCopyEnd(mixer, handle);
if (pthread_join(handle->wthread, NULL) != 0)
- AFB_ApiDebug(mixer->api, "%s: Failed to join write thread", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Failed to join write thread", __func__);
if (pthread_join(handle->rthread, NULL) != 0)
- AFB_ApiDebug(mixer->api, "%s: Failed to join read thread", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Failed to join read thread", __func__);
- AFB_ApiDebug(mixer->api, "%s: Copy threads of %s are STOPPED", __func__, handle->stream->uid);
+ AFB_API_DEBUG(mixer->api, "%s: Copy threads of %s are STOPPED", __func__, handle->stream->uid);
sem_destroy(&handle->sem);
@@ -735,45 +735,45 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
pcmIn->mixer = mixer;
pcmOut->mixer = mixer;
- AFB_ApiDebug(mixer->api, "%s: Configure CAPTURE PCM", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Configure CAPTURE PCM", __func__);
// prepare PCM for capture and replay
error = AlsaPcmConf(mixer, pcmIn, SND_PCM_STREAM_CAPTURE);
if (error) {
- AFB_ApiError(mixer->api, "%s: PCM configuration for capture failed", __func__);
+ AFB_API_ERROR(mixer->api, "%s: PCM configuration for capture failed", __func__);
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "%s: Configure PLAYBACK PCM", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Configure PLAYBACK PCM", __func__);
// input and output should match
error = AlsaPcmConf(mixer, pcmOut, SND_PCM_STREAM_PLAYBACK);
if (error) {
- AFB_ApiError(mixer->api, "%s: PCM configuration for playback failed", __func__);
+ AFB_API_ERROR(mixer->api, "%s: PCM configuration for playback failed", __func__);
goto OnErrorExit;
}
// Prepare PCM for usage
if ((error = snd_pcm_prepare(pcmOut->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to prepare PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to prepare PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
goto OnErrorExit;
};
// Prepare PCM for usage
if ((error = snd_pcm_prepare(pcmIn->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to prepare CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to prepare CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
goto OnErrorExit;
};
// Start PCM
if ((error = snd_pcm_start(pcmOut->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to start PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to start PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
goto OnErrorExit;
};
// Start PCM
if ((error = snd_pcm_start(pcmIn->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to start CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to start CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
goto OnErrorExit;
};
@@ -791,8 +791,8 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
cHandle->stream = stream;
cHandle->frame_size = (snd_pcm_format_physical_width(opts->format) / 8) * opts->channels;
- AFB_ApiDebug(mixer->api, "%s: Frame size is %zu", __func__, cHandle->frame_size);
- AFB_ApiDebug(mixer->api, "%s: Buffer delay is %d ms", __func__, stream->delayms);
+ AFB_API_DEBUG(mixer->api, "%s: Frame size is %zu", __func__, cHandle->frame_size);
+ AFB_API_DEBUG(mixer->api, "%s: Buffer delay is %d ms", __func__, stream->delayms);
snd_pcm_uframes_t nbFrames = (stream->delayms * opts->rate)/1000;
@@ -805,12 +805,12 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
cHandle->read_err_count = 0;
cHandle->write_err_count = 0;
- AFB_ApiDebug(mixer->api, "%s Copy buffer: nbframes is %zu", __func__, nbFrames);
+ AFB_API_DEBUG(mixer->api, "%s Copy buffer: nbframes is %zu", __func__, nbFrames);
// get FD poll descriptor for capture PCM
int pcmInCount = snd_pcm_poll_descriptors_count(pcmIn->handle);
if (pcmInCount <= 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: Fail pcmIn=%s get fds count error=%s",
__func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
goto OnErrorExit;
@@ -824,7 +824,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
}
if ((error = snd_pcm_poll_descriptors(pcmIn->handle, cHandle->pollFds+1, pcmInCount)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: Fail pcmIn=%s get pollfds error=%s",
__func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
goto OnErrorExit;
@@ -834,7 +834,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
int eventFdPipe[2];
error = pipe(eventFdPipe);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"Unable to create the mute signaling pipe");
goto OnErrorExit;
}
@@ -850,7 +850,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
error = sem_init(&cHandle->sem, 0 , 0);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail initialize loop semaphore pcmIn=%s err=%d",
__func__, ALSA_PCM_UID(pcmIn->handle, string), error);
goto OnErrorExit;
@@ -862,7 +862,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
error = pthread_mutex_init(&cHandle->mutex, &attr);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail initialize loop mutex pcmIn=%s err=%d",
__func__, ALSA_PCM_UID(pcmIn->handle, string), error);
}
@@ -870,7 +870,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
/// start a thread for writing
if ((error = pthread_create(&cHandle->wthread, NULL, &readThreadEntry, cHandle)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail create write thread pcmOut=%s err=%d",
__func__, ALSA_PCM_UID(pcmOut->handle, string), error);
goto OnErrorExit;
@@ -878,7 +878,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
// start a thread for reading
if ((error = pthread_create(&cHandle->rthread, NULL, &writeThreadEntry, cHandle)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail create read thread pcmIn=%s err=%d",
__func__, ALSA_PCM_UID(pcmIn->handle, string), error);
goto OnErrorExit;
@@ -890,14 +890,14 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
error= pthread_setschedparam(cHandle->rthread, SCHED_FIFO, &params);
if (error) {
- AFB_ApiWarning(mixer->api,
+ AFB_API_WARNING(mixer->api,
"%s: Failed to increase stream read thread priority pcmIn=%s err=%s",
__func__, ALSA_PCM_UID(pcmIn->handle, string), strerror(error));
}
error= pthread_setschedparam(cHandle->wthread, SCHED_FIFO, &params);
if (error) {
- AFB_ApiWarning(mixer->api,
+ AFB_API_WARNING(mixer->api,
"%s: Failed to increase stream write thread priority pcmIn=%s err=%s",
__func__, ALSA_PCM_UID(pcmOut->handle, string), strerror(error));
}
@@ -907,8 +907,8 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
return 0;
OnErrorExit:
- AFB_ApiError(mixer->api, "%s: - pcmIn=%s" , __func__, ALSA_PCM_UID(pcmIn->handle, string));
- AFB_ApiError(mixer->api, "%s: - pcmOut=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string));
+ AFB_API_ERROR(mixer->api, "%s: - pcmIn=%s" , __func__, ALSA_PCM_UID(pcmIn->handle, string));
+ AFB_API_ERROR(mixer->api, "%s: - pcmOut=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string));
if (cHandle &&cHandle->pollFds) {
free (cHandle->pollFds);
diff --git a/plugins/alsa/alsa-effect-ramp.c b/plugins/alsa/alsa-effect-ramp.c
index a3bf54b..a24615f 100644
--- a/plugins/alsa/alsa-effect-ramp.c
+++ b/plugins/alsa/alsa-effect-ramp.c
@@ -75,7 +75,7 @@ STATIC int VolRampTimerCB(sd_event_source* source, uint64_t timer, void* handle)
return 0;
OnErrorExit:
- AFB_ApiWarning(rHandle->mixer->api, "VolRampTimerCB stream=%s numid=%d value=%ld", rHandle->uid, rHandle->numid, rHandle->current);
+ AFB_API_WARNING(rHandle->mixer->api, "VolRampTimerCB stream=%s numid=%d value=%ld", rHandle->uid, rHandle->numid, rHandle->current);
sd_event_source_unref(source); // abandon volRamp
return -1;
}
@@ -93,7 +93,7 @@ PUBLIC int AlsaVolRampApply(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaStreamA
, "volume", &volJ
);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s invalid-json should {uid:ramp, vol:[+,-,=]value} ramp=%s",
__func__, mixer->uid, stream->uid, json_object_get_string(rampJ));
goto OnErrorExit;
@@ -127,7 +127,7 @@ PUBLIC int AlsaVolRampApply(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaStreamA
}
if (count != 1) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s invalid-numeric expect {uid:%s, vol:[+,-,=]value} get vol:%s",
__func__, mixer->uid, stream->uid, uid, json_object_get_string(volJ));
goto OnErrorExit;
@@ -138,7 +138,7 @@ PUBLIC int AlsaVolRampApply(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaStreamA
break;
default:
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s :mixer=%s stream=%s invalid-type expect {uid:%s, vol:[+,-,=]value} get vol:%s",
__func__, mixer->uid, stream->uid, uid, json_object_get_string(volJ));
goto OnErrorExit;
@@ -147,7 +147,7 @@ PUBLIC int AlsaVolRampApply(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaStreamA
error = AlsaCtlNumidGetLong(mixer, sndcard, stream->volume, &curvol);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s ramp=%s Fail to get volume from numid=%d",
__func__, mixer->uid, stream->uid, uid, stream->volume);
goto OnErrorExit;
@@ -164,7 +164,7 @@ PUBLIC int AlsaVolRampApply(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaStreamA
}
if (!found) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: mixer=%s stream=%s ramp=%s does not exit",
__func__, mixer->uid, stream->uid, uid);
goto OnErrorExit;
diff --git a/plugins/alsa/alsa-plug-dmix.c b/plugins/alsa/alsa-plug-dmix.c
index 9aaf866..8dd9507 100644
--- a/plugins/alsa/alsa-plug-dmix.c
+++ b/plugins/alsa/alsa-plug-dmix.c
@@ -41,7 +41,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
char * fullPcmName = NULL;
int error=0;
- AFB_ApiDebug(mixer->api, "%s: %s, slave %s, cardid %s (dev %d, subdev %d)",
+ AFB_API_DEBUG(mixer->api, "%s: %s, slave %s, cardid %s (dev %d, subdev %d)",
__func__,
pcmName,
pcmSlave->uid,
@@ -107,7 +107,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
if (open) error = _snd_pcm_dmix_open(&pcmPlug->handle, pcmPlug->cid.cardid, snd_config, dmixConfig, SND_PCM_STREAM_PLAYBACK , SND_PCM_NONBLOCK);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: fail to create Dmix=%s Slave=%s Error=%s",
__func__, sndSlave->cid.cardid, sndSlave->cid.cardid, snd_strerror(error));
goto OnErrorExit;
@@ -117,13 +117,13 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
error += snd_config_search(snd_config, "pcm", &pcmConfig);
error += snd_config_add(pcmConfig, dmixConfig);
if (error) {
- AFB_ApiError(mixer->api, "%s: fail to add configDMIX=%s", __func__, pcmPlug->cid.cardid);
+ AFB_API_ERROR(mixer->api, "%s: fail to add configDMIX=%s", __func__, pcmPlug->cid.cardid);
goto OnErrorExit;
}
// Debug config & pcm
AlsaDumpCtlConfig(mixer, "plug-dmix", dmixConfig, 1);
- AFB_ApiNotice(mixer->api, "%s: %s done", __func__, pcmPlug->cid.cardid);
+ AFB_API_NOTICE(mixer->api, "%s: %s done", __func__, pcmPlug->cid.cardid);
return pcmPlug;
OnErrorExit:
@@ -133,6 +133,6 @@ OnErrorExit:
AlsaDumpCtlConfig(mixer, "plug-pcm", pcmConfig, 1);
AlsaDumpCtlConfig(mixer, "plug-dmix", dmixConfig, 1);
- AFB_ApiNotice(mixer->api, "%s: FAIL", __func__);
+ AFB_API_NOTICE(mixer->api, "%s: FAIL", __func__);
return NULL;
}
diff --git a/plugins/alsa/alsa-plug-rate.c b/plugins/alsa/alsa-plug-rate.c
index d4a3068..ef7c335 100644
--- a/plugins/alsa/alsa-plug-rate.c
+++ b/plugins/alsa/alsa-plug-rate.c
@@ -27,7 +27,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream,
snd_config_t *rateConfig, *slaveConfig, *elemConfig, *pcmConfig;
- AFB_ApiDebug(mixer->api,"%s : %s", __func__, pcmName);
+ AFB_API_DEBUG(mixer->api,"%s : %s", __func__, pcmName);
AlsaPcmCtlT *pcmPlug = AlsaPcmCtlNew(mixer, pcmName);
if (!pcmPlug) {
@@ -67,7 +67,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream,
error += snd_config_search(snd_config, "pcm", &pcmConfig);
error += snd_config_add(pcmConfig, rateConfig);
if (error) {
- AFB_ApiError(mixer->api, "%s: fail to add config RATE=%s", __func__, pcmPlug->cid.cardid);
+ AFB_API_ERROR(mixer->api, "%s: fail to add config RATE=%s", __func__, pcmPlug->cid.cardid);
goto OnErrorExit;
}
@@ -75,7 +75,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream,
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,
+ AFB_API_ERROR(mixer->api,
"%s: fail to create Rate=%s Slave=%s Error=%s",
__func__, pcmPlug->cid.cardid, pcmSlave->cid.cardid, snd_strerror(error));
goto OnErrorExit;
@@ -84,11 +84,11 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, AlsaStreamAudioT * stream,
// Debug config & pcm
//AlsaDumpCtlConfig(mixer, "plug-rate", pcmConfig, 1);
AlsaDumpCtlConfig (mixer, "plug-rate", rateConfig, 1);
- AFB_ApiNotice(mixer->api, "%s: %s done", __func__, pcmPlug->cid.cardid);
+ AFB_API_NOTICE(mixer->api, "%s: %s done", __func__, pcmPlug->cid.cardid);
return pcmPlug;
OnErrorExit:
AlsaDumpCtlConfig(mixer, "plug-rate", rateConfig, 1);
- AFB_ApiNotice(mixer->api, "%s: OnErrorExit", __func__);
+ AFB_API_NOTICE(mixer->api, "%s: OnErrorExit", __func__);
return NULL;
}
diff --git a/plugins/alsa/alsa-plug-route.c b/plugins/alsa/alsa-plug-route.c
index a192e03..2c7851d 100644
--- a/plugins/alsa/alsa-plug-route.c
+++ b/plugins/alsa/alsa-plug-route.c
@@ -42,7 +42,7 @@ STATIC int CardChannelByUid(SoftMixerT *mixer, const char *uid, ChannelCardPortT
cds_list_for_each_entry(pcm, &mixer->sinks.list, list) {
if (pcm->nbChannels == 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: No Sink card=%s [should declare channels]",
__func__, pcm->uid);
goto OnErrorExit;
@@ -66,7 +66,7 @@ STATIC int CardChannelByUid(SoftMixerT *mixer, const char *uid, ChannelCardPortT
}
if (!found) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: No Channel with uid=%s [should declare channels]",
__func__, uid);
goto OnErrorExit;
@@ -87,10 +87,10 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
char *cardid = NULL;
char *slaveUid = NULL;
- AFB_ApiDebug(mixer->api, "%s (zone %s)", __func__, zone->uid);
+ AFB_API_DEBUG(mixer->api, "%s (zone %s)", __func__, zone->uid);
if (mixer->nbSinks == 0) {
- AFB_ApiError(mixer->api, "%s: mixer=%s zone(%s)(zone) No sink found [should Registry sound card first]", __func__, mixer->uid, zone->uid);
+ AFB_API_ERROR(mixer->api, "%s: mixer=%s zone(%s)(zone) No sink found [should Registry sound card first]", __func__, mixer->uid, zone->uid);
goto fail;
}
@@ -109,7 +109,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
pcmRoute->params = ApiSinkGetParamsByZone(mixer, zone->uid);
if (pcmRoute->params == NULL) {
- AFB_ApiError(mixer->api, "%s: Failed to retrieve zone parameters", __func__);
+ AFB_API_ERROR(mixer->api, "%s: Failed to retrieve zone parameters", __func__);
goto fail_nodump;
}
@@ -130,7 +130,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
AlsaPcmChannelT * channel = cds_list_first_entry(&zone->sinks.list, AlsaPcmChannelT, list);
error = CardChannelByUid(mixer, channel->uid, &slave);
if (error) {
- AFB_ApiError(mixer->api, "%s:zone(%s) fail to find channel=%s", __func__, zone->uid, channel->uid);
+ AFB_API_ERROR(mixer->api, "%s:zone(%s) fail to find channel=%s", __func__, zone->uid, channel->uid);
goto fail;
}
@@ -162,16 +162,16 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
cds_list_for_each_entry(channel, &zone->sinks.list, list) {
- AFB_ApiDebug(mixer->api, "%s: zone->sink channel %s ", __func__, channel->uid);
+ AFB_API_DEBUG(mixer->api, "%s: zone->sink channel %s ", __func__, channel->uid);
error = CardChannelByUid(mixer, channel->uid, &channelCardPort);
if (error) {
- AFB_ApiError(mixer->api, "%s: zone(%s) fail to find channel=%s", __func__, zone->uid, channel->uid);
+ AFB_API_ERROR(mixer->api, "%s: zone(%s) fail to find channel=%s", __func__, zone->uid, channel->uid);
goto fail;
}
if (slave.cardidx != channelCardPort.cardidx) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: zone(%s) cannot span over multiple sound card %s != %s ",
__func__, zone->uid, slave.cardid, channelCardPort.cardid);
goto fail;
@@ -190,13 +190,13 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
error = snd_config_make_compound(&cports[port], channelS, 0);
if (error) {
- AFB_ApiError(mixer->api, "%s: make_compound failed , err %s", __func__, snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: make_compound failed , err %s", __func__, snd_strerror(error));
goto fail;
}
error = snd_config_add(tableConfig, cports[port]);
if (error) {
- AFB_ApiError(mixer->api, "%s: add compound to table failed, err %s", __func__, snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: add compound to table failed, err %s", __func__, snd_strerror(error));
goto fail;
}
}
@@ -214,13 +214,13 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
error = snd_config_imake_real(&elemConfig, targetS, volume);
if (error) {
- AFB_ApiError(mixer->api, "%s: Failed to interpret volume real value, err %s", __func__, snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Failed to interpret volume real value, err %s", __func__, snd_strerror(error));
goto fail;
}
error = snd_config_add(cports[port], elemConfig);
if (error) {
- AFB_ApiError(mixer->api, "%s Failed to add ttable entry:err=%s", __func__, snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s Failed to add ttable entry:err=%s", __func__, snd_strerror(error));
goto fail;
}
@@ -259,7 +259,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
if (open) error = _snd_pcm_route_open(&pcmRoute->handle, pcmRoute->cid.cardid, snd_config, routeConfig, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: zone(%s) fail to create Plug=%s error=%s",
__func__, zone->uid, pcmRoute->cid.cardid, snd_strerror(error));
goto fail;
@@ -269,7 +269,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
error += snd_config_search(snd_config, "pcm", &pcmConfig);
error += snd_config_add(pcmConfig, routeConfig);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: %s fail to add config route=%s error=%s",
__func__, zone->uid, pcmRoute->cid.cardid, snd_strerror(error));
goto fail;
@@ -278,15 +278,15 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
zone->routeConfig = routeConfig;
// Debug config & pcm
- AFB_ApiNotice(mixer->api, "%s: zone(%s) DONE", __func__, zone->uid);
+ AFB_API_NOTICE(mixer->api, "%s: zone(%s) DONE", __func__, zone->uid);
AlsaDumpCtlConfig(mixer, "plug-route", routeConfig, 1);
return pcmRoute;
fail:
-// AFB_ApiError(mixer->api, "%s ERROR, DUMPING PCM...", __func__);
+// AFB_API_ERROR(mixer->api, "%s ERROR, DUMPING PCM...", __func__);
// AlsaDumpCtlConfig(mixer, "plug-pcm", snd_config, 1);
- AFB_ApiError(mixer->api, "%s ERROR, DUMPING ROUTE...", __func__);
+ AFB_API_ERROR(mixer->api, "%s ERROR, DUMPING ROUTE...", __func__);
AlsaDumpCtlConfig(mixer, "plug-route", routeConfig, 1);
fail_nodump:
@@ -294,6 +294,6 @@ fail_nodump:
free(cardid);
free(slaveUid);
- AFB_ApiNotice(mixer->api, "%s: zone(%s) FAIL", __func__, zone->uid);
+ AFB_API_NOTICE(mixer->api, "%s: zone(%s) FAIL", __func__, zone->uid);
return NULL;
}
diff --git a/plugins/alsa/alsa-plug-vol.c b/plugins/alsa/alsa-plug-vol.c
index 09025c4..1e7496f 100644
--- a/plugins/alsa/alsa-plug-vol.c
+++ b/plugins/alsa/alsa-plug-vol.c
@@ -32,7 +32,7 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
int error = 0;
AlsaPcmCtlT *pcmVol = NULL;
- AFB_ApiDebug(mixer->api, "%s create SOFTVOL on %s (nb channels=%d)", __func__, slaveid, stream->params->channels);
+ AFB_API_DEBUG(mixer->api, "%s create SOFTVOL on %s (nb channels=%d)", __func__, slaveid, stream->params->channels);
if (asprintf(&cardid, "softvol-%s", stream->uid) == -1) {
SOFTMIXER_NOMEM(mixer->api);
goto OnErrorExit;
@@ -77,7 +77,7 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
if (open) error = _snd_pcm_softvol_open(&pcmVol->handle, stream->uid, snd_config, streamConfig, SND_PCM_STREAM_PLAYBACK , SND_PCM_NONBLOCK);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: %s(stream) fail to create Plug=%s Slave=%s error=%s",
__func__, stream->uid, pcmVol->cid.cardid, sndcard->cid.cardid, snd_strerror(error));
goto OnErrorExit;
@@ -89,7 +89,7 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
error += snd_config_search(snd_config, "pcm", &pcmConfig);
error += snd_config_add(pcmConfig, streamConfig);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: %s(stream) fail to add config error=%s",
__func__, stream->uid, snd_strerror(error));
goto OnErrorExit;
@@ -100,13 +100,13 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
// Debug config & pcm
//AlsaDumpCtlConfig (mixer, "plug-config", pcmConfig, 1);
AlsaDumpCtlConfig(mixer, "plug-softvol", streamConfig, 1);
- AFB_ApiNotice(mixer->api, "%s: %s(stream) done", __func__, stream->uid);
+ AFB_API_NOTICE(mixer->api, "%s: %s(stream) done", __func__, stream->uid);
return pcmVol;
OnErrorExit:
free(cardid);
//AlsaDumpCtlConfig (mixer, "plug-config", pcmConfig, 1);
AlsaDumpCtlConfig(mixer, "plug-softvol", streamConfig, 1);
- AFB_ApiNotice(mixer->api, "AlsaCreateSoftvol:%s(stream) OnErrorExit", stream->uid);
+ AFB_API_NOTICE(mixer->api, "AlsaCreateSoftvol:%s(stream) OnErrorExit", stream->uid);
return NULL;
}
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h
index 346964a..b6c0e5b 100644
--- a/plugins/alsa/alsa-softmixer.h
+++ b/plugins/alsa/alsa-softmixer.h
@@ -70,12 +70,12 @@
int _snd_pcm_ ## plugin ## _open(snd_pcm_t **pcmp, const char *name, snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode)
#define SOFTMIXER_NOMEM(api) \
- AFB_ApiError((api), "%s: Insufficient memory", __func__)
+ AFB_API_ERROR((api), "%s: Insufficient memory", __func__)
// auto switch from Log to API request depending on request presence.
#define AFB_IfReqFailF(mixer, request, status, format, ...) \
- if (request) AFB_ReqFailF(request, status, format, __VA_ARGS__); \
- else AFB_ApiError(mixer->api, format, __VA_ARGS__);
+ if (request) afb_req_fail_f(request, status, format, __VA_ARGS__); \
+ else AFB_API_ERROR(mixer->api, format, __VA_ARGS__);
#ifndef PUBLIC
#define PUBLIC
@@ -133,7 +133,7 @@ typedef struct {
typedef struct {
AlsaPcmCtlT *pcmIn;
AlsaPcmCtlT *pcmOut;
- AFB_ApiT api;
+ afb_api_t api;
sd_event_source* evtsrc;
size_t frame_size;
@@ -284,7 +284,7 @@ typedef struct AlsaStreamAudioT_ {
typedef struct SoftMixerT_{
const char *uid;
const char *info;
- AFB_ApiT api;
+ afb_api_t api;
sd_event *sdLoop;
struct {
@@ -368,12 +368,12 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
// alsa-api-*
-PUBLIC int ApiLoopAttach(SoftMixerT *mixer, AFB_ReqT request, const char *, json_object * argsJ);
-PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char *, json_object * argsJ);
-PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *, json_object * argsJ);
-PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid, const char *prefix, json_object * argsJ);
-PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char *, json_object * argsJ);
-PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char *, json_object *argsJ);
+PUBLIC int ApiLoopAttach(SoftMixerT *mixer, afb_req_t request, const char *, json_object * argsJ);
+PUBLIC int ApiSourceAttach(SoftMixerT *mixer, afb_req_t request, const char *, json_object * argsJ);
+PUBLIC int ApiSinkAttach(SoftMixerT *mixer, afb_req_t request, const char *, json_object * argsJ);
+PUBLIC int ApiStreamAttach(SoftMixerT *mixer, afb_req_t request, const char * uid, const char *prefix, json_object * argsJ);
+PUBLIC int ApiZoneAttach(SoftMixerT *mixer, afb_req_t request, const char *, json_object * argsJ);
+PUBLIC int ApiRampAttach(SoftMixerT *mixer, afb_req_t request, const char *, json_object *argsJ);
PUBLIC void loopsDisplay(SoftMixerT * mixer);
diff --git a/plugins/alsa/alsa-transaction.c b/plugins/alsa/alsa-transaction.c
index 1958c87..1677582 100644
--- a/plugins/alsa/alsa-transaction.c
+++ b/plugins/alsa/alsa-transaction.c
@@ -70,7 +70,7 @@ fail:
void AlsaMixerTransactionDoCleanup(AlsaMixerTransaction* transaction) {
AlsaMixerTransactionDataItem * item, *sav;
- AFB_ApiInfo(transaction->mixer->api, "%s for transaction %s", __func__, transaction->uid);
+ AFB_API_INFO(transaction->mixer->api, "%s for transaction %s", __func__, transaction->uid);
cds_list_for_each_entry_safe(item, sav, &transaction->item_list, list_entry) {
if (item->destructor)
@@ -80,10 +80,10 @@ void AlsaMixerTransactionDoCleanup(AlsaMixerTransaction* transaction) {
free(item);
}
- AFB_ApiInfo(transaction->mixer->api, "%s for transaction %s .. DONE !", __func__, transaction->uid);
+ AFB_API_INFO(transaction->mixer->api, "%s for transaction %s .. DONE !", __func__, transaction->uid);
}
-void AlsaMixerTransactionVerbCB(AFB_ReqT request) {
+void AlsaMixerTransactionVerbCB(afb_req_t request) {
json_object *responseJ = NULL;
AlsaMixerTransaction *transaction = (AlsaMixerTransaction*) afb_req_get_vcbdata(request);
json_object *argsJ = afb_req_json(request);
@@ -95,7 +95,7 @@ void AlsaMixerTransactionVerbCB(AFB_ReqT request) {
"action", &action);
if (error) {
- AFB_ReqFailF(request, "missing action", "%s: missing 'action' field: %s", transaction->uid, json_object_get_string(argsJ));
+ afb_req_fail_f(request, "missing action", "%s: missing 'action' field: %s", transaction->uid, json_object_get_string(argsJ));
goto fail;
}
@@ -113,20 +113,20 @@ void AlsaMixerTransactionVerbCB(AFB_ReqT request) {
error = afb_api_del_verb(transaction->mixer->api, transaction->uid, (void**)NULL);
if (error) {
- AFB_ReqFail(request, "verb deletion" , "verb was not removed");
+ afb_req_fail(request, "verb deletion" , "verb was not removed");
goto fail;
}
AlsaMixerTransactionDelete(transaction);
} else {
- AFB_ReqFailF(request, "unsupported action", "%s: unsupported action %s (supported ones are ['remove']", transaction->uid, action);
+ afb_req_fail_f(request, "unsupported action", "%s: unsupported action %s (supported ones are ['remove']", transaction->uid, action);
goto fail;
}
responseJ=json_object_new_object();
json_object_object_add(responseJ, "result", json_object_new_string("OK"));
- AFB_ReqSuccess(request, responseJ, uid);
+ afb_req_success(request, responseJ, uid);
fail:
free((char*)uid);
diff --git a/plugins/alsa/alsa-transaction.h b/plugins/alsa/alsa-transaction.h
index dd6e91b..7726458 100644
--- a/plugins/alsa/alsa-transaction.h
+++ b/plugins/alsa/alsa-transaction.h
@@ -4,7 +4,7 @@
#include <urcu/list.h>
#include <stdbool.h>
-#include "afb-definitions.h"
+#include <afb/afb-binding.h>
struct SoftMixerT_;
@@ -37,6 +37,6 @@ extern void AlsaMixerTransactionDoCleanup(AlsaMixerTransaction*);
extern bool AlsaMixerTransactionVerbCreate(AlsaMixerTransaction*);
-extern void AlsaMixerTransactionVerbCB(AFB_ReqT request);
+extern void AlsaMixerTransactionVerbCB(afb_req_t request);
#endif /* __INC_ALSA_TRANSACTION_H */
diff --git a/plugins/alsa/alsa-utils-bypath.c b/plugins/alsa/alsa-utils-bypath.c
index 3a8afb7..a1b5826 100644
--- a/plugins/alsa/alsa-utils-bypath.c
+++ b/plugins/alsa/alsa-utils-bypath.c
@@ -45,13 +45,13 @@ PUBLIC snd_ctl_card_info_t *AlsaByPathInfo(SoftMixerT *mixer, const char *devpat
open_dev = open(devpath, O_RDONLY);
if (open_dev < 0) {
- AFB_ApiError(mixer->api, "%s: Unable to open %s", __func__, devpath);
+ AFB_API_ERROR(mixer->api, "%s: Unable to open %s", __func__, devpath);
goto fail_cardinfo;
}
int rc = ioctl(open_dev, SNDRV_CTL_IOCTL_CARD_INFO(snd_ctl_card_info_sizeof()), cardInfo);
if (rc < 0) {
- AFB_ApiError(mixer->api, "%s: ioctl on %s failed", __func__, devpath);
+ AFB_API_ERROR(mixer->api, "%s: ioctl on %s failed", __func__, devpath);
goto fail_dev;
}
@@ -69,7 +69,7 @@ fail:
PUBLIC AlsaPcmCtlT * AlsaPcmCtlNew(SoftMixerT* mixer, const char * name) {
- AFB_ApiDebug(mixer->api, "%s: NEW %s",__func__, name);
+ AFB_API_DEBUG(mixer->api, "%s: NEW %s",__func__, name);
AlsaPcmCtlT *pcmCtl = calloc(1, sizeof (AlsaPcmCtlT));
if (pcmCtl == NULL) {
@@ -91,16 +91,16 @@ PUBLIC void AlsaPcmCtlDelete(SoftMixerT* mixer, void * arg) {
AlsaPcmCtlT * pcmCtl = (AlsaPcmCtlT *) arg;
- AFB_ApiDebug(mixer->api, "%s of %s (plug: %d)", __func__, pcmCtl->name, pcmCtl->isPcmPlug);
+ AFB_API_DEBUG(mixer->api, "%s of %s (plug: %d)", __func__, pcmCtl->name, pcmCtl->isPcmPlug);
if (!pcmCtl->closeAtDeletion)
goto done;
- AFB_ApiDebug(mixer->api, "%s: Closing %s", __func__, pcmCtl->cid.cardid);
+ AFB_API_DEBUG(mixer->api, "%s: Closing %s", __func__, pcmCtl->cid.cardid);
error = snd_pcm_close(pcmCtl->handle);
if (error) {
// It's safe to ignore this error. In case of ioplug PCM, the device may have already disappeared
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"%s: failed to close capture PCM %s: err=%s", __func__, pcmCtl->cid.cardid, snd_strerror(error));
}
@@ -111,7 +111,7 @@ done:
free((char*) pcmCtl->cid.cardid);
free(pcmCtl);
- AFB_ApiDebug(mixer->api, "%s DONE", __func__);
+ AFB_API_DEBUG(mixer->api, "%s DONE", __func__);
}
@@ -169,13 +169,13 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcmCtl(SoftMixerT *mixer, AlsaDevInfoT *pcmDev
if (pcmDev->pcmplug_params)
pcmCtl->isPcmPlug = true;
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"%s OPEN PCM '%s', direction %s",
__func__, pcmDev->cardid, direction==SND_PCM_STREAM_PLAYBACK?"playback":"capture");
error = snd_pcm_open(&pcmCtl->handle, pcmCtl->cid.cardid, direction, SND_PCM_NONBLOCK);
if (error < 0) {
- AFB_ApiError(mixer->api, "%s: fail openpcm cardid=%s error=%s", __func__, pcmCtl->cid.cardid, snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: fail openpcm cardid=%s error=%s", __func__, pcmCtl->cid.cardid, snd_strerror(error));
goto fail_pcmctl;
}
@@ -196,19 +196,19 @@ PUBLIC snd_ctl_t *AlsaByPathOpenCtl(SoftMixerT *mixer, const char *uid, AlsaSndC
// get card info from /dev/snd/xxx if not use hw:x,x,x
snd_ctl_card_info_t *cardInfo = NULL;
- AFB_ApiDebug(mixer->api, "%s: devpath %s, cardid %s, plug %s", __func__, dev->cid.devpath, dev->cid.cardid, dev->cid.pcmplug_params);
+ AFB_API_DEBUG(mixer->api, "%s: devpath %s, cardid %s, plug %s", __func__, dev->cid.devpath, dev->cid.cardid, dev->cid.pcmplug_params);
if (dev->cid.devpath)
cardInfo = AlsaByPathInfo(mixer, dev->cid.devpath);
else if (dev->cid.cardid)
cardInfo = AlsaCtlGetCardInfo(mixer, dev->cid.cardid);
else if (dev->cid.pcmplug_params) {
- AFB_ApiDebug(mixer->api, "Get card info from plug params %s", dev->cid.pcmplug_params);
+ AFB_API_DEBUG(mixer->api, "Get card info from plug params %s", dev->cid.pcmplug_params);
cardInfo = AlsaCtlGetCardInfo(mixer, dev->cid.pcmplug_params);
}
if (!cardInfo) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: uid=%s fail to find sndcard by path=%s id=%s",
__func__, uid, dev->cid.devpath, dev->cid.cardid);
goto fail;
@@ -235,13 +235,13 @@ PUBLIC snd_ctl_t *AlsaByPathOpenCtl(SoftMixerT *mixer, const char *uid, AlsaSndC
}
if ((err = snd_ctl_open(&handle, dev->cid.cardid, 0)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s uid=%s sndcard open fail cardid=%s longname=%s error=%s",
__func__, uid, dev->cid.cardid, dev->cid.longname, snd_strerror(err));
goto fail_cardid;
}
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s: uid=%s cardid=%s cardname=%s pcmplug %s",
__func__, uid, dev->cid.cardid, dev->cid.longname, dev->cid.pcmplug_params);
free(cardInfo);
diff --git a/plugins/alsa/alsa-utils-dump.c b/plugins/alsa/alsa-utils-dump.c
index 79059ee..90e4842 100644
--- a/plugins/alsa/alsa-utils-dump.c
+++ b/plugins/alsa/alsa-utils-dump.c
@@ -80,13 +80,13 @@ PUBLIC void AlsaDumpFormats(SoftMixerT *mixer, snd_pcm_t *pcm) {
snd_pcm_hw_params_alloca(&pxmHwParams);
ret = snd_pcm_hw_params_any(pcm, pxmHwParams);
if (ret < 0) {
- AFB_ApiError(mixer->api, "FAILED to read params of PCM %s", snd_pcm_name(pcm));
+ AFB_API_ERROR(mixer->api, "FAILED to read params of PCM %s", snd_pcm_name(pcm));
}
- AFB_ApiDebug(mixer->api, "Available formats: PCM=%s", ALSA_PCM_UID(pcm, string));
+ AFB_API_DEBUG(mixer->api, "Available formats: PCM=%s", ALSA_PCM_UID(pcm, string));
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (snd_pcm_hw_params_test_format(pcm, pxmHwParams, format) == 0) {
- AFB_ApiDebug(mixer->api, "- %s", snd_pcm_format_name(format));
+ AFB_API_DEBUG(mixer->api, "- %s", snd_pcm_format_name(format));
}
}
}
@@ -109,7 +109,7 @@ PUBLIC void AlsaDumpCtlSubdev(SoftMixerT *mixer, snd_ctl_t *handle) {
while (1) {
if (snd_ctl_pcm_next_device(handle, &dev) < 0) {
- AFB_ApiError(mixer->api, "%s: fail to open subdev card id=%s name=%s", __func__, cardId, cardName);
+ AFB_API_ERROR(mixer->api, "%s: fail to open subdev card id=%s name=%s", __func__, cardId, cardName);
goto OnErrorExit;
}
@@ -119,11 +119,11 @@ PUBLIC void AlsaDumpCtlSubdev(SoftMixerT *mixer, snd_ctl_t *handle) {
// ignore empty device slot
if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
if (err != -ENOENT)
- AFB_ApiError(mixer->api, "%s: control digital audio info (%s): %s", __func__, cardName, snd_strerror(err));
+ AFB_API_ERROR(mixer->api, "%s: control digital audio info (%s): %s", __func__, cardName, snd_strerror(err));
continue;
}
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"%s card %d: %s [%s], device %d: %s [%s]",
__func__, cardIndex, cardId, cardName, dev, snd_pcm_info_get_id(pcminfo), snd_pcm_info_get_name(pcminfo));
@@ -134,12 +134,12 @@ PUBLIC void AlsaDumpCtlSubdev(SoftMixerT *mixer, snd_ctl_t *handle) {
for (unsigned int idx = 0; idx < subdevCount; idx++) {
snd_pcm_info_set_subdevice(pcminfo, idx);
if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
- AFB_ApiError(mixer->api, "%s: control digital audio playback info %i: %s", __func__, cardIndex, snd_strerror(err));
+ AFB_API_ERROR(mixer->api, "%s: control digital audio playback info %i: %s", __func__, cardIndex, snd_strerror(err));
} else {
- AFB_ApiDebug(mixer->api, "%s: -- Subdevice #%d: %s", __func__, idx, snd_pcm_info_get_subdevice_name(pcminfo));
+ AFB_API_DEBUG(mixer->api, "%s: -- Subdevice #%d: %s", __func__, idx, snd_pcm_info_get_subdevice_name(pcminfo));
}
}
- AFB_ApiDebug(mixer->api, "%s => subdevice count=%d avaliable=%d", __func__, subdevCount, subdevAvail);
+ AFB_API_DEBUG(mixer->api, "%s => subdevice count=%d avaliable=%d", __func__, subdevCount, subdevAvail);
}
return;
@@ -154,7 +154,7 @@ PUBLIC void AlsaDumpPcmParams(SoftMixerT *mixer, snd_pcm_hw_params_t *pcmHwParam
snd_output_buffer_open(&output);
snd_pcm_hw_params_dump(pcmHwParams, output);
snd_output_buffer_string(output, &buffer);
- AFB_ApiDebug(mixer->api, "%s:\n--------------\n%s\n-------------",__func__, buffer);
+ AFB_API_DEBUG(mixer->api, "%s:\n--------------\n%s\n-------------",__func__, buffer);
snd_output_close(output);
}
@@ -169,7 +169,7 @@ PUBLIC void AlsaDumpPcmInfo(SoftMixerT *mixer, const char* info, snd_pcm_t *pcm)
snd_pcm_dump(pcm, out);
snd_output_buffer_string(out, &buffer);
- AFB_ApiDebug(mixer->api, "%s:\n%s", __func__, buffer);
+ AFB_API_DEBUG(mixer->api, "%s:\n%s", __func__, buffer);
snd_output_close(out);
}
@@ -184,7 +184,7 @@ PUBLIC void AlsaDumpCtlConfig(SoftMixerT *mixer, const char* info, snd_config_t
snd_config_iterator_t it, next;
if (!config) {
- AFB_ApiDebug(mixer->api,"%s (%s): no config", __func__, info);
+ AFB_API_DEBUG(mixer->api,"%s (%s): no config", __func__, info);
return;
}
@@ -208,28 +208,28 @@ PUBLIC void AlsaDumpCtlConfig(SoftMixerT *mixer, const char* info, snd_config_t
case SND_CONFIG_TYPE_INTEGER:
snd_config_get_integer(node, &valueI);
- AFB_ApiDebug(mixer->api, "%s: %s %s: %d (int)", info, pretty, key, (int) valueI);
+ AFB_API_DEBUG(mixer->api, "%s: %s %s: %d (int)", info, pretty, key, (int) valueI);
break;
case SND_CONFIG_TYPE_REAL:
snd_config_get_real(node, &valueD);
- AFB_ApiDebug(mixer->api, "%s: %s %s: %.2f (float)", info, pretty, key, valueD);
+ AFB_API_DEBUG(mixer->api, "%s: %s %s: %.2f (float)", info, pretty, key, valueD);
break;
case SND_CONFIG_TYPE_STRING:
snd_config_get_string(node, &valueS);
- AFB_ApiDebug(mixer->api, "%s: %s %s: %s (str)", info, pretty, key, valueS);
+ AFB_API_DEBUG(mixer->api, "%s: %s %s: %s (str)", info, pretty, key, valueS);
break;
case SND_CONFIG_TYPE_COMPOUND:
- AFB_ApiDebug(mixer->api, "%s: %s %s { ", info, pretty, key);
+ AFB_API_DEBUG(mixer->api, "%s: %s %s { ", info, pretty, key);
AlsaDumpCtlConfig(mixer, info, node, indent + 2);
- AFB_ApiDebug(mixer->api, "%s: %s } ", info, pretty);
+ AFB_API_DEBUG(mixer->api, "%s: %s } ", info, pretty);
break;
default:
snd_config_get_string(node, &valueS);
- AFB_ApiDebug(mixer->api, "%s: %s: key=%s unknown=%s", info, pretty, key, valueS);
+ AFB_API_DEBUG(mixer->api, "%s: %s: key=%s unknown=%s", info, pretty, key, valueS);
break;
}
}