summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-12-17 19:41:41 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-12-20 15:45:50 +0100
commit24b80b0044e0a9636eecb5c5649e8e404c06090f (patch)
tree1c3b3aeceae685180a61f3c07abbf2a9dc2678b4 /4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
parent88ff9d8a47b87e10f25f263d847a68b024516999 (diff)
Rework calls to mixer streams
When using 'playback'/'capture' verbs, call all associated controls. When at least one stream has been created by the mixer, a verb called 'all-streams' is added to transfer a request to all the streams. Bug-AGL: SPEC-1313 Change-Id: Ie574e2ef0dcae8abbd45523b49093ec2ed1413cf Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
index 254c57b..aa169c7 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
@@ -83,21 +83,21 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerDataT *currentM
size = (int) strlen(currentDataVerbName);
for(verbStart = 0; verbStart < size; verbStart++) {
- if(currentDataVerbName[verbStart] == '#')
+ if(currentDataVerbName[verbStart] == '#') {
+ verbStart++;
break;
+ }
}
if(verbStart == size)
verbStart = 0;
- else
- verbStart++;
currentMixerDataT->data[idx].verb = strdup(&currentDataVerbName[verbStart]);
if(afb_dynapi_add_verb(apiHandle,
currentMixerDataT->data[idx].verb,
"Stream action transferred to mixer",
- HalCtlsActionOnCall,
+ HalCtlsActionOnStream,
(void *) &currentMixerDataT->data[idx],
NULL,
0)) {
@@ -108,36 +108,36 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerDataT *currentM
}
}
else if(dataType == MIXER_DATA_PLAYBACKS) {
- currentMixerDataT->data[idx].verb = strdup(HAL_PLAYBACK_VERB);
+ currentMixerDataT->data[idx].verb = strdup(HAL_PLAYBACK_ID);
}
else if(dataType == MIXER_DATA_CAPTURES) {
- currentMixerDataT->data[idx].verb = strdup(HAL_CAPTURE_VERB);
+ currentMixerDataT->data[idx].verb = strdup(HAL_CAPTURE_ID);
}
}
}
if(dataType == MIXER_DATA_PLAYBACKS) {
if(afb_dynapi_add_verb(apiHandle,
- HAL_PLAYBACK_VERB,
+ HAL_PLAYBACK_ID,
"Playback action transferred to mixer",
- HalCtlsActionOnCall,
- (void *) currentMixerDataT->data,
+ HalCtlsActionOnPlayback,
+ (void *) currentMixerDataT,
NULL,
0)) {
- AFB_ApiError(apiHandle, "Error while creating verb for playbacks : '%s'", HAL_PLAYBACK_VERB);
+ AFB_ApiError(apiHandle, "Error while creating verb for playbacks : '%s'", HAL_PLAYBACK_ID);
err += (int) MIXER_ERROR_PLAYBACK_VERB_NOT_CREATED;
}
}
if(dataType == MIXER_DATA_CAPTURES) {
if(afb_dynapi_add_verb(apiHandle,
- HAL_CAPTURE_VERB,
+ HAL_CAPTURE_ID,
"Capture action transferred to mixer",
- HalCtlsActionOnCall,
- (void *) currentMixerDataT->data,
+ HalCtlsActionOnCapture,
+ (void *) currentMixerDataT,
NULL,
0)) {
- AFB_ApiError(apiHandle, "Error while creating verb for captures : '%s'", HAL_CAPTURE_VERB);
+ AFB_ApiError(apiHandle, "Error while creating verb for captures : '%s'", HAL_CAPTURE_ID);
err += (int) MIXER_ERROR_CAPTURE_VERB_NOT_CREATED;
}
}
@@ -170,6 +170,20 @@ int HalCtlsHandleMixerAttachResponse(AFB_ApiT apiHandle, struct CtlHalSpecificDa
if(mixerCapturesJ && (err += HalCtlsHandleMixerData(apiHandle, &currentHalSpecificData->ctlHalCapturesData, mixerCapturesJ, MIXER_DATA_CAPTURES)))
AFB_ApiError(apiHandle, "Error during handling response mixer captures data '%s'", json_object_get_string(mixerCapturesJ));
+ if(! currentHalSpecificData->ctlHalStreamsData.count) {
+ AFB_ApiWarning(apiHandle, "No stream detected in mixer response, %s verb won't be created", HAL_ALL_STREAMS_VERB);
+ }
+ else if(afb_dynapi_add_verb(apiHandle,
+ HAL_ALL_STREAMS_VERB,
+ "Send a stream action on all streams",
+ HalCtlsActionOnAllStream,
+ (void *) &currentHalSpecificData->ctlHalStreamsData,
+ NULL,
+ 0)) {
+ AFB_ApiError(apiHandle, "Error while creating verb for all streams : '%s'", HAL_ALL_STREAMS_VERB);
+ return (int) MIXER_ERROR_ALL_STREAMS_VERB_NOT_CREATED;
+ }
+
return err;
}