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 11:10:17 +0100
commita48048548e85244a66e830523ebcbeb7f709ad60 (patch)
tree36193cfe797df0967e551cc8adc18a18fe96ae03 /4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
parentecb03929df1b66e0d41771e49f3f810d4bcdffba (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.c43
1 files changed, 29 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 6f160d7..165bb42 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_ApiAddVerb(apiHandle,
currentMixerDataT->data[idx].verb,
"Stream action transferred to mixer",
- HalCtlsActionOnCall,
+ HalCtlsActionOnStream,
(void *) &currentMixerDataT->data[idx],
NULL,
0,
@@ -109,38 +109,38 @@ 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_ApiAddVerb(apiHandle,
- HAL_PLAYBACK_VERB,
+ HAL_PLAYBACK_ID,
"Playback action transferred to mixer",
- HalCtlsActionOnCall,
- (void *) currentMixerDataT->data,
+ HalCtlsActionOnPlayback,
+ (void *) currentMixerDataT,
NULL,
0,
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_ApiAddVerb(apiHandle,
- HAL_CAPTURE_VERB,
+ HAL_CAPTURE_ID,
"Capture action transferred to mixer",
- HalCtlsActionOnCall,
- (void *) currentMixerDataT->data,
+ HalCtlsActionOnCapture,
+ (void *) currentMixerDataT,
NULL,
0,
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;
}
}
@@ -173,6 +173,21 @@ 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_ApiAddVerb(apiHandle,
+ HAL_ALL_STREAMS_VERB,
+ "Send a stream action on all streams",
+ HalCtlsActionOnAllStream,
+ (void *) &currentHalSpecificData->ctlHalStreamsData,
+ NULL,
+ 0,
+ 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;
}