summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-streams.c
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:45:09 +0100
commitd5cc09d1ef5c58bb8d34e3a47c391a10d8b48181 (patch)
tree36b65c43fb60ae0ac22b09c832677be2f5fada1e /plugins/alsa/alsa-api-streams.c
parent17ad00443eecdb2ed7b92da01c7be6f316e04b64 (diff)
Git submodule migration to separated libraries
- 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>
Diffstat (limited to 'plugins/alsa/alsa-api-streams.c')
-rw-r--r--plugins/alsa/alsa-api-streams.c132
1 files changed, 66 insertions, 66 deletions
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;
}