summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-api-mixer.c')
-rw-r--r--plugins/alsa/alsa-api-mixer.c88
1 files changed, 44 insertions, 44 deletions
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);