diff options
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.c | 43 |
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(¤tDataVerbName[verbStart]); if(AFB_ApiAddVerb(apiHandle, currentMixerDataT->data[idx].verb, "Stream action transferred to mixer", - HalCtlsActionOnCall, + HalCtlsActionOnStream, (void *) ¤tMixerDataT->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, ¤tHalSpecificData->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 *) ¤tHalSpecificData->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; } |